Пример #1
0
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            var dialog = new TaskDialog( "Create DirectShape" )
              {
            MainInstruction = "Select the way you want to create shape"
              };

              dialog.AddCommandLink( TaskDialogCommandLinkId.CommandLink1, "Initial shape builder" );
              dialog.AddCommandLink( TaskDialogCommandLinkId.CommandLink2, "Jeremy's shape builder" );
              dialog.AddCommandLink( TaskDialogCommandLinkId.CommandLink3, "Simple shape builder" );

              switch( dialog.Show() )
              {
            case TaskDialogResult.CommandLink1:
              CreateDirectShapeInitial.Execute1( commandData );
              break;

            case TaskDialogResult.CommandLink2:
              CreateDirectShape.Execute( commandData );
              break;

            case TaskDialogResult.CommandLink3:
              CreateDirectShapeSimple.Execute( commandData );
              break;
              }
              return Result.Succeeded;
        }
        protected override void OnClosing(CancelEventArgs e)
        {
            var rMode = Preference.Instance.UI.CloseConfirmationMode.Value;
            if (rMode == ConfirmationMode.Always || (rMode == ConfirmationMode.DuringSortie && KanColleGame.Current.Sortie is SortieInfo))
            {
                var rDialog = new TaskDialog()
                {
                    Caption = StringResources.Instance.Main.Product_Name,
                    Instruction = StringResources.Instance.Main.Window_ClosingConfirmation_Instruction,
                    Icon = TaskDialogIcon.Information,
                    Buttons =
                    {
                        new TaskDialogCommandLink(TaskDialogCommonButton.Yes, StringResources.Instance.Main.Window_ClosingConfirmation_Button_Yes),
                        new TaskDialogCommandLink(TaskDialogCommonButton.No, StringResources.Instance.Main.Window_ClosingConfirmation_Button_No),
                    },
                    DefaultCommonButton = TaskDialogCommonButton.No,

                    OwnerWindow = this,
                    ShowAtTheCenterOfOwner = true,
                };
                if (rDialog.ShowAndDispose().ClickedCommonButton == TaskDialogCommonButton.No)
                {
                    e.Cancel = true;
                    return;
                }
            }

            base.OnClosing(e);
        }
Пример #3
0
 public Result Execute( Autodesk.Revit.UI.ExternalCommandData cmdData, ref string msg, ElementSet elems )
 {
   TaskDialog helloDlg = new TaskDialog( "Autodesk Revit" );
   helloDlg.MainContent = "Hello World from " + System.Reflection.Assembly.GetExecutingAssembly().Location;
   helloDlg.Show();
   return Result.Cancelled;
 }
Пример #4
0
 private void ShowTaskDialog()
 {
     if( TaskDialog.OSSupportsTaskDialogs )
     {
         using( TaskDialog dialog = new TaskDialog() )
         {
             dialog.WindowTitle = "Task dialog sample";
             dialog.MainInstruction = "This is an example task dialog.";
             dialog.Content = "Task dialogs are a more flexible type of message box. Among other things, task dialogs support custom buttons, command links, scroll bars, expandable sections, radio buttons, a check box (useful for e.g. \"don't show this again\"), custom icons, and a footer. Some of those things are demonstrated here.";
             dialog.ExpandedInformation = "Ookii.org's Task Dialog doesn't just provide a wrapper for the native Task Dialog API; it is designed to provide a programming interface that is natural to .Net developers.";
             dialog.Footer = "Task Dialogs support footers and can even include <a href=\"http://www.ookii.org\">hyperlinks</a>.";
             dialog.FooterIcon = TaskDialogIcon.Information;
             dialog.EnableHyperlinks = true;
             TaskDialogButton customButton = new TaskDialogButton("A custom button");
             TaskDialogButton okButton = new TaskDialogButton(ButtonType.Ok);
             TaskDialogButton cancelButton = new TaskDialogButton(ButtonType.Cancel);
             dialog.Buttons.Add(customButton);
             dialog.Buttons.Add(okButton);
             dialog.Buttons.Add(cancelButton);
             dialog.HyperlinkClicked += new EventHandler<HyperlinkClickedEventArgs>(TaskDialog_HyperLinkClicked);
             TaskDialogButton button = dialog.ShowDialog(this);
             if( button == customButton )
                 MessageBox.Show(this, "You clicked the custom button", "Task Dialog Sample");
             else if( button == okButton )
                 MessageBox.Show(this, "You clicked the OK button.", "Task Dialog Sample");
         }
     }
     else
     {
         MessageBox.Show(this, "This operating system does not support task dialogs.", "Task Dialog Sample");
     }
 }
Пример #5
0
 public override IDisposable Confirm(ConfirmConfig config)
 {
     var dlg = new TaskDialog
     {
         WindowTitle = config.Title,
         Content = config.Message,
         Buttons =
         {
             new TaskDialogButton(config.CancelText)
             {
                 ButtonType = ButtonType.Cancel
             },
             new TaskDialogButton(config.OkText)
             {
                 ButtonType = ButtonType.Ok
             }
         }
     };
     dlg.ButtonClicked += (sender, args) =>
     {
         var ok = ((TaskDialogButton)args.Item).ButtonType == ButtonType.Ok;
         config.OnAction(ok);
     };
     return new DisposableAction(dlg.Dispose);
 }
Пример #6
0
        void EnablePortCustomization_Checked(object sender, RoutedEventArgs e)
        {
            if (!EnablePortCustomization.IsChecked.Value)
                return;

            var rDialog = new TaskDialog()
            {
                Caption = StringResources.Instance.Main.Product_Name,
                Instruction = StringResources.Instance.Main.PreferenceWindow_Network_Port_Customization_Dialog_Instruction,
                Icon = TaskDialogIcon.Information,
                Content = StringResources.Instance.Main.PreferenceWindow_Network_Port_Customization_Dialog_Content,
                Buttons =
                {
                    new TaskDialogButton(TaskDialogCommonButton.Yes, StringResources.Instance.Main.PreferenceWindow_Network_Port_Customization_Dialog_Button_Yes),
                    new TaskDialogButton(TaskDialogCommonButton.No, StringResources.Instance.Main.PreferenceWindow_Network_Port_Customization_Dialog_Button_No),
                },
                DefaultCommonButton = TaskDialogCommonButton.No,

                OwnerWindow = WindowUtil.GetTopWindow(),
                ShowAtTheCenterOfOwner = true,
            };

            if (rDialog.Show().ClickedCommonButton == TaskDialogCommonButton.No)
                EnablePortCustomization.IsChecked = false;
        }
Пример #7
0
        private void WarnAboutPythonSymbols(string moduleName) {
            const string content =
                "Python/native mixed-mode debugging requires symbol files for the Python interpreter that is being debugged. Please add the folder " +
                "containing those symbol files to your symbol search path, and force a reload of symbols for {0}.";

            var dialog = new TaskDialog(_serviceProvider);

            var openSymbolSettings = new TaskDialogButton("Open symbol settings dialog");
            var downloadSymbols = new TaskDialogButton("Download symbols for my interpreter");
            dialog.Buttons.Add(openSymbolSettings);
            dialog.Buttons.Add(downloadSymbols);

            dialog.Buttons.Add(TaskDialogButton.Close);
            dialog.UseCommandLinks = true;
            dialog.Title = "Python Symbols Required";
            dialog.Content = string.Format(content, moduleName);
            dialog.Width = 0;

            dialog.ShowModal();

            if (dialog.SelectedButton == openSymbolSettings) {
                var cmdId = new CommandID(VSConstants.GUID_VSStandardCommandSet97, VSConstants.cmdidToolsOptions);
                _serviceProvider.GlobalInvoke(cmdId,  "1F5E080F-CBD2-459C-8267-39fd83032166");
            } else if (dialog.SelectedButton == downloadSymbols) {
                PythonToolsPackage.OpenWebBrowser(
                    string.Format("http://go.microsoft.com/fwlink/?LinkId=308954&clcid=0x{0:X}", CultureInfo.CurrentCulture.LCID));
            }
        }
Пример #8
0
        /// <summary>
        /// Shows a dialog asking the user whether she want to create the
        /// specified folder.
        /// </summary>
        /// <param name="path">The folder path.</param>
        /// <returns>
        /// 	<c>true</c> is user wants to create folder; otherwise <c>false</c>.
        /// </returns>
        public bool AskToCreateFolder(string path)
        {
            const string createButtonName = "create";
            const string cancelButtonName = "cancel";

            TaskDialog dialog = new TaskDialog
            {
                Caption = "Create folder?",
                Instruction = "Create folder?",
                Content = "The folder \"" + path + "\" does not exist.",
                MainIcon = TaskDialogStandardIcon.Warning,
                Controls =
                {
                    new TaskDialogCommandLink
                    {
                        Text = "Create Folder",
                        Instruction = "This will create the folder for you and start the image resizing.",
                        Name = createButtonName
                    },
                    new TaskDialogCommandLink
                    {
                        Text = "Cancel",
                        Instruction = "This will cancel the operation and let you choose another output folder.",
                        Name = cancelButtonName
                    }
                }
            };

            TaskDialogResult result = dialog.Show();
            return result.CustomButtonClicked == createButtonName;
        }
        public void AppDialogShowing(object sender, Autodesk.Revit.UI.Events.DialogBoxShowingEventArgs arg)
        {
            //get the help id of the showing dialog
            int dialogId = arg.HelpId;

            //Format the prompt information string
            string promptInfo = "lalala";
            promptInfo += "HelpId : " + dialogId.ToString();

            //Show the prompt information and allow the user close the dialog directly
            TaskDialog td = new TaskDialog("taskDialog1");
            td.MainContent = promptInfo;
            TaskDialogCommonButtons buttons = TaskDialogCommonButtons.Ok| TaskDialogCommonButtons.Cancel;
            td.CommonButtons = buttons;
            //??liuzbkuv mjhglku
            TaskDialogResult tdr = td.Show();
            if (TaskDialogResult.Cancel == tdr)
            {
                //Do not show the Revit dialog
                arg.OverrideResult(1);
            }
            else
            {
                //Continue to show the Revit dialog
                arg.OverrideResult(0);
            }
        }
        /// <summary>
        /// export to a HTML page that contains the PanelScheduleView instance data.
        /// </summary>
        /// <returns>the exported file path</returns>
        public override string Export()
        {
            string asemblyName = System.Reflection.Assembly.GetExecutingAssembly().Location;
            string tempFile = asemblyName.Replace("PanelSchedule.dll", "template.html");

            if (!System.IO.File.Exists(tempFile))
            {
                TaskDialog messageDlg = new TaskDialog("Warnning Message");
                messageDlg.MainIcon = TaskDialogIcon.TaskDialogIconWarning;
                messageDlg.MainContent = "Can not find 'template.html', please make sure the 'template.html' file is in the same folder as the external command assembly.";
                messageDlg.Show();
                return null;
            }
            

            string panelScheduleFile = asemblyName.Replace("PanelSchedule.dll", ReplaceIllegalCharacters(m_psView.Name) + ".html");

            XmlDocument doc = new XmlDocument();
            XmlTextWriter tw = new XmlTextWriter(panelScheduleFile, null);
            doc.Load(tempFile);

            XmlNode psTable = doc.DocumentElement.SelectSingleNode("//div/table[1]");
            DumpPanelScheduleData(psTable, doc);
            
            doc.Save(tw);

            return panelScheduleFile;
        }
Пример #11
0
 /// <summary>
 /// Display an error message.
 /// </summary>
 public static void ErrorMsg( string msg )
 {
     Util.Log( msg );
       TaskDialog dlg = new TaskDialog( App.Caption );
       dlg.MainIcon = TaskDialogIcon.TaskDialogIconWarning;
       dlg.MainInstruction = msg;
       dlg.Show();
 }
		protected void ShowTaskDetails (TaskItem taskItem)
		{
			currentTaskItem = taskItem;
			taskItemDialog = new TaskDialog (taskItem);
			
			var title = Foundation.NSBundle.MainBundle.LocalizedString ("Task Details", "Task Details");
			context = new LocalizableBindingContext (this, taskItemDialog, title);
			detailsScreen = new DialogViewController (context.Root, true);
			ActivateController(detailsScreen);
		}
Пример #13
0
 public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,
     ref string message, Autodesk.Revit.DB.ElementSet elements)
 {
     TaskDialog dlg = new TaskDialog(@"Hello Revit");
     dlg.MainContent = @"Hello Revit";
     dlg.MainInstruction = @"Say hello!";
     dlg.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, @"Hello");
     dlg.Show();
     return Autodesk.Revit.UI.Result.Succeeded;
 }
Пример #14
0
        protected void ShowTaskDetails(Task task)
        {
            currentTask = task;
            taskDialog = new TaskDialog(task);

            string title = NSBundle.MainBundle.LocalizedString("Task Details", "Task Details");
            context = new LocalizableBindingContext(this, taskDialog, title);
            detailsScreen = new DialogViewController(context.Root, true);
            ActivateController(detailsScreen);
        }
        /// <summary>
        /// Implement this method as an external command for Revit.
        /// </summary>
        /// <param name="commandData">An object that is passed to the external application 
        /// which contains data related to the command, 
        /// such as the application object and active view.</param>
        /// <param name="message">A message that can be set by the external application 
        /// which will be displayed if a failure or cancellation is returned by 
        /// the external command.</param>
        /// <param name="elements">A set of elements to which the external application 
        /// can add elements that are to be highlighted in case of failure or cancellation.</param>
        /// <returns>Return the status of the external command. 
        /// A result of Succeeded means that the API external method functioned as expected. 
        /// Cancelled can be used to signify that the user cancelled the external operation 
        /// at some point. Failure should be returned if the application is unable to proceed with 
        /// the operation.</returns>
        public virtual Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData
            , ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            Autodesk.Revit.DB.Document doc = commandData.Application.ActiveUIDocument.Document;

            // get all PanelScheduleView instances in the Revit document.
            FilteredElementCollector fec = new FilteredElementCollector(doc);
            ElementClassFilter PanelScheduleViewsAreWanted = new ElementClassFilter(typeof(PanelScheduleView));
            fec.WherePasses(PanelScheduleViewsAreWanted);
            List<Element> psViews = fec.ToElements() as List<Element>;

            bool noPanelScheduleInstance = true;

            foreach (Element element in psViews)
            {
                PanelScheduleView psView = element as PanelScheduleView;
                if (psView.IsPanelScheduleTemplate())
                {
                    // ignore the PanelScheduleView instance which is a template.
                    continue;
                }
                else
                {
                    noPanelScheduleInstance = false;
                }

                // choose what format export to, it can be CSV or HTML.
                TaskDialog alternativeDlg = new TaskDialog("Choose Format to export");
                alternativeDlg.MainContent = "Click OK to export in .CSV format, Cancel to export in HTML format.";
                alternativeDlg.CommonButtons = TaskDialogCommonButtons.Ok | TaskDialogCommonButtons.Cancel;
                alternativeDlg.AllowCancellation = true;
                TaskDialogResult exportToCSV = alternativeDlg.Show();
                
                Translator translator = TaskDialogResult.Cancel == exportToCSV ? new HTMLTranslator(psView) : new CSVTranslator(psView) as Translator;
                string exported = translator.Export();

                // open the file if export successfully.
                if (!string.IsNullOrEmpty(exported))
                {
                    System.Diagnostics.Process.Start(exported);
                }
            }

            if (noPanelScheduleInstance)
            {
                TaskDialog messageDlg = new TaskDialog("Warnning Message");
                messageDlg.MainIcon = TaskDialogIcon.TaskDialogIconWarning;
                messageDlg.MainContent = "No panel schedule view is in the current document.";
                messageDlg.Show();
                return Result.Cancelled;
            }

            return Result.Succeeded;
        }
