예제 #1
0
        public static void Show()
        {
            if (Tools.paletteSet == null || Tools.paletteSet.IsDisposed)
            {
                try
                {
                    List <ConfigClass> list = Tools.LoadConfigXml("Config.xml");
                    string             text = Tools.GetElementValueFromXML("Title", "Config.xml") ?? "迷你&源泉";
                    bool flag;
                    bool.TryParse(Tools.GetElementValueFromXML("AutoLoad", "Config.xml"), out flag);
                    bool autoRollUp;
                    bool.TryParse(Tools.GetElementValueFromXML("AutoRollUp", "Config.xml"), out autoRollUp);
                    int num;
                    int.TryParse(Tools.GetElementValueFromXML("Height", "Config.xml"), out num);
                    int num2;
                    int.TryParse(Tools.GetElementValueFromXML("Width", "Config.xml"), out num2);
                    string text2 = Tools.GetElementValueFromXML("DockSides", "Config.xml").ToLower();
                    if (flag)
                    {
                        RegeditHelper.RegisterScreenMenu();
                        Tools.PrintCommandLine("\n******屏幕菜单已跟随ACAD启动时自动启用.*****\n");
                    }
                    else
                    {
                        RegeditHelper.UnregisterScreenMenu();
                    }
                    DockSides dock;
                    if (text2 != null)
                    {
                        if (text2 == "left")
                        {
                            dock = 4096;
                            goto IL_107;
                        }
                        if (text2 == "right")
                        {
                            dock = 16384;
                            goto IL_107;
                        }
                    }
                    dock = 4096;
IL_107:
                    Tools.paletteSet = new PaletteSet(text);
                    if (list != null)
                    {
                        foreach (ConfigClass configClass in list)
                        {
                            if (configClass.IsEnable)
                            {
                                if (Tools.tools == null)
                                {
                                    Tools.tools = new Tools();
                                }
                                UserControl1 controlFromXml = Tools.tools.GetControlFromXml(configClass);
                                if (controlFromXml != null)
                                {
                                    Tools.paletteSet.AddVisual(configClass.Name, controlFromXml);
                                }
                            }
                        }
                        Tools.paletteSet.MinimumSize = new System.Drawing.Size(200, 700);
                        Tools.paletteSet.Visible     = true;
                        if (num != 0 && num2 != 0)
                        {
                            WindowExtension.SetSize(Tools.paletteSet, new System.Drawing.Size(num2, num));
                        }
                        Tools.paletteSet.DockEnabled = 20480;
                        Tools.paletteSet.AutoRollUp  = autoRollUp;
                        Tools.paletteSet.Dock        = dock;
                        Tools.paletteSet.Opacity     = 80;
                        Tools.PrintCommandLine(MyConfig.CommandMessage);
                    }
                }
                catch (Exception ex)
                {
                    Tools.PrintCommandLine("屏幕菜单发生错误,错误信息:" + ex.Message + ".");
                }
            }
        }
예제 #2
0
        private void Confirm_Click(object sender, RoutedEventArgs e)
        {
            string value = "left";
            int    num;
            bool   flag = int.TryParse(this.HeightTextBox.Text, out num);
            int    num2;
            bool   flag2 = int.TryParse(this.WidthTextBox.Text, out num2);

            if (num < 700)
            {
                num = 700;
            }
            else if (num > 1400)
            {
                num = 1400;
            }
            if (num2 < 200)
            {
                num2 = 200;
            }
            else if (num2 > 800)
            {
                num2 = 800;
            }
            try
            {
                bool?isChecked = this.AutoLoadCB.IsChecked;
                bool flag3     = true;
                if (isChecked.GetValueOrDefault() == flag3 & isChecked != null)
                {
                    RegeditHelper.RegisterScreenMenu();
                }
                else
                {
                    isChecked = this.AutoLoadCB.IsChecked;
                    flag3     = false;
                    if (isChecked.GetValueOrDefault() == flag3 & isChecked != null)
                    {
                        RegeditHelper.UnregisterScreenMenu();
                    }
                }
                if (Tools.paletteSet != null)
                {
                    Tools.paletteSet.Visible = true;
                    if (flag && flag2)
                    {
                        Tools.paletteSet.Dock       = 0;
                        Tools.paletteSet.AutoRollUp = false;
                        Tools.paletteSet.Size       = new System.Drawing.Size(num2, num);
                        Tools.paletteSet.AutoRollUp = this.AutoRollUpCB.IsChecked.Value;
                        if (this.leftRB.IsChecked.Value)
                        {
                            Tools.paletteSet.Dock = 4096;
                            value = "left";
                        }
                        else
                        {
                            Tools.paletteSet.Dock = 16384;
                            value = "right";
                        }
                        Tools.paletteSet.Name = (string.IsNullOrWhiteSpace(this.title.Text) ? "迷你&源泉菜单" : this.title.Text);
                    }
                }
            }
            catch (Exception ex)
            {
                Tools.PrintCommandLine("此吸附停靠状态下,设置停靠失败.请取消吸附状态后再试。\n" + ex.Message + "\n");
            }
            finally
            {
                Tools.SaveConfigToXml("Config.xml", "Title", string.IsNullOrWhiteSpace(this.title.Text) ? "迷你&源泉菜单" : this.title.Text);
                Tools.SaveConfigToXml("Config.xml", "AutoLoad", this.AutoLoadCB.IsChecked.ToString());
                Tools.SaveConfigToXml("Config.xml", "AutoRollUp", this.AutoRollUpCB.IsChecked.ToString());
                Tools.SaveConfigToXml("Config.xml", "Height", num.ToString());
                Tools.SaveConfigToXml("Config.xml", "Width", num2.ToString());
                Tools.SaveConfigToXml("Config.xml", "DockSides", value);
                base.Close();
            }
        }