Ejemplo n.º 1
0
        public static void CreateUI()
        {
            //Create the main UI
            RibbonTab jppTab = CreateTab();

            CreateCoreMenu(jppTab);

            //Create settings window
            //TODO: move common window creation code to utilities method
            _settingsWindow = new PaletteSet("JPP", new Guid("9dc86012-b4b2-49dd-81e2-ba3f84fdf7e3"))
            {
                Size  = new Size(600, 800),
                Style = (PaletteSetStyles)((int)PaletteSetStyles.ShowAutoHideButton +
                                           (int)PaletteSetStyles.ShowCloseButton),
                DockEnabled = (DockSides)((int)DockSides.Left + (int)DockSides.Right)
            };

            ElementHost settingsWindowHost = new ElementHost();

            settingsWindowHost.AutoSize = true;
            settingsWindowHost.Dock     = DockStyle.Fill;
            settingsWindowHost.Child    = new SettingsUserControl();
            _settingsWindow.Add("Settings", settingsWindowHost);
            _settingsWindow.KeepFocus = false;

            //Check for registry key for autoload
            if (!RegistryHelper.IsAutoload())
            {
                //No autoload found
                //TODO: try to condense this into a helper method
                TaskDialog autoloadPrompt = new TaskDialog();
                autoloadPrompt.WindowTitle     = Resources.Core_FriendlyName;
                autoloadPrompt.MainInstruction = Resources.Core_Autoload_QueryEnable;
                autoloadPrompt.MainIcon        = TaskDialogIcon.Information;
                autoloadPrompt.FooterText      = Resources.Core_Autoload_Warn;
                autoloadPrompt.FooterIcon      = TaskDialogIcon.Warning;
                autoloadPrompt.Buttons.Add(new TaskDialogButton(0, Resources.Core_Autoload_Skip));
                autoloadPrompt.Buttons.Add(new TaskDialogButton(1, Resources.Core_Autoload_Enable));
                autoloadPrompt.DefaultButton = 0;
                autoloadPrompt.Callback      = delegate(ActiveTaskDialog atd, TaskDialogCallbackArgs e, object sender)
                {
                    if (e.Notification != TaskDialogNotification.ButtonClicked)
                    {
                        return(false);
                    }
                    if (e.ButtonId == 1)
                    {
                        //TODO: Disable when registry is ok
                        //RegistryHelper.CreateAutoload();
                        Autodesk.AutoCAD.ApplicationServices.Core.Application.ShowAlertDialog(
                            "Autload creation currently disabled.");
                    }

                    return(false);
                };
                autoloadPrompt.Show(Autodesk.AutoCAD.ApplicationServices.Core.Application.MainWindow.Handle);
            }

            //Load click handler;
            _clickOverride = ClickOverride.Current;
        }