Пример #16
0
        /// <summary>
        /// MessageBox wrapper for error message.
        /// </summary>
        public static void ErrorMsg( string msg )
        {
            Debug.WriteLine( msg );

              //WinForms.MessageBox.Show( msg, Caption, WinForms.MessageBoxButtons.OK, WinForms.MessageBoxIcon.Error );

              TaskDialog d = new TaskDialog( Caption );
              d.MainIcon = TaskDialogIcon.TaskDialogIconWarning;
              d.MainInstruction = msg;
              d.Show();
        }
Пример #17
0
        /// <summary>
        /// Startup
        /// </summary>
        /// <param name="application"></param>
        /// <returns></returns>
        public Result OnStartup(UIControlledApplication application)
        {
            try
            {
            // Version
            if (!application.ControlledApplication.VersionName.Contains(RevitVersion))
                {
                    using (TaskDialog td = new TaskDialog("Cannot Continue"))
                    {
                        td.TitleAutoPrefix = false;
                        td.MainInstruction = "Incompatible Revit Version";
                        td.MainContent = "This Add-In was built for Revit "+ RevitVersion + ", please contact CASE for assistance.";
                        td.Show();
                    }
                    return Result.Cancelled;
                }

                // Master Tab
                const string c_tabName = "CASE";

                try
                {
                    // Create the Tab
                    application.CreateRibbonTab(c_tabName);
                }
                catch { }

            string m_issuetracker = "Case.IssueTracker.dll";
            // Tab
            RibbonPanel m_panel = application.CreateRibbonPanel(c_tabName, "Case Issue Tracker");

                // Button Data
                PushButton m_pushButton = m_panel.AddItem(new PushButtonData("Issue Tracker",
                                                                                                 "Issue Tracker",
                                                                                                 Path.Combine(_path, "Case.IssueTracker.Revit.dll"),
                                                                                                 "Case.IssueTracker.Revit.Entry.CmdMain")) as PushButton;

                // Images and Tooltip
                if (m_pushButton != null)
                {
                    m_pushButton.Image = LoadPngImgSource("Case.IssueTracker.Assets.CASEIssueTrackerIcon16x16.png", m_issuetracker);
                    m_pushButton.LargeImage = LoadPngImgSource("Case.IssueTracker.Assets.CASEIssueTrackerIcon32x32.png", m_issuetracker);
                    m_pushButton.ToolTip = "Case Issue Manager";
                }

            }
            catch (Exception ex1)
            {
                MessageBox.Show("exception: " + ex1);
                return Result.Failed;
            }

            return Result.Succeeded;
        }
Пример #18
0
        /// <summary>
        /// Duct Command
        /// </summary>
        /// <param name="commandData"></param>
        /// <param name="message"></param>
        /// <param name="elements"></param>
        /// <returns></returns>
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            try
              {

            // Version
            if (!commandData.Application.Application.VersionName.Contains("2015"))
            {

              // Failure
              using (TaskDialog td = new TaskDialog("Cannot Continue"))
              {
            td.TitleAutoPrefix = false;
            td.MainInstruction = "Incompatible Revit Version";
            td.MainContent = "This Add-In was built for Revit 2015, please contact CASE for assistance...";
            td.Show();
              }
              return Result.Failed;

            }

            // Settings
            clsSettings m_s = new clsSettings(commandData);

            // Main Category Selection Form
            using (form_Orient dlg = new form_Orient())
            {
              dlg.ShowDialog();

              if (!dlg.DoConduit && !dlg.DoDuct && !dlg.DoPipe & !dlg.DoTray) return Result.Cancelled;

              // Process Data
              if (dlg.DoConduit) m_s.ProcessConduit();
              if (dlg.DoDuct) m_s.ProcessDuct();
              if (dlg.DoPipe) m_s.ProcessPipe();
              if (dlg.DoTray) m_s.ProcessTray();

            }

            // Success
            return Result.Succeeded;

              }
              catch (Exception ex)
              {

            // Failure
            message = ex.Message;
            return Result.Failed;

              }
        }
Пример #19
0
        /// <summary>Initializes a new instance of the <see cref="NativeTaskDialog" /> class.</summary>
        /// <param name="settings">The settings.</param>
        /// <param name="outerDialog">The outer dialog.</param>
        internal NativeTaskDialog(NativeTaskDialogSettings settings, TaskDialog outerDialog)
        {
            nativeDialogConfig = settings.NativeConfiguration;
            this.settings = settings;

            // Wireup dialog proc message loop for this instance.
            nativeDialogConfig.Callback = DialogProc;

            ShowState = DialogShowState.PreShow;

            // Keep a reference to the outer shell, so we can notify.
            this.outerDialog = outerDialog;
        }
Пример #20
0
        /// <summary>
        /// Command
        /// </summary>
        /// <param name="commandData"></param>
        /// <param name="message"></param>
        /// <param name="elements"></param>
        /// <returns></returns>
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            try
              {
            // Version
            if (!commandData.Application.Application.VersionName.Contains("2015"))
            {
              // Failure
              using (TaskDialog m_td = new TaskDialog("Cannot Continue"))
              {
            m_td.TitleAutoPrefix = false;
            m_td.MainInstruction = "Incompatible Version of Revit";
            m_td.MainContent = "This Add-In was built for Revit 2015, please contact CASE for assistance.";
            m_td.Show();
              }
              return Result.Cancelled;
            }

            Version m_version = typeof(CmdMain).Assembly.GetName().Version;

            RegistryKey m_key = Registry.CurrentUser
              .CreateSubKey(@"Software\CASE\Case.ParallelWalls\");

            if (m_key != null && m_key.GetValue(m_version.ToString()) == null)
            {
              form_SplashScreen m_splash = new form_SplashScreen(m_key);

              m_splash.ShowDialog();
            }

            clsElementSelection m_selection = new clsElementSelection(commandData.Application.ActiveUIDocument);

            clsVectors m_vectors = new clsVectors(
              m_selection.RefElement,
              m_selection.WallElement);

            clsWallTransform m_transform = new clsWallTransform(
              m_selection.WallElement,
              m_vectors.AxisLine,
              m_vectors.DeltaAngle);

            // Success
            return Result.Succeeded;
              }
              catch (Exception m_ex)
              {
            // Failure
            message = m_ex.Message;
            return Result.Failed;
              }
        }
Пример #21
0
        /// <summary>
        /// Report Groups by View
        /// </summary>
        /// <param name="commandData"></param>
        /// <param name="message"></param>
        /// <param name="elements"></param>
        /// <returns></returns>
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            try
              {

            // Version
            if (!commandData.Application.Application.VersionName.Contains("2015"))
            {
              // Failure
              using (TaskDialog td = new TaskDialog("Cannot Continue"))
              {
            td.TitleAutoPrefix = false;
            td.MainInstruction = "Incompatible Version of Revit";
            td.MainContent = "This Add-In was built for Revit 2015, please contact CASE for assistance.";
            td.Show();
              }
              return Result.Cancelled;
            }

            // Settings
            clsSettings m_s = new clsSettings(commandData);
            if (m_s.ModelGroups.Count + m_s.DetailGroups.Count < 1)
            {
              using (TaskDialog td = new TaskDialog("No Groups Found"))
              {
            td.TitleAutoPrefix = false;
            td.MainInstruction = "No Groups Found";
            td.Show();
              }
              return Result.Cancelled;
            }

            // Form
            using (form_Main d = new form_Main(m_s))
            {
              d.ShowDialog();
            }

            // Success
            return Result.Succeeded;

              }
              catch (Exception ex)
              {

            // Failure
            message = ex.Message;
            return Result.Failed;

              }
        }
Пример #22
0
        /// <summary>
        /// Shows a question dialog with Yes/No buttons.
        /// </summary>
        /// <param name="title">The title of the question.</param>
        /// <param name="question">The question.</param>
        /// <returns>
        /// 	<c>true</c> is user answered yes; otherwise <c>false</c>.
        /// </returns>
        public bool AskYesNoQuestion(string title, string question)
        {
            TaskDialog dialog = new TaskDialog
            {
                Caption = title,
                Instruction = title,
                Content = question,
                MainIcon = TaskDialogStandardIcon.Warning,
                StandardButtons = TaskDialogStandardButtons.YesNo
            };

            TaskDialogResult result = dialog.Show();
            return result.StandardButtonClicked == TaskDialogStandardButton.Yes;
        }
Пример #23
0
 public override IDisposable Alert(AlertConfig config)
 {
     var dlg = new TaskDialog
     {
         WindowTitle = config.Title,
         Content = config.Message,
         Buttons =
         {
             new TaskDialogButton(config.OkText)
         }
     };
     dlg.ShowDialog();
     return new DisposableAction(dlg.Dispose);
 }
Пример #24
0
 public static TaskDialogAbstract GetTask(TaskDialog taskDialog, int taskScore, PlayerModel player)
 {
     switch (taskDialog)
     {
         case TaskDialog.Bear:
             return new BearTask(player.Name, player.Score);
         case TaskDialog.Make:
             return new MakeTask(taskScore,player.Name,player.Score);
         case TaskDialog.RefuseFirstTime:
             return new RefuseTask(taskScore);
         case TaskDialog.RefuseSecondTime:
             return new RefuseAndMoveTask(player.Name, player.Score);
         default: throw new NotImplementedException();
     }
 }
Пример #25
0
        public static bool ShouldElevate(IServiceProvider site, InterpreterConfiguration config, string operation) {
            var opts = site.GetPythonToolsService().GeneralOptions;
            if (opts.ElevatePip) {
                return true;
            }

            try {
                // Create a test file and delete it immediately to ensure we can do it.
                // If this fails, prompt the user to see whether they want to elevate.
                var testFile = PathUtils.GetAvailableFilename(config.PrefixPath, "access-test", ".txt");
                using (new FileStream(testFile, FileMode.CreateNew, FileAccess.Write, FileShare.Delete, 4096, FileOptions.DeleteOnClose)) { }
                return false;
            } catch (IOException) {
            } catch (UnauthorizedAccessException) {
            }

            var td = new TaskDialog(site) {
                Title = Strings.ProductTitle,
                MainInstruction = Strings.ElevateForInstallPackage_MainInstruction,
                AllowCancellation = true,
            };
            var elevate = new TaskDialogButton(Strings.ElevateForInstallPackage_Elevate, Strings.ElevateForInstallPackage_Elevate_Note) {
                ElevationRequired = true
            };
            var noElevate = new TaskDialogButton(Strings.ElevateForInstallPackage_DoNotElevate, Strings.ElevateForInstallPackage_DoNotElevate_Note);
            var elevateAlways = new TaskDialogButton(Strings.ElevateForInstallPackage_ElevateAlways, Strings.ElevateForInstallPackage_ElevateAlways_Note) {
                ElevationRequired = true
            };
            td.Buttons.Add(elevate);
            td.Buttons.Add(noElevate);
            td.Buttons.Add(elevateAlways);
            td.Buttons.Add(TaskDialogButton.Cancel);
            var sel = td.ShowModal();
            if (sel == TaskDialogButton.Cancel) {
                throw new OperationCanceledException();
            }

            if (sel == noElevate) {
                return false;
            }

            if (sel == elevateAlways) {
                opts.ElevatePip = true;
                opts.Save();
            }

            return true;
        }
Пример #26
0
        /// <summary>
        /// Ask User
        /// </summary>
        /// <returns></returns>
        internal static bool ShowMessage()
        {
            using (TaskDialog td = new TaskDialog("Explanation"))
            {
              td.TitleAutoPrefix = false;
              td.MainInstruction = "Update 'CurveOrientation' Parameters";
              td.MainContent += "This command requires that an instance text parameter named 'CurveOrientation' exist on all elements of the target category.\n\n";
              td.MainContent += "A text string of HORIZONTAL, VERTICAL, or SLOPED will then get placed into each element's 'CurveOrientation' parameter for the primary purpose of clash detection filtering in an external program.";
            td.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, "Update 'CurveOrientation' Parameters");
              td.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, "Cancel and Do Nothing");
              if (td.Show() == TaskDialogResult.CommandLink1)
             return true;
              else
             return false;

            }
        }
Пример #27
0
    /// <summary>
    /// Main Command Entry Point
    /// </summary>
    /// <param name="commandData"></param>
    /// <param name="message"></param>
    /// <param name="elements"></param>
    /// <returns></returns>
    public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
    {
      try
      {

        // Version
        if (!commandData.Application.Application.VersionName.Contains("2014"))
        {
          using (TaskDialog td = new TaskDialog("Cannot Continue"))
          {
            td.TitleAutoPrefix = false;
            td.MainInstruction = "Incompatible Revit Version";
            td.MainContent = "This Add-In was built for Revit 2014, please contact info@case-inc for assistance...";
            td.Show();
          }
          return Result.Cancelled;
        }

        // Form Running?
        if (_isRunning && _appIssueTracker != null && _appIssueTracker.RvtWindow.IsLoaded)
        {
          _appIssueTracker.Focus();
          return Result.Succeeded;
        }

        _isRunning = true;

        ThisCmd = this;
        _appIssueTracker = new AppIssueTracker();
        _appIssueTracker.ShowForm(commandData.Application);
        return Result.Succeeded;

      }
      catch (Exception e)
      {
        message = e.Message;
        return Result.Failed;
      }

    }
Пример #28
0
    /// <summary>
    /// Main Command Entry Point
    /// </summary>
    /// <param name="commandData"></param>
    /// <param name="message"></param>
    /// <param name="elements"></param>
    /// <returns></returns>
    public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
    {
      try
      {

        //Version check
        //2016 and 2015 use an amost identical API
        if (!commandData.Application.Application.VersionName.Contains("2015") && !commandData.Application.Application.VersionName.Contains("2016"))
        {
          using (var td = new TaskDialog("Untested version"))
          {
            td.TitleAutoPrefix = false;
            td.MainInstruction = "Untested Revit Version";
            td.MainContent = "This Add-In was built and tested only for Revit 2016 or 2015, proceed at your own risk";
            td.Show();
          }
        }

        // Form Running?
        if (_isRunning && _extAppBcfier != null && _extAppBcfier.RvtWindow.IsLoaded)
        {
          _extAppBcfier.Focus();
          return Result.Succeeded;
        }

        _isRunning = true;

        ThisCmd = this;
        _extAppBcfier = new ExtAppBcfier();
        _extAppBcfier.ShowForm(commandData.Application);
        return Result.Succeeded;

      }
      catch (Exception e)
      {
        message = e.Message;
        return Result.Failed;
      }

    }
Пример #29
0
        public override IDisposable ActionSheet(ActionSheetConfig config)
        {
            var dlg = new TaskDialog
            {
                AllowDialogCancellation = config.Cancel != null,
                WindowTitle = config.Title
            };
            config
                .Options
                .ToList()
                .ForEach(x =>
                    dlg.Buttons.Add(new TaskDialogButton(x.Text)
                ));

            dlg.ButtonClicked += (sender, args) =>
            {
                var action = config.Options.First(x => x.Text.Equals(args.Item.Text));
                action.Action();
            };
            dlg.ShowDialog();
            return new DisposableAction(dlg.Dispose);
        }
