// // (C) Copyright 2003-2019 by Autodesk, Inc. // // Permission to use, copy, modify, and distribute this software in // object code form for any purpose and without fee is hereby granted, // provided that the above copyright notice appears in all copies and // that both that copyright notice and the limited warranty and // restricted rights notice below appear in all supporting // documentation. // // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE // UNINTERRUPTED OR ERROR FREE. // // Use, duplication, or disclosure by the U.S. Government is subject to // restrictions set forth in FAR 52.227-19 (Commercial Computer // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) // (Rights in Technical Data and Computer Software), as applicable. // using System; using System.Windows.Forms; using Autodesk.Revit; using Autodesk.Revit.UI; namespace Revit.SDK.Samples.WindowWizard.CS { /// /// The class is used to create window wizard form /// public class WindowWizard { /// /// store the WizardParameter /// private WizardParameter m_para; /// /// store the WindowCreation /// private WindowCreation m_winCreator; /// /// store the ExternalCommandData /// private ExternalCommandData m_commandData; /// /// constructor of WindowWizard /// /// the ExternalCommandData parameter public WindowWizard(ExternalCommandData commandData) { m_commandData = commandData; } /// /// the method is used to show wizard form and do the creation /// /// the process result public int RunWizard() { int result = 0; m_para = new WizardParameter(); m_para.m_template = "DoubleHung"; if (m_para.m_template == "DoubleHung") { m_winCreator = new DoubleHungWinCreation(m_para, m_commandData); } using (WizardForm form = new WizardForm(m_para)) { switch(form.ShowDialog()) { case DialogResult.Cancel: result=0; break; case DialogResult.OK: if (Creation()) result = 1; else result = -1; break; default : result=-1; break; } } return result; } /// /// The window creation process /// /// the result private bool Creation() { return m_winCreator.Creation(); } } }