Пример #30
0
        private bool ShouldIncludeNodeModulesFolderInProject() {
            var includeNodeModulesButton = new TaskDialogButton(Resources.IncludeNodeModulesIncludeTitle, Resources.IncludeNodeModulesIncludeDescription);
            var cancelOperationButton = new TaskDialogButton(Resources.IncludeNodeModulesCancelTitle);
            var taskDialog = new TaskDialog(_project.ProjectMgr.Site) {
                AllowCancellation = true,
                EnableHyperlinks = true,
                Title = SR.ProductName,
                MainIcon = TaskDialogIcon.Warning,
                Content = Resources.IncludeNodeModulesContent,
                Buttons = {
                    cancelOperationButton,
                    includeNodeModulesButton
                },
                FooterIcon = TaskDialogIcon.Information,
                Footer = Resources.IncludeNodeModulesInformation,
                SelectedButton = cancelOperationButton
            };

            var button = taskDialog.ShowModal();

            return button == includeNodeModulesButton;
        }
Пример #31
0
 private void td_info(object sender, EventArgs e)
 {
     TaskDialog.Show("Information", "Task Dialog", "Content of the task dialog.", TaskDialogButton.OK, TaskDialogIcon.Information);
 }
Пример #32
0
 private void App_DocumentChanged(object sender, Autodesk.Revit.DB.Events.DocumentChangedEventArgs e)
 {
     TaskDialog.Show("BIMBOX", "文档已经被修改");
     _app.DocumentChanged -= App_DocumentChanged;
 }
Пример #33
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            using (Transaction transaction = new Transaction(commandData.Application.ActiveUIDocument.Document, "InsertSection"))
            {
                try
                {
                    bool isValidSelect = false;
                    do
                    {
                        Reference selectedObject = commandData.Application.ActiveUIDocument.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element, "Select door!");
                        if (selectedObject != null)
                        {
                            Element        element        = commandData.Application.ActiveUIDocument.Document.GetElement(selectedObject.ElementId);
                            ElementType    elementType    = commandData.Application.ActiveUIDocument.Document.GetElement(element.GetTypeId()) as ElementType;
                            double         height         = elementType.get_Parameter(BuiltInParameter.DOOR_HEIGHT).AsDouble();
                            double         width          = elementType.get_Parameter(BuiltInParameter.DOOR_WIDTH).AsDouble();
                            FamilyInstance familyInstance = element as FamilyInstance;
                            if (height == 0)
                            {
                                height = familyInstance.get_Parameter(BuiltInParameter.DOOR_HEIGHT).AsDouble();
                            }
                            if (width == 0)
                            {
                                width = familyInstance.get_Parameter(BuiltInParameter.DOOR_WIDTH).AsDouble();
                            }

                            Transform doorTransform = familyInstance.get_Geometry(new Options()).Select(s => s as GeometryInstance).Select(y => y.Transform).FirstOrDefault();
                            if (element.Category.Name == "Doors")
                            {
                                Document       doc            = commandData.Application.ActiveUIDocument.Document;
                                View           view           = doc.ActiveView;
                                ViewFamilyType viewFamilyType = new FilteredElementCollector(commandData.Application.ActiveUIDocument.Document).OfClass(typeof(ViewFamilyType)).Cast <ViewFamilyType>().Where(t => t.ViewFamily == ViewFamily.Section).FirstOrDefault();
                                if (viewFamilyType == null)
                                {
                                    return(Result.Failed);
                                }
                                Transform curveTransform = doorTransform;
                                curveTransform.BasisX = new XYZ(curveTransform.BasisX.Y, curveTransform.BasisX.X, curveTransform.BasisX.Z);
                                XYZ origin        = curveTransform.Origin;                              // mid-point of location curve
                                XYZ viewDirection = curveTransform.BasisX.Normalize();                  // tangent vector along the location curve
                                XYZ normal        = viewDirection.CrossProduct(XYZ.BasisZ).Normalize(); // location curve normal @ mid-point

                                Transform transform = Transform.Identity;
                                transform.Origin = origin;
                                transform.BasisX = normal;
                                transform.BasisY = XYZ.BasisZ;

                                // can use this simplification because wall's "up" is vertical.
                                // For a non-vertical situation (such as section through a sloped floor the surface normal would be needed)
                                transform.BasisZ = normal.CrossProduct(XYZ.BasisZ);

                                BoundingBoxXYZ sectionBox = new BoundingBoxXYZ();
                                sectionBox.Transform = transform;
                                sectionBox.Min       = new XYZ(-(width / 2), 0, 0);
                                sectionBox.Max       = new XYZ(width / 2, height, 5);
                                transaction.Start();
                                ViewSection viewSection = ViewSection.CreateSection(doc, viewFamilyType.Id, sectionBox);
                                transaction.Commit();
                                isValidSelect = true;
                            }
                            else
                            {
                                TaskDialog.Show("Error", "It is not door!");
                            }
                        }
                        else
                        {
                            TaskDialog.Show("Error", "It is not object!");
                        }
                    } while (!isValidSelect);
                }
                catch (Exception e)
                {
                    return(Result.Failed);
                }
            }
            return(Result.Succeeded);
        }
Пример #34
0
 /// <summary>
 /// Display a short big message.
 /// </summary>
 public static void InfoMsg(string msg)
 {
     Debug.Print(msg);
     TaskDialog.Show(Caption, msg);
 }
Пример #35
0
        /// <summary>
        /// Resize ducts to ensure that branch ducts are no
        /// larger than the main duct they are tapping into.
        /// </summary>
        public void DuctResize(Document doc)
        {
            BuiltInParameter crvCharLength
                = BuiltInParameter.RBS_CURVE_DIAMETER_PARAM;

            Parameter ductHeight;

            double updatedHeight = 0;

            double twoInches = UnitUtils.Convert(2.0,
                                                 DisplayUnitType.DUT_DECIMAL_INCHES,
                                                 DisplayUnitType.DUT_DECIMAL_FEET);

            FilteredElementCollector ductCollector
                = new FilteredElementCollector(doc)
                  .OfClass(typeof(Duct));

            using (Transaction transaction = new Transaction(doc))
            {
                if (transaction.Start("Resize Ducts for Taps")
                    == TransactionStatus.Started)
                {
                    int i = 0;
                    foreach (Duct d in ductCollector)
                    {
                        double largestConnector = 0.0;
                        double previous         = 0.0;
                        double cnnctrDim        = 0.0;

                        ConnectorSet dctCnnctrs = d.ConnectorManager.Connectors;

                        int nDCs = dctCnnctrs.Size;
                        if (nDCs < 3)
                        {
                            // do nothing
                        }
                        else
                        {
                            foreach (Connector c in dctCnnctrs)
                            {
                                if (c.ConnectorType.ToString().Equals("End"))
                                {
                                    //Do nothing because I am not interested in the "End" Connectors
                                }
                                else
                                {
                                    ConnectorSet taps = c.AllRefs;
                                    foreach (Connector cd in taps)
                                    {
                                        ConnectorProfileType cShape = cd.Shape;
                                        string shapeType            = cShape.ToString();

                                        if (shapeType.Equals("Round"))
                                        {
                                            cnnctrDim = cd.Radius * 2.0;
                                        }
                                        if (shapeType.Equals("Rectangular") || shapeType.Equals("Oval"))
                                        {
                                            cnnctrDim = cd.Height;
                                        }
                                    }

                                    if (cnnctrDim >= previous)
                                    {
                                        largestConnector = cnnctrDim;
                                        previous         = largestConnector;
                                    }
                                    else
                                    {
                                        largestConnector = previous;
                                    }
                                }
                            }

                            try
                            {
                                if (largestConnector >= d.Height)
                                {
                                    updatedHeight = largestConnector + twoInches;
                                    i++;
                                }
                                else
                                {
                                    updatedHeight = d.Height;
                                }
                            }
                            catch
                            {
                                if (largestConnector >= d.Diameter)
                                {
                                    updatedHeight = largestConnector + twoInches;
                                    i++;
                                }
                                else
                                {
                                    updatedHeight = d.Diameter;
                                }
                            }

                            try
                            {
                                crvCharLength = BuiltInParameter.RBS_CURVE_HEIGHT_PARAM;
                                ductHeight    = d.get_Parameter(crvCharLength);
                                ductHeight.Set(updatedHeight);
                            }
                            catch (NullReferenceException)
                            {
                                crvCharLength = BuiltInParameter.RBS_CURVE_DIAMETER_PARAM;
                                ductHeight    = d.get_Parameter(crvCharLength);
                                ductHeight.Set(updatedHeight);
                            }
                        }
                    }

                    // Ask the end user whether the
                    // changes are to be committed or not

                    TaskDialog taskDialog = new TaskDialog("Revit");
                    if (i > 0)
                    {
                        int n = (ductCollector as ICollection <Element>).Count;
                        taskDialog.MainContent = i + " out of "
                                                 + n.ToString() + " ducts will be re-sized"
                                                 + "\n\nClick [OK] to Commit or [Cancel] "
                                                 + "to Roll back the transaction.";
                    }
                    else
                    {
                        taskDialog.MainContent
                            = "None of the ducts need to be re-sized"
                              + "\n\nClick [OK] to Commit or [Cancel] "
                              + "to Roll back the transaction.";
                    }
                    TaskDialogCommonButtons buttons
                        = TaskDialogCommonButtons.Ok
                          | TaskDialogCommonButtons.Cancel;

                    taskDialog.CommonButtons = buttons;

                    if (TaskDialogResult.Ok == taskDialog.Show())
                    {
                        // For many various reasons, a transaction may not be committed
                        // if the changes made during the transaction do not result a valid model.
                        // If committing a transaction fails or is canceled by the end user,
                        // the resulting status would be RolledBack instead of Committed.
                        if (TransactionStatus.Committed != transaction.Commit())
                        {
                            TaskDialog.Show("Failure",
                                            "Transaction could not be committed");
                        }
                    }
                    else
                    {
                        transaction.RollBack();
                    }
                }
            }
        }
Пример #36
0
        static public bool AddSharedParameter(
            Document doc,
            string parameterName,
            BuiltInCategory[] categories,
            BuiltInParameterGroup group = BuiltInParameterGroup.PG_ADSK_MODEL_PROPERTIES,
            bool isIntance = true
            )
        {
            // Проверка параметра на наличие
            List <bool> check = new List <bool>();

            foreach (BuiltInCategory cat in categories)
            {
                check.Add(IsParameterInProject(doc, parameterName, cat));
            }

            if (check.All(x => x == true))
            {
                return(true);
            }
            else
            {
                CategorySet catSet = doc.Application.Create.NewCategorySet();
                foreach (BuiltInCategory c in categories)
                {
                    catSet.Insert(doc.Settings.Categories.get_Item(c));
                }

                try
                {
                    doc.Application.SharedParametersFilename = sharedParameterFilePath;
                    DefinitionFile     spFile    = doc.Application.OpenSharedParameterFile();
                    ExternalDefinition sharedDef = null;
                    foreach (DefinitionGroup gr in spFile.Groups)
                    {
                        foreach (Definition def in gr.Definitions)
                        {
                            if (def.Name == parameterName)
                            {
                                sharedDef = (ExternalDefinition)def;
                            }
                        }
                    }
                    if (sharedDef == null)
                    {
                        TaskDialog.Show("Ошибка", String.Format("Параметр \"{0}\" отсутствует в файле общих параметров", parameterName));
                        return(false);
                    }

                    ElementBinding bind;
                    if (isIntance)
                    {
                        bind = doc.Application.Create.NewInstanceBinding(catSet);
                    }
                    else
                    {
                        bind = doc.Application.Create.NewTypeBinding(catSet);
                    }
                    bool result = doc.ParameterBindings.Insert(sharedDef, bind, group);
                    // Если параметр уже существует, но данная категория отсутствует в сете - обновляем сет
                    if (!result)
                    {
                        string realName = GetRealParameterName(doc, sharedDef);
                        bind = GetParameterBinding(doc, realName);
                        foreach (Category c in catSet)
                        {
                            bind.Categories.Insert(c);
                        }
                        bool result2 = doc.ParameterBindings.ReInsert(sharedDef, bind, group);
                        if (!result2)
                        {
                            TaskDialog.Show("Ошибка", String.Format("Произошла ошибка при редактировании привязок существующего параметра \"{0}\"", parameterName));
                            return(false);
                        }
                    }
                    return(true);
                }
                catch (Exception e)
                {
                    TaskDialog td = new TaskDialog("Ошибка");
                    td.MainInstruction = String.Format("Произошла ошибка добавления общего параметра \"{0}\"", parameterName);
                    td.MainContent     = e.ToString();
                    td.Show();
                    return(false);
                }
            }
        }
Пример #37
0
        /// <summary>
        /// Startup
        /// </summary>
        /// <param name="application"></param>
        /// <returns></returns>
        public Result OnStartup(UIControlledApplication application)
        {
            try
            {
                // Version
                if (!application.ControlledApplication.VersionName.Contains("2014") && !application.ControlledApplication.VersionName.Contains("2015") && !application.ControlledApplication.VersionName.Contains("2016"))
                {
                    using (TaskDialog td = new TaskDialog("Cannot Continue"))
                    {
                        td.TitleAutoPrefix = false;
                        td.MainInstruction = "Incompatible Revit Version";
                        td.MainContent     = "This Add-In was built for Revit 2014, 2015 and 2016, please contact CASE for assistance.";
                        td.Show();
                    }
                    return(Result.Cancelled);
                }

                // Master Tab
                const string c_tabName = "CASE";

                try
                {
                    // Create the Tab
                    application.CreateRibbonTab(c_tabName);
                }
                catch { }

                /*
                 * // Assembly Paths
                 * string m_issuetracker = Path.Combine(ProgramFilesx86(), "CASE", "ARUP Issue Tracker", "ARUP.IssueTracker.dll");
                 *
                 * // Check that File Exists
                 * if (!File.Exists(m_issuetracker))
                 * {
                 *  using (TaskDialog td = new TaskDialog("Cannot Continue"))
                 *  {
                 *      td.TitleAutoPrefix = false;
                 *      td.MainInstruction = "Required Issue Tracker Library Not Found";
                 *      td.MainContent = m_issuetracker;
                 *      td.Show();
                 *  }
                 *  return Result.Cancelled;
                 * }
                 *
                 * // Load Assemblies
                 * Assembly.LoadFrom(m_issuetracker);
                 */

                string m_issuetracker = "ARUP.IssueTracker.dll";


                // Tab
                RibbonPanel m_panel = application.CreateRibbonPanel(c_tabName, "Arup Issue Tracker");

                // Button Data
                PushButton m_pushButton = m_panel.AddItem(new PushButtonData("Issue Tracker",
                                                                             "Issue Tracker",
                                                                             Path.Combine(_path, "ARUP.IssueTracker.Revit.dll"),
                                                                             "ARUP.IssueTracker.Revit.Entry.CmdMain")) as PushButton;

                // Images and Tooltip
                if (m_pushButton != null)
                {
                    m_pushButton.Image      = LoadPngImgSource("ARUP.IssueTracker.Assets.ARUPIssueTrackerIcon16x16.png", m_issuetracker);
                    m_pushButton.LargeImage = LoadPngImgSource("ARUP.IssueTracker.Assets.ARUPIssueTrackerIcon32x32.png", m_issuetracker);
                    m_pushButton.ToolTip    = "Arup Issue Manager";
                }

                // Initiate RestSharp first to avoid the conflict with Dynamo
                // string restSharpDllPath = Path.Combine(ProgramFilesx86(), "CASE", "ARUP Issue Tracker", "RestSharp.dll");
                // Assembly.LoadFrom(restSharpDllPath);
            }
            catch (Exception ex1)
            {
                MessageBox.Show("exception: " + ex1);
                return(Result.Failed);
            }

            return(Result.Succeeded);
        }
Пример #38
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TaskDialogForm));
     this.TableLayoutPanelContent = new System.Windows.Forms.TableLayoutPanel();
     this.PictureBoxIcon          = new System.Windows.Forms.PictureBox();
     this.LabelTitle                     = new Label();
     this.LabelContent                   = new Label();
     this.TableLayoutPanelContents       = new System.Windows.Forms.TableLayoutPanel();
     this.LabelExpandedContent           = new Label();
     this.PanelExpandedFooter            = new System.Windows.Forms.Panel();
     this.TableLayoutPanelExpanderFooter = new System.Windows.Forms.TableLayoutPanel();
     this.LabelExpandedFooter            = new Label();
     this.BevelExpanderFooter            = new System.Windows.Forms.Label();
     this.PanelFooter                    = new System.Windows.Forms.Panel();
     this.TableLayoutPanelFooter         = new System.Windows.Forms.TableLayoutPanel();
     this.LabelIconFooter                = new System.Windows.Forms.Label();
     this.LabelFooter                    = new Label();
     this.BevelFooter                    = new System.Windows.Forms.Label();
     this.PanelButtons                   = new System.Windows.Forms.Panel();
     this.TableLayoutPanelButtons        = new System.Windows.Forms.TableLayoutPanel();
     this.FlowLayoutPanelButtons         = new System.Windows.Forms.FlowLayoutPanel();
     this.Button1  = (System.Windows.Forms.Control)TaskDialog.ButtonFactory();
     this.Button2  = (System.Windows.Forms.Control)TaskDialog.ButtonFactory();
     this.Button3  = (System.Windows.Forms.Control)TaskDialog.ButtonFactory();
     this.Button4  = (System.Windows.Forms.Control)TaskDialog.ButtonFactory();
     this.Button5  = (System.Windows.Forms.Control)TaskDialog.ButtonFactory();
     this.Button6  = (System.Windows.Forms.Control)TaskDialog.ButtonFactory();
     this.Button7  = (System.Windows.Forms.Control)TaskDialog.ButtonFactory();
     this.Button8  = (System.Windows.Forms.Control)TaskDialog.ButtonFactory();
     this.Button9  = (System.Windows.Forms.Control)TaskDialog.ButtonFactory();
     this.Button10 = (System.Windows.Forms.Control)TaskDialog.ButtonFactory();
     this.Button11 = (System.Windows.Forms.Control)TaskDialog.ButtonFactory();
     //this.Button1 = new FSLib.Windows.Forms.Button();
     //this.Button2 = new FSLib.Windows.Forms.Button();
     //this.Button3 = new FSLib.Windows.Forms.Button();
     //this.Button4 = new FSLib.Windows.Forms.Button();
     //this.Button5 = new FSLib.Windows.Forms.Button();
     //this.Button6 = new FSLib.Windows.Forms.Button();
     //this.Button7 = new FSLib.Windows.Forms.Button();
     //this.Button8 = new FSLib.Windows.Forms.Button();
     //this.Button9 = new FSLib.Windows.Forms.Button();
     //this.Button10 = new FSLib.Windows.Forms.Button();
     //this.Button11 = new FSLib.Windows.Forms.Button();
     this.FlowLayoutPanelButtonsLeft = new System.Windows.Forms.FlowLayoutPanel();
     this.ButtonExpander             = new ChevronButton();
     this.CheckBox         = new System.Windows.Forms.CheckBox();
     this.BevelButtons     = new System.Windows.Forms.Label();
     this.TableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
     this.TableLayoutPanelContent.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.PictureBoxIcon)).BeginInit();
     this.PanelExpandedFooter.SuspendLayout();
     this.TableLayoutPanelExpanderFooter.SuspendLayout();
     this.PanelFooter.SuspendLayout();
     this.TableLayoutPanelFooter.SuspendLayout();
     this.PanelButtons.SuspendLayout();
     this.TableLayoutPanelButtons.SuspendLayout();
     this.FlowLayoutPanelButtons.SuspendLayout();
     this.FlowLayoutPanelButtonsLeft.SuspendLayout();
     this.TableLayoutPanel.SuspendLayout();
     this.SuspendLayout();
     //
     // TableLayoutPanelContent
     //
     this.TableLayoutPanelContent.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                                 | System.Windows.Forms.AnchorStyles.Right)));
     this.TableLayoutPanelContent.AutoSize     = true;
     this.TableLayoutPanelContent.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.TableLayoutPanelContent.BackColor    = System.Drawing.SystemColors.ControlLightLight;
     this.TableLayoutPanelContent.ColumnCount  = 2;
     this.TableLayoutPanelContent.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
     this.TableLayoutPanelContent.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
     this.TableLayoutPanelContent.Controls.Add(this.PictureBoxIcon, 0, 0);
     this.TableLayoutPanelContent.Controls.Add(this.LabelTitle, 1, 0);
     this.TableLayoutPanelContent.Controls.Add(this.LabelContent, 1, 1);
     this.TableLayoutPanelContent.Controls.Add(this.TableLayoutPanelContents, 1, 3);
     this.TableLayoutPanelContent.Controls.Add(this.LabelExpandedContent, 1, 2);
     this.TableLayoutPanelContent.Location = new System.Drawing.Point(0, 0);
     this.TableLayoutPanelContent.Margin   = new System.Windows.Forms.Padding(0);
     this.TableLayoutPanelContent.Name     = "TableLayoutPanelContent";
     this.TableLayoutPanelContent.RowCount = 4;
     this.TableLayoutPanelContent.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.TableLayoutPanelContent.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.TableLayoutPanelContent.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.TableLayoutPanelContent.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.TableLayoutPanelContent.Size       = new System.Drawing.Size(1176, 123);
     this.TableLayoutPanelContent.TabIndex   = 0;
     this.TableLayoutPanelContent.CellPaint += new System.Windows.Forms.TableLayoutCellPaintEventHandler(this.TableLayoutPanelContent_CellPaint);
     //
     // PictureBoxIcon
     //
     this.PictureBoxIcon.BackColor = System.Drawing.Color.Transparent;
     this.PictureBoxIcon.Location  = new System.Drawing.Point(12, 12);
     this.PictureBoxIcon.Margin    = new System.Windows.Forms.Padding(12, 12, 0, 12);
     this.PictureBoxIcon.Name      = "PictureBoxIcon";
     this.TableLayoutPanelContent.SetRowSpan(this.PictureBoxIcon, 2);
     this.PictureBoxIcon.Size     = new System.Drawing.Size(32, 32);
     this.PictureBoxIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
     this.PictureBoxIcon.TabIndex = 0;
     this.PictureBoxIcon.TabStop  = false;
     this.PictureBoxIcon.Paint   += new System.Windows.Forms.PaintEventHandler(this.PictureBoxIcon_Paint);
     //
     // LabelTitle
     //
     this.LabelTitle.ActiveLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(102)))), ((int)(((byte)(204)))));
     this.LabelTitle.Anchor          = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                             | System.Windows.Forms.AnchorStyles.Left)));
     this.LabelTitle.AutoSize          = true;
     this.LabelTitle.BackColor         = System.Drawing.Color.Transparent;
     this.LabelTitle.DisabledLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(126)))), ((int)(((byte)(133)))), ((int)(((byte)(156)))));
     this.LabelTitle.Font             = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
     this.LabelTitle.ForeColor        = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(51)))), ((int)(((byte)(153)))));
     this.LabelTitle.LinkArea         = new System.Windows.Forms.LinkArea(0, 0);
     this.LabelTitle.LinkColor        = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(102)))), ((int)(((byte)(204)))));
     this.LabelTitle.Location         = new System.Drawing.Point(53, 16);
     this.LabelTitle.Margin           = new System.Windows.Forms.Padding(9, 16, 16, 16);
     this.LabelTitle.Name             = "LabelTitle";
     this.LabelTitle.Size             = new System.Drawing.Size(76, 21);
     this.LabelTitle.TabIndex         = 1;
     this.LabelTitle.Text             = "LabelTitle";
     this.LabelTitle.VisitedLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(102)))), ((int)(((byte)(204)))));
     //
     // LabelContent
     //
     this.LabelContent.ActiveLinkColor   = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(102)))), ((int)(((byte)(204)))));
     this.LabelContent.Anchor            = System.Windows.Forms.AnchorStyles.Left;
     this.LabelContent.AutoSize          = true;
     this.LabelContent.BackColor         = System.Drawing.Color.Transparent;
     this.LabelContent.DisabledLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(126)))), ((int)(((byte)(133)))), ((int)(((byte)(156)))));
     this.LabelContent.LinkArea          = new System.Windows.Forms.LinkArea(0, 0);
     this.LabelContent.LinkColor         = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(102)))), ((int)(((byte)(204)))));
     this.LabelContent.Location          = new System.Drawing.Point(56, 61);
     this.LabelContent.Margin            = new System.Windows.Forms.Padding(12, 8, 16, 8);
     this.LabelContent.Name             = "LabelContent";
     this.LabelContent.Size             = new System.Drawing.Size(78, 15);
     this.LabelContent.TabIndex         = 2;
     this.LabelContent.Text             = "LabelContent";
     this.LabelContent.VisitedLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(102)))), ((int)(((byte)(204)))));
     this.LabelContent.LinkClicked     += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.RaiseLinkClicked);
     //
     // TableLayoutPanelContents
     //
     this.TableLayoutPanelContents.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                                  | System.Windows.Forms.AnchorStyles.Right)));
     this.TableLayoutPanelContents.AutoSize     = true;
     this.TableLayoutPanelContents.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.TableLayoutPanelContents.ColumnCount  = 1;
     this.TableLayoutPanelContents.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
     this.TableLayoutPanelContents.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
     this.TableLayoutPanelContents.Location = new System.Drawing.Point(56, 115);
     this.TableLayoutPanelContents.Margin   = new System.Windows.Forms.Padding(12, 8, 16, 8);
     this.TableLayoutPanelContents.Name     = "TableLayoutPanelContents";
     this.TableLayoutPanelContents.RowCount = 1;
     this.TableLayoutPanelContents.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
     this.TableLayoutPanelContents.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 1F));
     this.TableLayoutPanelContents.Size     = new System.Drawing.Size(1104, 0);
     this.TableLayoutPanelContents.TabIndex = 3;
     //
     // LabelExpandedContent
     //
     this.LabelExpandedContent.ActiveLinkColor   = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(102)))), ((int)(((byte)(204)))));
     this.LabelExpandedContent.Anchor            = System.Windows.Forms.AnchorStyles.Left;
     this.LabelExpandedContent.AutoSize          = true;
     this.LabelExpandedContent.DisabledLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(126)))), ((int)(((byte)(133)))), ((int)(((byte)(156)))));
     this.LabelExpandedContent.LinkArea          = new System.Windows.Forms.LinkArea(0, 0);
     this.LabelExpandedContent.LinkColor         = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(102)))), ((int)(((byte)(204)))));
     this.LabelExpandedContent.Location          = new System.Drawing.Point(56, 84);
     this.LabelExpandedContent.Margin            = new System.Windows.Forms.Padding(12, 0, 16, 8);
     this.LabelExpandedContent.Name             = "LabelExpandedContent";
     this.LabelExpandedContent.Size             = new System.Drawing.Size(129, 15);
     this.LabelExpandedContent.TabIndex         = 2;
     this.LabelExpandedContent.Text             = "LabelExpandedContent";
     this.LabelExpandedContent.VisitedLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(102)))), ((int)(((byte)(204)))));
     this.LabelExpandedContent.LinkClicked     += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.RaiseLinkClicked);
     //
     // PanelExpandedFooter
     //
     this.PanelExpandedFooter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                             | System.Windows.Forms.AnchorStyles.Right)));
     this.PanelExpandedFooter.AutoSize     = true;
     this.PanelExpandedFooter.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.PanelExpandedFooter.Controls.Add(this.TableLayoutPanelExpanderFooter);
     this.PanelExpandedFooter.Controls.Add(this.BevelExpanderFooter);
     this.PanelExpandedFooter.Location = new System.Drawing.Point(0, 225);
     this.PanelExpandedFooter.Margin   = new System.Windows.Forms.Padding(0);
     this.PanelExpandedFooter.Name     = "PanelExpandedFooter";
     this.PanelExpandedFooter.Size     = new System.Drawing.Size(1176, 32);
     this.PanelExpandedFooter.TabIndex = 3;
     //
     // TableLayoutPanelExpanderFooter
     //
     this.TableLayoutPanelExpanderFooter.AutoSize     = true;
     this.TableLayoutPanelExpanderFooter.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.TableLayoutPanelExpanderFooter.ColumnCount  = 1;
     this.TableLayoutPanelExpanderFooter.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
     this.TableLayoutPanelExpanderFooter.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
     this.TableLayoutPanelExpanderFooter.Controls.Add(this.LabelExpandedFooter, 0, 0);
     this.TableLayoutPanelExpanderFooter.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.TableLayoutPanelExpanderFooter.Location = new System.Drawing.Point(0, 1);
     this.TableLayoutPanelExpanderFooter.Margin   = new System.Windows.Forms.Padding(0);
     this.TableLayoutPanelExpanderFooter.Name     = "TableLayoutPanelExpanderFooter";
     this.TableLayoutPanelExpanderFooter.RowCount = 1;
     this.TableLayoutPanelExpanderFooter.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.TableLayoutPanelExpanderFooter.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 29F));
     this.TableLayoutPanelExpanderFooter.Size     = new System.Drawing.Size(1176, 31);
     this.TableLayoutPanelExpanderFooter.TabIndex = 1;
     //
     // LabelExpandedFooter
     //
     this.LabelExpandedFooter.ActiveLinkColor   = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(102)))), ((int)(((byte)(204)))));
     this.LabelExpandedFooter.AutoSize          = true;
     this.LabelExpandedFooter.DisabledLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(126)))), ((int)(((byte)(133)))), ((int)(((byte)(156)))));
     this.LabelExpandedFooter.LinkArea          = new System.Windows.Forms.LinkArea(0, 0);
     this.LabelExpandedFooter.LinkColor         = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(102)))), ((int)(((byte)(204)))));
     this.LabelExpandedFooter.Location          = new System.Drawing.Point(16, 8);
     this.LabelExpandedFooter.Margin            = new System.Windows.Forms.Padding(16, 8, 16, 8);
     this.LabelExpandedFooter.Name             = "LabelExpandedFooter";
     this.LabelExpandedFooter.Size             = new System.Drawing.Size(120, 15);
     this.LabelExpandedFooter.TabIndex         = 1;
     this.LabelExpandedFooter.Text             = "LabelExpandedFooter";
     this.LabelExpandedFooter.VisitedLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(102)))), ((int)(((byte)(204)))));
     this.LabelExpandedFooter.LinkClicked     += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.RaiseLinkClicked);
     //
     // BevelExpanderFooter
     //
     this.BevelExpanderFooter.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(102)))), ((int)(((byte)(204)))));
     this.BevelExpanderFooter.Dock      = System.Windows.Forms.DockStyle.Top;
     this.BevelExpanderFooter.Location  = new System.Drawing.Point(0, 0);
     this.BevelExpanderFooter.Name      = "BevelExpanderFooter";
     this.BevelExpanderFooter.Size      = new System.Drawing.Size(1176, 1);
     this.BevelExpanderFooter.TabIndex  = 0;
     //
     // PanelFooter
     //
     this.PanelFooter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                     | System.Windows.Forms.AnchorStyles.Right)));
     this.PanelFooter.AutoSize     = true;
     this.PanelFooter.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.PanelFooter.Controls.Add(this.TableLayoutPanelFooter);
     this.PanelFooter.Controls.Add(this.BevelFooter);
     this.PanelFooter.Location = new System.Drawing.Point(0, 193);
     this.PanelFooter.Margin   = new System.Windows.Forms.Padding(0);
     this.PanelFooter.Name     = "PanelFooter";
     this.PanelFooter.Size     = new System.Drawing.Size(1176, 32);
     this.PanelFooter.TabIndex = 2;
     //
     // TableLayoutPanelFooter
     //
     this.TableLayoutPanelFooter.AutoSize     = true;
     this.TableLayoutPanelFooter.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.TableLayoutPanelFooter.ColumnCount  = 2;
     this.TableLayoutPanelFooter.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
     this.TableLayoutPanelFooter.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
     this.TableLayoutPanelFooter.Controls.Add(this.LabelIconFooter, 0, 0);
     this.TableLayoutPanelFooter.Controls.Add(this.LabelFooter, 1, 0);
     this.TableLayoutPanelFooter.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.TableLayoutPanelFooter.Location = new System.Drawing.Point(0, 1);
     this.TableLayoutPanelFooter.Margin   = new System.Windows.Forms.Padding(0);
     this.TableLayoutPanelFooter.Name     = "TableLayoutPanelFooter";
     this.TableLayoutPanelFooter.RowCount = 1;
     this.TableLayoutPanelFooter.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.TableLayoutPanelFooter.Size     = new System.Drawing.Size(1176, 31);
     this.TableLayoutPanelFooter.TabIndex = 1;
     //
     // LabelIconFooter
     //
     this.LabelIconFooter.Location = new System.Drawing.Point(16, 6);
     this.LabelIconFooter.Margin   = new System.Windows.Forms.Padding(16, 6, 0, 8);
     this.LabelIconFooter.Name     = "LabelIconFooter";
     this.LabelIconFooter.Size     = new System.Drawing.Size(16, 16);
     this.LabelIconFooter.TabIndex = 0;
     //
     // LabelFooter
     //
     this.LabelFooter.ActiveLinkColor   = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(102)))), ((int)(((byte)(204)))));
     this.LabelFooter.AutoSize          = true;
     this.LabelFooter.DisabledLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(126)))), ((int)(((byte)(133)))), ((int)(((byte)(156)))));
     this.LabelFooter.LinkArea          = new System.Windows.Forms.LinkArea(0, 0);
     this.LabelFooter.LinkColor         = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(102)))), ((int)(((byte)(204)))));
     this.LabelFooter.Location          = new System.Drawing.Point(36, 8);
     this.LabelFooter.Margin            = new System.Windows.Forms.Padding(4, 8, 16, 8);
     this.LabelFooter.Name             = "LabelFooter";
     this.LabelFooter.Size             = new System.Drawing.Size(69, 15);
     this.LabelFooter.TabIndex         = 0;
     this.LabelFooter.Text             = "LabelFooter";
     this.LabelFooter.VisitedLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(102)))), ((int)(((byte)(204)))));
     this.LabelFooter.LinkClicked     += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.RaiseLinkClicked);
     //
     // BevelFooter
     //
     this.BevelFooter.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(102)))), ((int)(((byte)(204)))));
     this.BevelFooter.Dock      = System.Windows.Forms.DockStyle.Top;
     this.BevelFooter.Location  = new System.Drawing.Point(0, 0);
     this.BevelFooter.Name      = "BevelFooter";
     this.BevelFooter.Size      = new System.Drawing.Size(1176, 1);
     this.BevelFooter.TabIndex  = 0;
     //
     // PanelButtons
     //
     this.PanelButtons.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                      | System.Windows.Forms.AnchorStyles.Right)));
     this.PanelButtons.AutoSize     = true;
     this.PanelButtons.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.PanelButtons.Controls.Add(this.TableLayoutPanelButtons);
     this.PanelButtons.Controls.Add(this.BevelButtons);
     this.PanelButtons.Location = new System.Drawing.Point(0, 123);
     this.PanelButtons.Margin   = new System.Windows.Forms.Padding(0);
     this.PanelButtons.Name     = "PanelButtons";
     this.PanelButtons.Size     = new System.Drawing.Size(1176, 70);
     this.PanelButtons.TabIndex = 1;
     //
     // TableLayoutPanelButtons
     //
     this.TableLayoutPanelButtons.AutoSize     = true;
     this.TableLayoutPanelButtons.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.TableLayoutPanelButtons.ColumnCount  = 2;
     this.TableLayoutPanelButtons.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
     this.TableLayoutPanelButtons.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
     this.TableLayoutPanelButtons.Controls.Add(this.FlowLayoutPanelButtons, 1, 0);
     this.TableLayoutPanelButtons.Controls.Add(this.FlowLayoutPanelButtonsLeft, 0, 0);
     this.TableLayoutPanelButtons.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.TableLayoutPanelButtons.Location = new System.Drawing.Point(0, 1);
     this.TableLayoutPanelButtons.Margin   = new System.Windows.Forms.Padding(0);
     this.TableLayoutPanelButtons.Name     = "TableLayoutPanelButtons";
     this.TableLayoutPanelButtons.RowCount = 1;
     this.TableLayoutPanelButtons.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.TableLayoutPanelButtons.Size     = new System.Drawing.Size(1176, 69);
     this.TableLayoutPanelButtons.TabIndex = 1;
     //
     // FlowLayoutPanelButtons
     //
     this.FlowLayoutPanelButtons.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.FlowLayoutPanelButtons.AutoSize     = true;
     this.FlowLayoutPanelButtons.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.FlowLayoutPanelButtons.Controls.Add(this.Button1);
     this.FlowLayoutPanelButtons.Controls.Add(this.Button2);
     this.FlowLayoutPanelButtons.Controls.Add(this.Button3);
     this.FlowLayoutPanelButtons.Controls.Add(this.Button4);
     this.FlowLayoutPanelButtons.Controls.Add(this.Button5);
     this.FlowLayoutPanelButtons.Controls.Add(this.Button6);
     this.FlowLayoutPanelButtons.Controls.Add(this.Button7);
     this.FlowLayoutPanelButtons.Controls.Add(this.Button8);
     this.FlowLayoutPanelButtons.Controls.Add(this.Button9);
     this.FlowLayoutPanelButtons.Controls.Add(this.Button10);
     this.FlowLayoutPanelButtons.Controls.Add(this.Button11);
     this.FlowLayoutPanelButtons.Location     = new System.Drawing.Point(255, 4);
     this.FlowLayoutPanelButtons.Margin       = new System.Windows.Forms.Padding(8, 4, 8, 4);
     this.FlowLayoutPanelButtons.Name         = "FlowLayoutPanelButtons";
     this.FlowLayoutPanelButtons.Size         = new System.Drawing.Size(913, 33);
     this.FlowLayoutPanelButtons.TabIndex     = 0;
     this.FlowLayoutPanelButtons.WrapContents = false;
     //
     // Button1
     //
     this.Button1.AutoSize = true;
     //this.Button1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.Button1.Location = new System.Drawing.Point(4, 4);
     this.Button1.Margin   = new System.Windows.Forms.Padding(4);
     this.Button1.Name     = "Button1";
     this.Button1.Size     = new System.Drawing.Size(75, 25);
     this.Button1.TabIndex = 0;
     //this.Button1.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     this.Button1.Visible = false;
     this.Button1.Click  += new System.EventHandler(this.Button_Click);
     //
     // Button2
     //
     this.Button2.AutoSize = true;
     //this.Button2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.Button2.Location = new System.Drawing.Point(87, 4);
     this.Button2.Margin   = new System.Windows.Forms.Padding(4);
     this.Button2.Name     = "Button2";
     this.Button2.Size     = new System.Drawing.Size(75, 25);
     this.Button2.TabIndex = 1;
     //this.Button2.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     this.Button2.Visible = false;
     this.Button2.Click  += new System.EventHandler(this.Button_Click);
     //
     // Button3
     //
     this.Button3.AutoSize = true;
     //this.Button3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.Button3.Location = new System.Drawing.Point(170, 4);
     this.Button3.Margin   = new System.Windows.Forms.Padding(4);
     this.Button3.Name     = "Button3";
     this.Button3.Size     = new System.Drawing.Size(75, 25);
     this.Button3.TabIndex = 2;
     //this.Button3.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     this.Button3.Visible = false;
     this.Button3.Click  += new System.EventHandler(this.Button_Click);
     //
     // Button4
     //
     this.Button4.AutoSize = true;
     //this.Button4.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.Button4.Location = new System.Drawing.Point(253, 4);
     this.Button4.Margin   = new System.Windows.Forms.Padding(4);
     this.Button4.Name     = "Button4";
     this.Button4.Size     = new System.Drawing.Size(75, 25);
     this.Button4.TabIndex = 3;
     //this.Button4.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     this.Button4.Visible = false;
     this.Button4.Click  += new System.EventHandler(this.Button_Click);
     //
     // Button5
     //
     this.Button5.AutoSize = true;
     //this.Button5.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.Button5.Location = new System.Drawing.Point(336, 4);
     this.Button5.Margin   = new System.Windows.Forms.Padding(4);
     this.Button5.Name     = "Button5";
     this.Button5.Size     = new System.Drawing.Size(75, 25);
     this.Button5.TabIndex = 4;
     //this.Button5.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     this.Button5.Visible = false;
     this.Button5.Click  += new System.EventHandler(this.Button_Click);
     //
     // Button6
     //
     this.Button6.AutoSize = true;
     //this.Button6.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.Button6.Location = new System.Drawing.Point(419, 4);
     this.Button6.Margin   = new System.Windows.Forms.Padding(4);
     this.Button6.Name     = "Button6";
     this.Button6.Size     = new System.Drawing.Size(75, 25);
     this.Button6.TabIndex = 5;
     //this.Button6.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     this.Button6.Visible = false;
     this.Button6.Click  += new System.EventHandler(this.Button_Click);
     //
     // Button7
     //
     this.Button7.AutoSize = true;
     //this.Button7.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.Button7.Location = new System.Drawing.Point(502, 4);
     this.Button7.Margin   = new System.Windows.Forms.Padding(4);
     this.Button7.Name     = "Button7";
     this.Button7.Size     = new System.Drawing.Size(75, 25);
     this.Button7.TabIndex = 6;
     //this.Button7.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     this.Button7.Visible = false;
     this.Button7.Click  += new System.EventHandler(this.Button_Click);
     //
     // Button8
     //
     this.Button8.AutoSize = true;
     //this.Button8.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.Button8.Location = new System.Drawing.Point(585, 4);
     this.Button8.Margin   = new System.Windows.Forms.Padding(4);
     this.Button8.Name     = "Button8";
     this.Button8.Size     = new System.Drawing.Size(75, 25);
     this.Button8.TabIndex = 7;
     //this.Button8.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     this.Button8.Visible = false;
     this.Button8.Click  += new System.EventHandler(this.Button_Click);
     //
     // Button9
     //
     this.Button9.AutoSize = true;
     //this.Button9.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.Button9.Location = new System.Drawing.Point(668, 4);
     this.Button9.Margin   = new System.Windows.Forms.Padding(4);
     this.Button9.Name     = "Button9";
     this.Button9.Size     = new System.Drawing.Size(75, 25);
     this.Button9.TabIndex = 8;
     //this.Button9.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     this.Button9.Visible = false;
     this.Button9.Click  += new System.EventHandler(this.Button_Click);
     //
     // Button10
     //
     this.Button10.AutoSize = true;
     //this.Button10.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.Button10.Location = new System.Drawing.Point(751, 4);
     this.Button10.Margin   = new System.Windows.Forms.Padding(4);
     this.Button10.Name     = "Button10";
     this.Button10.Size     = new System.Drawing.Size(75, 25);
     this.Button10.TabIndex = 9;
     //this.Button10.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     this.Button10.Visible = false;
     this.Button10.Click  += new System.EventHandler(this.Button_Click);
     //
     // Button11
     //
     this.Button11.AutoSize = true;
     //this.Button11.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.Button11.Location = new System.Drawing.Point(834, 4);
     this.Button11.Margin   = new System.Windows.Forms.Padding(4);
     this.Button11.Name     = "Button11";
     this.Button11.Size     = new System.Drawing.Size(75, 25);
     this.Button11.TabIndex = 10;
     //this.Button11.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     this.Button11.Visible = false;
     this.Button11.Click  += new System.EventHandler(this.Button_Click);
     //
     // FlowLayoutPanelButtonsLeft
     //
     this.FlowLayoutPanelButtonsLeft.Anchor       = System.Windows.Forms.AnchorStyles.Left;
     this.FlowLayoutPanelButtonsLeft.AutoSize     = true;
     this.FlowLayoutPanelButtonsLeft.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.FlowLayoutPanelButtonsLeft.Controls.Add(this.ButtonExpander);
     this.FlowLayoutPanelButtonsLeft.Controls.Add(this.CheckBox);
     this.FlowLayoutPanelButtonsLeft.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
     this.FlowLayoutPanelButtonsLeft.Location      = new System.Drawing.Point(8, 4);
     this.FlowLayoutPanelButtonsLeft.Margin        = new System.Windows.Forms.Padding(8, 4, 4, 4);
     this.FlowLayoutPanelButtonsLeft.Name          = "FlowLayoutPanelButtonsLeft";
     this.FlowLayoutPanelButtonsLeft.Size          = new System.Drawing.Size(212, 61);
     this.FlowLayoutPanelButtonsLeft.TabIndex      = 1;
     //
     // ButtonExpander
     //
     this.ButtonExpander.AutoSize     = true;
     this.ButtonExpander.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.ButtonExpander.BackColor    = System.Drawing.Color.Transparent;
     this.ButtonExpander.Expanded     = false;
     this.ButtonExpander.FlatAppearance.BorderColor        = System.Drawing.SystemColors.Control;
     this.ButtonExpander.FlatAppearance.BorderSize         = 0;
     this.ButtonExpander.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent;
     this.ButtonExpander.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent;
     this.ButtonExpander.FlatStyle               = System.Windows.Forms.FlatStyle.Flat;
     this.ButtonExpander.Image                   = ((System.Drawing.Image)(resources.GetObject("ButtonExpander.Image")));
     this.ButtonExpander.ImageAlign              = System.Drawing.ContentAlignment.MiddleLeft;
     this.ButtonExpander.Location                = new System.Drawing.Point(0, 4);
     this.ButtonExpander.Margin                  = new System.Windows.Forms.Padding(0, 4, 8, 4);
     this.ButtonExpander.Name                    = "ButtonExpander";
     this.ButtonExpander.Size                    = new System.Drawing.Size(97, 26);
     this.ButtonExpander.TabIndex                = 0;
     this.ButtonExpander.Text                    = "Show More";
     this.ButtonExpander.TextAlign               = System.Drawing.ContentAlignment.MiddleLeft;
     this.ButtonExpander.TextImageRelation       = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     this.ButtonExpander.UseVisualStyleBackColor = false;
     this.ButtonExpander.Visible                 = false;
     this.ButtonExpander.Click                  += new System.EventHandler(this.ButtonExpander_Click);
     //
     // CheckBox
     //
     this.CheckBox.AutoSize = true;
     this.CheckBox.Location = new System.Drawing.Point(8, 38);
     this.CheckBox.Margin   = new System.Windows.Forms.Padding(8, 4, 8, 4);
     this.CheckBox.Name     = "CheckBox";
     this.CheckBox.Size     = new System.Drawing.Size(196, 19);
     this.CheckBox.TabIndex = 1;
     this.CheckBox.Text     = "Do not show this message again";
     this.CheckBox.UseVisualStyleBackColor = true;
     //
     // BevelButtons
     //
     this.BevelButtons.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(102)))), ((int)(((byte)(204)))));
     this.BevelButtons.Dock      = System.Windows.Forms.DockStyle.Top;
     this.BevelButtons.Location  = new System.Drawing.Point(0, 0);
     this.BevelButtons.Name      = "BevelButtons";
     this.BevelButtons.Size      = new System.Drawing.Size(1176, 1);
     this.BevelButtons.TabIndex  = 0;
     //
     // TableLayoutPanel
     //
     this.TableLayoutPanel.AutoSize     = true;
     this.TableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.TableLayoutPanel.BackColor    = System.Drawing.Color.Transparent;
     this.TableLayoutPanel.ColumnCount  = 1;
     this.TableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
     this.TableLayoutPanel.Controls.Add(this.TableLayoutPanelContent, 0, 0);
     this.TableLayoutPanel.Controls.Add(this.PanelButtons, 0, 1);
     this.TableLayoutPanel.Controls.Add(this.PanelFooter, 0, 2);
     this.TableLayoutPanel.Controls.Add(this.PanelExpandedFooter, 0, 3);
     this.TableLayoutPanel.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.TableLayoutPanel.Location = new System.Drawing.Point(0, 0);
     this.TableLayoutPanel.Margin   = new System.Windows.Forms.Padding(0);
     this.TableLayoutPanel.Name     = "TableLayoutPanel";
     this.TableLayoutPanel.RowCount = 4;
     this.TableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.TableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.TableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.TableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.TableLayoutPanel.Size     = new System.Drawing.Size(1176, 329);
     this.TableLayoutPanel.TabIndex = 0;
     //
     // TaskDialogForm
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.AutoSize            = true;
     this.AutoSizeMode        = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     this.ClientSize          = new System.Drawing.Size(1176, 329);
     this.Controls.Add(this.TableLayoutPanel);
     this.Font            = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
     this.MaximizeBox     = false;
     this.MinimizeBox     = false;
     this.Name            = "TaskDialogForm";
     this.ShowIcon        = false;
     this.ShowInTaskbar   = false;
     this.StartPosition   = System.Windows.Forms.FormStartPosition.CenterParent;
     this.Text            = "TaskDialogForm";
     this.FormClosing    += new System.Windows.Forms.FormClosingEventHandler(this.TaskDialogForm_FormClosing);
     this.FormClosed     += new System.Windows.Forms.FormClosedEventHandler(this.TaskDialog_FormClosed);
     this.TableLayoutPanelContent.ResumeLayout(false);
     this.TableLayoutPanelContent.PerformLayout();
     ((System.ComponentModel.ISupportInitialize)(this.PictureBoxIcon)).EndInit();
     this.PanelExpandedFooter.ResumeLayout(false);
     this.PanelExpandedFooter.PerformLayout();
     this.TableLayoutPanelExpanderFooter.ResumeLayout(false);
     this.TableLayoutPanelExpanderFooter.PerformLayout();
     this.PanelFooter.ResumeLayout(false);
     this.PanelFooter.PerformLayout();
     this.TableLayoutPanelFooter.ResumeLayout(false);
     this.TableLayoutPanelFooter.PerformLayout();
     this.PanelButtons.ResumeLayout(false);
     this.PanelButtons.PerformLayout();
     this.TableLayoutPanelButtons.ResumeLayout(false);
     this.TableLayoutPanelButtons.PerformLayout();
     this.FlowLayoutPanelButtons.ResumeLayout(false);
     this.FlowLayoutPanelButtons.PerformLayout();
     this.FlowLayoutPanelButtonsLeft.ResumeLayout(false);
     this.FlowLayoutPanelButtonsLeft.PerformLayout();
     this.TableLayoutPanel.ResumeLayout(false);
     this.TableLayoutPanel.PerformLayout();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Пример #39
0
        /// <summary>
        /// This method implements the external command within
        /// Revit.
        /// </summary>
        /// <param name="commandData">An ExternalCommandData
        /// object which contains reference to Application and
        /// View needed by external command.</param>
        /// <param name="message">Error message can be returned
        /// by external command. This will be displayed only if
        /// the command status was "Failed". There is a limit
        /// of 1023 characters for this message; strings longer
        /// than this will be truncated.</param>
        /// <param name="elements">Element set indicating
        /// problem elements to display in the failure dialog.
        /// This will be used only if the command status was
        /// "Failed".</param>
        /// <returns>The result indicates if the execution
        /// fails, succeeds, or was canceled by user. If it
        /// does not succeed, Revit will undo any changes made
        /// by the external command.</returns>
        Result IExternalCommand.Execute(
            ExternalCommandData commandData, ref string message
            , ElementSet elements)
        {
            ResourceManager res_mng = new ResourceManager(
                GetType());
            ResourceManager def_res_mng = new ResourceManager(
                typeof(Properties.Resources));

            Result result = Result.Failed;

            try
            {
                UIApplication ui_app = commandData?.Application
                ;
                UIDocument  ui_doc = ui_app?.ActiveUIDocument;
                Application app    = ui_app?.Application;
                Document    doc    = ui_doc?.Document;

                /* Wrap all transactions into the transaction
                 * group. At first we get the transaction group
                 * localized name. */
                var tr_gr_name = UIBuilder.GetResourceString(
                    GetType(), typeof(Properties.Resources),
                    "_transaction_group_name");

                using (var tr_gr = new TransactionGroup(doc,
                                                        tr_gr_name))
                {
                    if (TransactionStatus.Started == tr_gr
                        .Start())
                    {
                        /* Here do your work or the set of
                         * works... */
                        if (DoWork(commandData, ref message,
                                   elements))
                        {
                            if (TransactionStatus.Committed ==
                                tr_gr.Assimilate())
                            {
                                result = Result.Succeeded;
                            }
                        }
                        else
                        {
                            tr_gr.RollBack();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                TaskDialog.Show(def_res_mng.GetString("_Error")
                                , ex.Message);

                result = Result.Failed;
            }
            finally
            {
                res_mng.ReleaseAllResources();
                def_res_mng.ReleaseAllResources();
            }

            return(result);
        }
Пример #40
0
 private void td_shieldsuccess(object sender, EventArgs e)
 {
     TaskDialog.Show("Security success", "Task Dialog", "Content of the task dialog.", TaskDialogButton.OK, TaskDialogIcon.SecuritySuccess);
 }
Пример #41
0
 private void td_grayshield(object sender, EventArgs e)
 {
     TaskDialog.Show("Gray shield", "Task Dialog", "Content of the task dialog.", TaskDialogButton.OK, TaskDialogIcon.SecurityShieldGray);
 }
Пример #42
0
 private void td_shielderror(object sender, EventArgs e)
 {
     TaskDialog.Show("Security error", "Task Dialog", "Content of the task dialog.", TaskDialogButton.OK, TaskDialogIcon.SecurityError);
 }
Пример #43
0
 private void td_error(object sender, EventArgs e)
 {
     TaskDialog.Show("Error", "Task Dialog", "Content of the task dialog.", TaskDialogButton.OK, TaskDialogIcon.Stop);
 }
Пример #44
0
 private void ts_warning(object sender, EventArgs e)
 {
     TaskDialog.Show("Warning", "Task Dialog", "Content of the task dialog.", TaskDialogButton.OK, TaskDialogIcon.Warning);
 }
Пример #45
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIDocument UIdoc = commandData.Application.ActiveUIDocument;
            Document   doc   = UIdoc.Document;

            this.application = commandData.Application.Application;

            Debug("I got here before construct dialog");
            CreateExteriorElevationInput1 wallSelectionForm = new CreateExteriorElevationInput1(UIdoc);

            Debug("I got here before show dialog");
            wallSelectionForm.ShowDialog();
            Debug($"I got here after show dialog {wallSelectionForm.DialogResult}");

            if (wallSelectionForm.DialogResult != true)
            {
                return(Result.Cancelled);
            }

            Selection         userObjectSelection = UIdoc.Selection;
            IList <Reference> userSelection       = userObjectSelection.PickObjects(ObjectType.Element);

            List <Wall> userWallSelection = new List <Wall>();

            foreach (Reference s in userSelection)
            {
                Element el = UIdoc.Document.GetElement(s.ElementId);
                Wall    w  = el as Wall;

                if (w != null)
                {
                    userWallSelection.Add(w);
                }
            }

            if (0 == userWallSelection.Count)
            {
                //no elements selected
                TaskDialog.Show("Revit", "There are no elements selected.");
            }

            //user wall selction
            List <Wall> wallsToUse = userWallSelection;

            Debug($"Received {wallsToUse.Count} walls");

            using (Transaction tx = new Transaction(doc))
            {
                tx.Start("Place Elevations");

                foreach (Wall w in wallsToUse)
                {
                    BoundingBoxXYZ wbb = w.get_BoundingBox(null);
                    XYZ            elevMarkerPosition = GetElevationMarkerPosition(w);
                    this.Debug("wall Id" + w.Id);

                    this.Debug("wall LevelId" + w.LevelId);

                    using (ElevationMarker marker = PlaceMarker(doc, elevMarkerPosition, w))
                    {
                        XYZ    elevViewSectionNormal = GetViewSectionNormal(doc, marker);
                        double angleViewtoWall       = GetAngleViewtoWall(elevViewSectionNormal, w);

                        RotateMarker(marker, angleViewtoWall, elevMarkerPosition);

                        SetCropBox(doc, marker, w);
                    }

                    //set view filter
                    //option to hide elevaion marker in view? maybe put on workset
                }

                tx.Commit();
            }

            return(Result.Succeeded);
        }
Пример #46
0
        private void btnOpenTemplate_Click(object sender, EventArgs e)
        {
            string userName = string.Empty;

            userName = Environment.UserName;

            string templateFile = string.Empty;

            templateFile = @"C:\Users\" + userName + @"\Documents\CRMRevitTools\" + revitVersion + @"\Parameter_Template-" + revitVersion + ".xlsx";

            if (File.Exists(templateFile))
            {
                try
                {
                    DateTime date = new DateTime();
                    date = DateTime.Now;

                    string timeStamp = date.ToString("yyyyMMddHHmmss");
                    workingDirectory = @"C:\Users\" + userName + @"\Desktop\" + timeStamp + "-" + revitVersion + "-Shared_Parameters";

                    if (!Directory.Exists(workingDirectory))
                    {
                        Directory.CreateDirectory(workingDirectory);
                    }

                    string workingFile = string.Empty;
                    workingFile = workingDirectory + @"\" + timeStamp + "-" + revitVersion + "-Shared_Parameters.xlsx";

                    File.Copy(templateFile, workingFile);

                    if (File.Exists(workingFile))
                    {
                        try
                        {
                            Process.Start(workingFile);
                        }
                        catch (Exception ex)
                        {
                            TaskDialog taskDialog = new TaskDialog("Shared Parameter Creator");

                            taskDialog.MainInstruction = "An error occurrued while opening the parameter working file." + "\n" + "Please read the following error message below";
                            taskDialog.MainContent     = ex.Message + Environment.NewLine + ex.Source;

                            taskDialog.Show();
                        }
                    }
                    else
                    {
                        TaskDialog taskDialog = new TaskDialog("Shared Parameter Creator");

                        taskDialog.MainIcon        = TaskDialogIcon.TaskDialogIconNone;
                        taskDialog.MainInstruction = "The parameter working file could not be found. It may have been moved or deleted.";

                        taskDialog.Show();
                    }
                }
                catch (Exception ex)
                {
                    TaskDialog taskDialog = new TaskDialog("Shared Parameter Creator");

                    taskDialog.MainInstruction = "An error occurrued while copying the parameter template file." + "\n" + "Please read the following error message below";
                    taskDialog.MainContent     = ex.Message + Environment.NewLine + ex.Source;

                    taskDialog.Show();
                }
            }
            else
            {
                TaskDialog taskDialog = new TaskDialog("Shared Parameter Creator");

                taskDialog.MainIcon        = TaskDialogIcon.TaskDialogIconNone;
                taskDialog.MainInstruction = "The parameter template file could not be found. It may have been moved or deleted.";

                taskDialog.Show();
            }
        }
Пример #47
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIDocument uiDoc = commandData.Application.ActiveUIDocument;
            Document   doc   = uiDoc.Document;

            //создаем транзакцию

            Transaction trans = new Transaction(doc, "Extensible Storage");

            trans.Start();

            //выбор стены

            Wall wall = null;

            try
            {
                Reference r = uiDoc.Selection.PickObject(ObjectType.Element, new WallSelectionFilter());
                wall = doc.GetElement(r) as Wall;
            }

            catch (Autodesk.Revit.Exceptions.OperationCanceledException)
            {
                message = "Ничего не выбрано; пожалуйста выбирете стену";
                return(Result.Failed);
            }

            Debug.Assert(null != wall, "стены должны быть выьраны");

            if (null == wall)
            {
                message = "пожалуйста выбирете стену";
                return(Result.Failed);
            }

            SchemaBuilder builder = new SchemaBuilder(_guid);

            builder.SetReadAccessLevel(AccessLevel.Public);
            builder.SetWriteAccessLevel(AccessLevel.Public);

            builder.SetSchemaName("WallSocketLocation");
            builder.SetDocumentation("Data stroe for socket relates info in a wall");

            FieldBuilder fieldBuilder1 = builder.AddSimpleField("SocketLocation", typeof(XYZ));

            fieldBuilder1.SetSpec(SpecTypeId.Length);

            FieldBuilder fieldBuilder2 = builder.AddSimpleField("SocketNumber", typeof(string));

            Schema schema = builder.Finish();

            // Create an entity (object) for this schema (class)

            Entity ent            = new Entity(schema);
            Field  socketLocation = schema.GetField("SocketLocation");

            //ent.Set<XYZ>( socketLocation, new XYZ( 2, 0, 0 ), DisplayUnitType.DUT_METERS ); // 2020
            ent.Set <XYZ>(socketLocation, new XYZ(2, 0, 0), UnitTypeId.Meters); // 2021

            Field socketNumber = schema.GetField("SocketNumber");

            ent.Set <string>(socketNumber, "200");

            wall.SetEntity(ent);

            // Now create another entity (object) for this schema (class)

            Entity ent2          = new Entity(schema);
            Field  socketNumber1 = schema.GetField("SocketNumber");

            ent2.Set <String>(socketNumber1, "400");
            wall.SetEntity(ent2);

            // Note: this will replace the previous entity on the wall

            // List all schemas in the document

            string         s       = string.Empty;
            IList <Schema> schemas = Schema.ListSchemas();

            foreach (Schema sch in schemas)
            {
                s += "\r\nSchema Name: " + sch.SchemaName;
            }
            TaskDialog.Show("Schema details", s);

            //List all fields for our schema

            s = string.Empty;
            Schema        ourSchema = Schema.Lookup(_guid);
            IList <Field> fields    = ourSchema.ListFields();

            foreach (Field fld in fields)
            {
                s += "\r\nField Name: " + fld.FieldName;
            }
            TaskDialog.Show("Field details", s);

            //Extract the value for the field we created

            Entity wallSchemaEnt = wall.GetEntity(Schema.Lookup(_guid));

            XYZ wallSocketPos = wallSchemaEnt.Get <XYZ>(Schema.Lookup(_guid).GetField("SocketLocation"), UnitTypeId.Meters);

            s = "SocketLocation: " + Format.PointString(wallSocketPos);

            string wallSockerNumber = wallSchemaEnt.Get <String>(Schema.Lookup(_guid).GetField("SocketNumber"));

            s += "\r\nSocketNumber: " + wallSockerNumber;

            TaskDialog.Show("Field value", s);

            trans.Commit();

            return(Result.Succeeded);
        }
Пример #48
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            TaskDialog taskDialog = new TaskDialog("Shared Parameter Creator");

            taskDialog.MainIcon        = TaskDialogIcon.TaskDialogIconNone;
            taskDialog.MainInstruction = "Are you sure you want to create the Shared Parameters file?";
            taskDialog.CommonButtons   = TaskDialogCommonButtons.Yes | TaskDialogCommonButtons.No;

            fullFile_Excel = txtCSVFile.Text;

            insertIntoProjectParameters = chkInsert.Checked;

            if (fullFile_Excel == string.Empty)
            {
                TaskDialog.Show("No File Provided", "Make sure you have created a file with the .csv extension.");
            }
            else
            {
                if (taskDialog.Show() == TaskDialogResult.Yes)
                {
                    try
                    {
                        Category                  category        = null;
                        CategorySet               categorySet     = null;
                        InstanceBinding           instanceBinding = null;
                        Autodesk.Revit.DB.Binding typeBinding     = null;
                        BindingMap                bindingMap      = null;

                        categorySet     = myCommandData.Application.Application.Create.NewCategorySet();
                        instanceBinding = myCommandData.Application.Application.Create.NewInstanceBinding(categorySet);
                        typeBinding     = myCommandData.Application.Application.Create.NewInstanceBinding(categorySet);
                        bindingMap      = myCommandData.Application.ActiveUIDocument.Document.ParameterBindings;

                        DefinitionFile sharedParametersFile;

                        string fileName = string.Empty;
                        string filePath = string.Empty;

                        filePath = Path.GetDirectoryName(fullFile_Excel);
                        fileName = Path.GetFileNameWithoutExtension(fullFile_Excel);

                        fullFile_Parameters = filePath + "\\" + fileName + ".txt";

                        // THE SHARED PARAMETER FILE
                        sharedParametersFile = OpenSharedParametersFile(myCommandData.Application.Application);

                        DefinitionGroup sharedParameterDefinition = null;
                        Definition      definition = null;

                        string strTextLine = string.Empty;

                        StreamReader objReader = new System.IO.StreamReader(fullFile_Excel);
                        System.Collections.Specialized.StringCollection parameterCollection = new System.Collections.Specialized.StringCollection();

                        while (objReader.Peek() != -1)
                        {
                            strTextLine = objReader.ReadLine();

                            parameterCollection.Add(strTextLine);
                        }

                        //REVIT TRANSACTION
                        Transaction trans = new Transaction(myRevitDoc, "Create Shared Parameters");

                        trans.Start();

                        foreach (string param in parameterCollection)
                        {
                            // A, appliesTo, CATEGORY
                            // B, sharedParameterGroup, SHARED PARAMETER GROUP
                            // C, parameterDataType, DATA TYPE
                            // D, bindType, BINDING TYPE
                            // E, PARAMETER NAME

                            string        appliesTo            = string.Empty;
                            string        groupUnder           = string.Empty;
                            string        sharedParameterGroup = string.Empty;
                            ParameterType parameterDataType;
                            parameterDataType = ParameterType.Text;
                            string parameterDataType_Test = string.Empty;
                            string bindType      = string.Empty;
                            string parameterName = string.Empty;

                            char[]   chrSeparator = new char[] { ',' };
                            string[] arrValues    = param.Split(chrSeparator, StringSplitOptions.None);

                            appliesTo              = arrValues[0];
                            sharedParameterGroup   = arrValues[1];
                            parameterDataType_Test = arrValues[2];
                            bindType      = arrValues[3];
                            parameterName = arrValues[4];

                            switch (parameterDataType_Test)
                            {
                            case "Text":
                                parameterDataType = ParameterType.Text;
                                break;

                            case "Integer":
                                parameterDataType = ParameterType.Integer;
                                break;

                            case "Number":
                                parameterDataType = ParameterType.Number;
                                break;

                            case "Length":
                                parameterDataType = ParameterType.Length;
                                break;

                            case "Area":
                                parameterDataType = ParameterType.Area;
                                break;

                            case "Volume":
                                parameterDataType = ParameterType.Volume;
                                break;

                            case "Angle":
                                parameterDataType = ParameterType.Angle;
                                break;

                            case "Slope":
                                parameterDataType = ParameterType.Slope;
                                break;

                            case "Currency":
                                parameterDataType = ParameterType.Currency;
                                break;

                            case "Mass Density":
                                parameterDataType = ParameterType.MassDensity;
                                break;

                            case "URL":
                                parameterDataType = ParameterType.URL;
                                break;

                            case "Material":
                                parameterDataType = ParameterType.Material;
                                break;

                            case "Image":
                                parameterDataType = ParameterType.Image;
                                break;

                            case "Yes/No":
                                parameterDataType = ParameterType.YesNo;
                                break;

                            default:
                                parameterDataType = ParameterType.Text;
                                break;
                            }

                            sharedParameterDefinition = sharedParametersFile.Groups.get_Item(sharedParameterGroup);

                            if ((sharedParameterDefinition == null))
                            {
                                sharedParameterDefinition = sharedParametersFile.Groups.Create(sharedParameterGroup);
                            }

                            category    = myCommandData.Application.ActiveUIDocument.Document.Settings.Categories.get_Item(appliesTo);
                            categorySet = myCommandData.Application.Application.Create.NewCategorySet();
                            categorySet.Insert(category);
                            instanceBinding = myCommandData.Application.Application.Create.NewInstanceBinding(categorySet);
                            typeBinding     = myCommandData.Application.Application.Create.NewTypeBinding(categorySet);

                            if ((parameterName != null))
                            {
                                definition = OpenDefinition(sharedParameterDefinition, parameterName, parameterDataType);
                            }

                            if (insertIntoProjectParameters)
                            {
                                if (bindType == "Type")
                                {
                                    bindingMap.Insert(definition, typeBinding, BuiltInParameterGroup.PG_DATA);
                                }
                                else
                                {
                                    bindingMap.Insert(definition, instanceBinding, BuiltInParameterGroup.PG_DATA);
                                }
                            }
                        }

                        //END REVIT TRANSACTION
                        trans.Commit();

                        objReader.Close();

                        TaskDialog.Show("File Created Sucessfully", "The Shared Parameter file was created successfully");
                    }
                    catch (Exception ex)
                    {
                        TaskDialog errorMessage = new TaskDialog("Create Shared Parameter Error");
                        errorMessage.MainInstruction = "An error occurrued while creating the Shared Parameter file." + "\n" + "Please read the following error message below";
                        errorMessage.MainContent     = ex.Message + Environment.NewLine + ex.Source;
                        errorMessage.Show();
                    }
                }
            }
        }
Пример #49
0
        public Result Execute(ExternalCommandData commandData,
                              ref string message, ElementSet elements)
        {
            Tracer.Listeners.Add(new
                                 System.Diagnostics.EventLogTraceListener("Application"));

            UIDocument uidoc = commandData.Application.ActiveUIDocument;
            Document   doc   = uidoc.Document;

            RebarsMarkerWnd wnd = null;

            try
            {
                // Get all the necessary particulars about partitions and
                // host marks from the repository
                Schema schema = ExtensibleStorageUtils
                                .GetSchema(UpdateRepository.SCHEMA_GUID);
                if (schema == null)
                {
                    TaskDialog.Show("Warning",
                                    "No repository exists. " +
                                    "Please generate one before proceeding with this command.");
                    return(Result.Cancelled);
                }

                // Dig up the data storage element
                Autodesk.Revit.DB.ExtensibleStorage.DataStorage ds =
                    ExtensibleStorageUtils.GetDataStorage(doc, UpdateRepository.DATA_STORAGE_NAME);
                if (ds == null)
                {
                    TaskDialog.Show("Warning", "No data storage element. " +
                                    "Please update the repository.");
                    return(Result.Cancelled);
                }

                // Retrieve host marks grouped by partition
                IDictionary <string, ISet <string> > partsHostMarks =
                    ExtensibleStorageUtils.GetValues(
                        schema,
                        ds,
                        UpdateRepository.FN_PARTS_HOST_MARKS);

                if (partsHostMarks.Keys.Count == 0)
                {
                    TaskDialog.Show("Warning",
                                    "No rebars to mark have been bagged.");
                    return(Result.Cancelled);
                }

                // Get hold of all assemblies grouped by host marks
                IDictionary <string, ISet <string> > hostMarksAssemblies =
                    ExtensibleStorageUtils.GetValues(
                        schema,
                        ds,
                        UpdateRepository.FN_HOST_MARKS_ASSEMBLIES);

                wnd = new RebarsMarkerWnd(partsHostMarks, hostMarksAssemblies);


                wnd.OkClicked += (sender, args) =>
                {
                    IList <FamilyInstance> filteredRebars = null;

                    if (args.Assemblies.Count == 0)
                    {
                        filteredRebars =
                            //GetRebarsNotInAssemblyByPartitionHostMark(
                            //    doc,
                            //    args.Partition,
                            //    args.HostMark);
                            RebarsUtils.GetAllRebars(
                                doc,
                                args.Partition,
                                args.HostMark)
                            .Cast <FamilyInstance>()
                            .ToList();
                    }
                    else
                    {
                        filteredRebars =
                            //GetRebarsByPartitionHostMarkAssembly(
                            //    doc,
                            //    args.Partition,
                            //    args.HostMark,
                            //    args.Assemblies.ElementAt(i));
                            RebarsUtils.GetAllRebars(
                                doc,
                                args.Partition,
                                args.HostMark,
                                args.Assemblies.ToList())
                            .Cast <FamilyInstance>()
                            .ToList();
                    }

                    Tracer.Write("The number of rebars looked up amounts to " + filteredRebars.Count);

                    // Group the rebars into three categories and mark them
                    GroupRebars(filteredRebars);
                };
                wnd.ShowDialog();

                return(Result.Succeeded);
            }
            catch (Autodesk.Revit.Exceptions
                   .OperationCanceledException)
            {
                return(Result.Cancelled);
            }
            catch (System.Exception ex)
            {
                string errorMsg = string.Format("{0}\n{1}", ex.Message, ex.StackTrace);
                Tracer.Write(errorMsg);
                TaskDialog.Show("Exception", errorMsg);
                return(Result.Failed);
            }
            finally
            {
                if (wnd != null)
                {
                    wnd.Close();
                }
            }
        }
Пример #50
0
        /// <summary>
        ///   The top method of the event handler.
        /// </summary>
        /// <remarks>
        ///   This is called by Revit after the corresponding
        ///   external event was raised (by the modeless form)
        ///   and Revit reached the time at which it could call
        ///   the event's handler (i.e. this object)
        /// </remarks>
        ///
        public void Execute(UIApplication uiapp)
        {
            try
            {
                switch (Request.Take()) //空闲处理程序调用它来获取最新的请求
                {
                case RequestId.None:    //直接调用的RequestID的枚举数据
                {
                    return;             // no request at this time -> we can leave immediately
                }

                case RequestId.Delete:
                {
                    TaskDialog.Show("Revit2020", "Delete");
                    break;
                }

                case RequestId.FlipLeftRight:
                {
                    TaskDialog.Show("Revit2020", "FlipLeftRight");
                    break;
                }

                case RequestId.FlipInOut:
                {
                    TaskDialog.Show("Revit2020", "FlipInOut");
                    break;
                }

                case RequestId.MakeLeft:
                {
                    TaskDialog.Show("Revit2020", "MakeLeft");
                    break;
                }

                case RequestId.MakeRight:
                {
                    TaskDialog.Show("Revit2020", "MakeRight");
                    break;
                }

                case RequestId.TurnOut:
                {
                    TaskDialog.Show("Revit2020", "TurnOut");
                    break;
                }

                case RequestId.TurnIn:
                {
                    TaskDialog.Show("Revit2020", "TurnIn");
                    break;
                }

                case RequestId.Rotate:
                {
                    TaskDialog.Show("Revit2020", "Rotate");
                    break;
                }

                default:
                {
                    // some kind of a warning here should
                    // notify us about an unexpected request
                    break;
                }
                }
            }
            finally
            {
                APP.thisApp.WakeFormUp();
            }

            return;
        }
Пример #51
0
 /// <summary>
 /// Show message box with specified string
 /// </summary>
 /// <param name="message">specified string to show</param>
 static private void ShowErrorMessage(String message)
 {
     TaskDialog.Show(Properties.Resources.ResourceManager.GetString("OperationFailed"), Properties.Resources.ResourceManager.GetString(message), TaskDialogCommonButtons.Ok);
 }
    public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
    {
        UIApplication           application = commandData.get_Application();
        Document                document    = application.get_ActiveUIDocument().get_Document();
        Selection               selection   = application.get_ActiveUIDocument().get_Selection();
        ICollection <ElementId> elementIds  = selection.GetElementIds();
        List <Element>          list        = new List <Element>();

        foreach (ElementId item in elementIds)
        {
            Element element = document.GetElement(item);
            list.Add(element);
        }
        if (list.Count > 0)
        {
            GlobolVar.G_JoinWay = "Allow";
            WF_StartEnd wF_StartEnd = new WF_StartEnd();
            wF_StartEnd.ShowDialog();
            if (GlobolVar.G_JoinStatus == -1)
            {
                return(0);
            }
            Transaction val = new Transaction(document);
            val.Start("AllowJoin");
            foreach (Element item2 in list)
            {
                if (item2.get_Category().get_Id().get_IntegerValue() == -2000011)
                {
                    try
                    {
                        FailureHandlingOptions failureHandlingOptions = val.GetFailureHandlingOptions();
                        MyFailuresPreProcessor myFailuresPreProcessor = new MyFailuresPreProcessor();
                        failureHandlingOptions.SetFailuresPreprocessor(myFailuresPreProcessor);
                        val.SetFailureHandlingOptions(failureHandlingOptions);
                        if (GlobolVar.G_JoinStatus == 0)
                        {
                            WallUtils.AllowWallJoinAtEnd(item2 as Wall, 0);
                            WallUtils.AllowWallJoinAtEnd(item2 as Wall, 1);
                        }
                        else if (GlobolVar.G_JoinStatus == 1)
                        {
                            WallUtils.AllowWallJoinAtEnd(item2 as Wall, 0);
                        }
                        else if (GlobolVar.G_JoinStatus == 2)
                        {
                            WallUtils.AllowWallJoinAtEnd(item2 as Wall, 1);
                        }
                    }
                    catch
                    {
                    }
                }
            }
            val.Commit();
        }
        else
        {
            TaskDialog.Show("Result", "None Element Selected");
        }
        return(0);
    }
Пример #53
0
        /// <summary>
        /// Validate the UI input and it will warn if there are invalid user inputs.
        /// </summary>
        /// <returns>true if all input is fine.</returns>
        bool ValidateInput()
        {
            double runWidth;

            if (!double.TryParse(runWidthTextBox.Text, out runWidth) || runWidth < 1.0e-6)
            {
                TaskDialog.Show("U-Winder Warning", "Run Width should be positive double", TaskDialogCommonButtons.Ok);
                runWidthTextBox.Focus();
                runWidthTextBox.SelectAll();
                return(false);
            }

            uint numAtStart;

            if (!uint.TryParse(numAtStartTextBox.Text, out numAtStart))
            {
                TaskDialog.Show("U-Winder Warning", "Start steps should be unsigned integer", TaskDialogCommonButtons.Ok);
                numAtStartTextBox.Focus();
                numAtStartTextBox.SelectAll();
                return(false);
            }

            uint numInMiddle;

            if (!uint.TryParse(numInMiddleTextBox.Text, out numInMiddle))
            {
                TaskDialog.Show("U-Winder Warning", "Middle steps should be unsigned integer", TaskDialogCommonButtons.Ok);
                numInMiddleTextBox.Focus();
                numInMiddleTextBox.SelectAll();
                return(false);
            }

            uint numAtEnd;

            if (!uint.TryParse(numAtEndTextBox.Text, out numAtEnd))
            {
                TaskDialog.Show("U-Winder Warning", "End steps should be unsigned integer", TaskDialogCommonButtons.Ok);
                numAtEndTextBox.Focus();
                numAtEndTextBox.SelectAll();
                return(false);
            }

            uint numInCorner1;

            if (!uint.TryParse(numInCorner1TextBox.Text, out numInCorner1) || numInCorner1 < 1)
            {
                TaskDialog.Show("U-Winder Warning", "The first corner steps should be unsigned integer and >= 1", TaskDialogCommonButtons.Ok);
                numInCorner1TextBox.Focus();
                numInCorner1TextBox.SelectAll();
                return(false);
            }

            double offsetE1;

            if (!double.TryParse(centerOffsetE1TextBox.Text, out offsetE1) || offsetE1 < 0.0)
            {
                TaskDialog.Show("U-Winder Warning", "Center offset (E1) should be non-negative double", TaskDialogCommonButtons.Ok);
                centerOffsetE1TextBox.Focus();
                centerOffsetE1TextBox.SelectAll();
                return(false);
            }

            double offsetF1;

            if (!double.TryParse(centerOffsetF1TextBox.Text, out offsetF1) || offsetF1 < 0.0)
            {
                TaskDialog.Show("U-Winder Warning", "Center offset (F1) should be non-negative double", TaskDialogCommonButtons.Ok);
                centerOffsetF1TextBox.Focus();
                centerOffsetF1TextBox.SelectAll();
                return(false);
            }

            uint numInCorner2;

            if (!uint.TryParse(numInCorner2TextBox.Text, out numInCorner2) || numInCorner2 < 1)
            {
                TaskDialog.Show("U-Winder Warning", "The second corner steps should be unsigned integer and >= 1", TaskDialogCommonButtons.Ok);
                numInCorner2TextBox.Focus();
                numInCorner2TextBox.SelectAll();
                return(false);
            }

            double offsetE2;

            if (!double.TryParse(centerOffsetE2TextBox.Text, out offsetE2) || offsetE2 < 0.0)
            {
                TaskDialog.Show("U-Winder Warning", "Center offset (E2) should be non-negative double", TaskDialogCommonButtons.Ok);
                centerOffsetE2TextBox.Focus();
                centerOffsetE2TextBox.SelectAll();
                return(false);
            }

            double offsetF2;

            if (!double.TryParse(centerOffsetF2TextBox.Text, out offsetF2) || offsetF2 < 0.0)
            {
                TaskDialog.Show("U-Winder Warning", "Center offset (F2) should be non-negative double", TaskDialogCommonButtons.Ok);
                centerOffsetF2TextBox.Focus();
                centerOffsetF2TextBox.SelectAll();
                return(false);
            }

            return(true);
        }
Пример #54
0
 public static void InfoMsg(string msg)
 {
     Debug.WriteLine(msg);
     TaskDialog.Show(_caption + "information", msg);
 }
Пример #55
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            var tol = commandData.Application.Application.ShortCurveTolerance;
            var doc = commandData.Application.ActiveUIDocument.Document;

            _app = commandData.Application.Application;
            _app.DocumentChanged += App_DocumentChanged;
            //var point1 = new XYZ(2, 0, 0);
            //var point2 = new XYZ(0, 2, 0);
            //var point3 = new XYZ(3, 3, 0);
            //var line1 = Line.CreateBound(point1, point2);
            //var line2 = Line.CreateBound(XYZ.Zero, point3);
            //IntersectionResultArray results;
            //var result = line1.Intersect(line2, out results);
            //if(result==SetComparisonResult.Overlap)
            //{
            //    var point = results.get_Item(0).XYZPoint;
            //    TaskDialog.Show("BIMBOX", point.ToString());
            //}
            var point1    = new XYZ(0, 0, 0);
            var point2    = new XYZ(5, 0, 0);
            var point3    = new XYZ(5, 8, 0);
            var point4    = new XYZ(0, 8, 0);
            var line1     = Line.CreateBound(point1, point2);
            var line2     = Line.CreateBound(point2, point3);
            var line3     = Line.CreateBound(point3, point4);
            var line4     = Line.CreateBound(point4, point1);
            var curveLoop = new CurveLoop();

            curveLoop.Append(line1);
            curveLoop.Append(line2);
            curveLoop.Append(line3);
            curveLoop.Append(line4);

            var transform = Transform.CreateTranslation(new XYZ(5, 5, 0));

            curveLoop.Transform(transform);
            var solid = GeometryCreationUtilities.CreateExtrusionGeometry(new List <CurveLoop> {
                curveLoop
            }, XYZ.BasisZ, 10);
            var transaction = new Transaction(doc, "GeometryCreation");

            transaction.Start();
            var shape = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_GenericModel));

            shape.SetShape(new GeometryObject[] { solid });

            var schema = Schema.Lookup(_schemaGuid);

            if (schema == null)
            {
                var schemaBuilder = new SchemaBuilder(_schemaGuid);
                schemaBuilder.SetReadAccessLevel(AccessLevel.Public);
                schemaBuilder.SetWriteAccessLevel(AccessLevel.Public);
                schemaBuilder.SetSchemaName("BIMBOX");
                schemaBuilder.SetDocumentation("UniqueFlag");
                var filedBuidler = schemaBuilder.AddSimpleField("Name", typeof(string));
                schema = schemaBuilder.Finish();
            }


            var entity = new Entity(schema);
            var name   = schema.GetField("Name");

            entity.Set(name, "Kevin");
            shape.SetEntity(entity);

            var dataStorageList = from element in new FilteredElementCollector(doc).OfClass(typeof(DataStorage)) let storage = element as DataStorage where storage.GetEntitySchemaGuids().Contains(_schemaGuid) select storage;
            var dataStorage     = dataStorageList.FirstOrDefault();

            if (dataStorage == null)
            {
                dataStorage = DataStorage.Create(doc);
            }
            dataStorage.SetEntity(entity);

            var dataEntity = dataStorage.GetEntity(schema);
            var field      = dataEntity.Schema.GetField("Name");
            var result     = dataEntity.Get <string>(field);

            TaskDialog.Show("BIMBOX", "名字叫:" + result);



            transaction.Commit();



            return(Result.Succeeded);
        }
Пример #56
0
 public static void WarningMsg(string msg)
 {
     Debug.WriteLine(msg);
     TaskDialog.Show(_caption + "warning", msg);
 }
Пример #57
0
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            // Get access to the top most objects. (we may not use them all in this specific lab.)
            _uiApp = commandData.Application;
            _uiDoc = _uiApp.ActiveUIDocument;

            // (1) pre-seleceted element is under UIDocument.Selection.Elemens. Classic method.
            // You can also modify this selection set.

            //SelElementSet selSet = _uiDoc.Selection.Elements;
            //ShowElementList(selectedElementIds, "Pre-selection: ");

            // 'Autodesk.Revit.UI.Selection.SelElementSet' is obsolete:
            // 'This class is deprecated in Revit 2015. Use Selection.SetElementIds()
            // and Selection.GetElementIds() instead.'

            // 'Autodesk.Revit.UI.Selection.Selection.Elements' is obsolete:
            // 'This property is deprecated in Revit 2015.
            // Use GetElementIds() and SetElementIds instead.'

            /// Following part is modified code for Revit 2015
            ///

            ICollection <ElementId> selectedElementIds = _uiDoc.Selection.GetElementIds();

            // Display current number of selected elements
            TaskDialog.Show("Revit", "Number of selected elements: " + selectedElementIds.Count.ToString());

            // We need to re-write the following function

            ShowElementList(selectedElementIds, "Pre-selection: ");


            /// End of modified code for Revit 2015



            try
            {
                // (2.1) pick methods basics.
                // there are four types of pick methods: PickObject, PickObjects, PickElementByRectangle, PickPoint.
                // Let's quickly try them out.

                PickMethodsBasics();

                // (2.2) selection object type
                // in addition to selecting objects of type Element, the user can pick faces, edges, and point on element.

                PickFaceEdgePoint();

                // (2.3) selection filter
                // if you want additional selection criteria, such as only to pick a wall, you can use selection filter.

                ApplySelectionFilter();
            }
            catch (Autodesk.Revit.Exceptions.OperationCanceledException)
            {
                TaskDialog.Show("UI selection", "You have canceled selection.");
            }
            catch (Exception)
            {
                TaskDialog.Show("UI selection", "Some other exception caught in CancelSelection()");
            }

            // (2.4) canceling selection
            // when the user cancel or press [Esc] key during the selection, OperationCanceledException will be thrown.

            CancelSelection();

            // (3) apply what we learned to our small house creation
            // we put it as a separate command. See at the bottom of the code.
            // CreateHouseUI

            return(Result.Succeeded);
        }
Пример #58
0
 public static void ErrorMsg(string msg)
 {
     Debug.WriteLine(msg);
     TaskDialog.Show(_caption + "error", msg);
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="commandData"></param>
        /// <param name="message"></param>
        /// <param name="elements"></param>
        /// <returns></returns>
        Result IExternalCommand.Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            if (!TryGetActiveDocument(commandData, out Autodesk.Revit.DB.Document docToExport))
            {
                return(Result.Failed);
            }
            if (!TryGetDefaultView(docToExport, out View viewToExport))
            {
                return(Result.Failed);
            }


            // Grab doc name
            string docName = Path.GetFileNameWithoutExtension(docToExport.Title);

            // Prep FBX export
            var vs = new ViewSet();

            vs.Insert(viewToExport);

            // Grab configuration
            var configuration = ConfigurationManager.ActiveConfiguration;

            // Create a new folder for the export
            configuration.ExportFilePathRoot = $"C:/Cityzenith/{docName}";
            if (!Directory.Exists(configuration.ExportFilePathRoot))
            {
                Directory.CreateDirectory(configuration.ExportFilePathRoot);
            }

            // Export FBX file
            docToExport.Export(
                configuration.ExportFilePathRoot,
                docName,
                vs,
                new FBXExportOptions()
            {
                LevelsOfDetailValue  = 15,
                UseLevelsOfDetail    = true,
                WithoutBoundaryEdges = true
            }
                );



            // Check that file was created successfully
            var fbxFileName = configuration.ExportFilePathRoot + "/" + docName + ".fbx";

            if (!System.IO.File.Exists(fbxFileName))
            {
                return(Result.Failed);
            }
            var fbxModel = AssimpUtilities.LoadFbx(fbxFileName);

            // Get conversions between local ids
            var localToUniqueIdMap = docToExport.ExportableElements()
                                     .ToDictionary(e => e.Id.ToString(), e => e.UniqueId.ToString());

            // Replace auto-generated element names in Fbx with unqiue ids from revit doc
            AssimpUtilities.ReplaceNamesWithUniqueIds(fbxModel, localToUniqueIdMap);

            // Create textures subfolder
            string textureDirPath = configuration.ExportFilePathRoot + '/' + "Textures";

            if (!Directory.Exists(textureDirPath))
            {
                Directory.CreateDirectory(textureDirPath);
            }

            var bundles = MaterialUtilities.GetTextureBundles(docToExport, out var paths);

            foreach (var b in bundles)
            {
                // Create material
                var assimpMaterial = AssimpUtilities.ConvertToAssimpMaterial(b, docToExport);

                // Add material to model and assign
                AssimpUtilities.AddAndAssignMaterial(
                    fbxModel,
                    assimpMaterial,
                    docToExport.ExportableElements().Where(e =>
                {
                    var id = e.GetMaterialIds(false).FirstOrDefault();
                    if (id != null && id == b.Material.Id)
                    {
                        return(true);
                    }
                    return(false);
                })
                    .Select(e => e.UniqueId.ToString())
                    .ToHashSet()
                    , out bool utilized);

                if (!utilized)
                {
                    continue;
                }

                // Copy textures into textures folder
                foreach (var path in b.TexturePaths.Values)
                {
                    string destination = $"{textureDirPath}/{path.SafeFileName}";
                    try
                    {
                        File.Copy(path.FileLocation, destination, true);
                    }
                    catch (Exception e)
                    {
                        // This is likely due to duplicate materials copied in.
                        // This could also be an access issue, but less commonly.
                        //Logger.LogException("Error in copying textures: ", e);
                    }
                }
            }

            // Grab all element data
            var paramData = docToExport.SiphonElementParamValues(out var legend);
            var combined  = paramData.Values.Combine();

            JsonConvert.SerializeObject(combined).WriteToFile($"{configuration.ExportFilePathRoot}/Params.json");
            JsonConvert.SerializeObject(legend).WriteToFile($"{configuration.ExportFilePathRoot}/Legend.json");

            // Write out gltf
            AssimpUtilities.SaveToGltf(fbxModel, $"{configuration.ExportFilePathRoot}", docName);

            // Delete .FBX
            File.Delete(fbxFileName);

            // Let em know!
            TaskDialog dlg = new TaskDialog("Export Successful");

            dlg.MainInstruction = $"Gltf file exported successfully: \n\n {configuration.ExportFilePathRoot}";
            dlg.Show();

            Process.Start(configuration.ExportFilePathRoot);

            return(Result.Succeeded);
        }
Пример #60
0
 public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
 {
     TaskDialog.Show("关于我们", "鲸灵科技");
     return(Result.Succeeded);
 }