Example #1
0
 public void commandmanager()
 {
     Commands.current_ = this;
     try
     {
         if (Commands.firstInvoke_)
         {
             this.LoadExtensions();
             Commands.firstInvoke_ = false;
         }
         try
         {
             Application.DocumentManager.MdiActiveDocument.TransactionManager.EnableGraphicsFlush(true);
         }
         catch (Exception ex)
         {
             if (ex.ErrorStatus != ErrorStatus.LockViolation)
             {
                 throw ex;
             }
         }
         int num = int.Parse(Application.GetSystemVariable("CMDACTIVE").ToString());
         if ((num & 3) == 3 || (num & 36) != 0)
         {
             string sStatusString = Autodesk.AutoCAD.Internal.Utils.GetCommandAtLevelForDocument(1);
             if (!sStatusString.Equals(""))
             {
                 sStatusString = ResHandler.GetResStringByName("#Active Command:") + " " + sStatusString.ToUpper();
             }
             //CalcResult calcResult = QCalcApplication.ShowModalCalculator(sStatusString, "0", true);
             //if (!((DisposableWrapper)calcResult != (DisposableWrapper)null))
             //    return;
             //string message = calcResult.ResultString.Replace(" ", "-");
             //if (calcResult.Type == ValueTypeEnum.VectorType)
             //    Autodesk.AutoCAD.Internal.Utils.WriteToCommandLine(message + " ");
             //else
             //    Autodesk.AutoCAD.Internal.Utils.WriteToCommandLine(message);
             Autodesk.AutoCAD.Internal.Utils.WriteToCommandLine("CE");
         }
         else
         {
             //Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\nEnesyCAD version " + CMNApplication.CurrentVersion);
             CMNApplication.ShowESWCmn();
         }
     }
     catch
     {
     }
     finally
     {
         Commands.current_ = null;
     }
 }
Example #2
0
 public void qcclose()
 {
     Commands.current_ = this;
     try
     {
         CMNApplication.HideESWCmn(true);
     }
     finally
     {
         Commands.current_ = null;
     }
 }
Example #3
0
        public static void Changelanguage()
        {
            Document activeDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            Database db        = activeDoc.Database;
            Editor   ed        = activeDoc.Editor;

            PromptKeywordOptions pko = new PromptKeywordOptions("\n" + CommandStringResources.ResourceManager.GetString("ChangeLanguageMessage", GLOBAL.CurrentCulture));

            pko.Keywords.Add("English");
            pko.Keywords.Add("Vietnamese");
            pko.Keywords.Default = "English";

            PromptResult pr = ed.GetKeywords(pko);

            if (pr.Status == PromptStatus.OK)
            {
                switch (pr.StringResult)
                {
                case "English":
                    Language = EnesyCAD.Language.English;
                    break;

                case "Vietnamese":
                    Language = EnesyCAD.Language.Vietnamese;
                    break;

                default:
                    break;
                }
                // reload UI for command list
                // no need to reload Command Manager UI
                if (CMNApplication.ESWCmn != null)
                {
                    if (CMNApplication.ESWCmn.ESW.Visible)
                    {
                        CMNApplication.ShowESWCmn();
                        CMNApplication.ESWCmn.CmnControl.ReloadUILanguage();
                    }
                }
            }
        }
        public void Active()
        {
            if (MyControl == null)
            {
                return;
            }


            if (!string.IsNullOrEmpty(MyPaletteHeader))
            {
                CMNApplication.ShowESWCmn();
                //add toolbar
                Panel masterPanel = new Panel()
                {
                    Dock = DockStyle.Fill
                };

                mToolbar = new ToolBar()
                {
                    ImageList      = new ImageList(),
                    Location       = new Point(20, 20),
                    Appearance     = ToolBarAppearance.Flat,
                    ButtonSize     = new Size(16, 16),
                    Divider        = false,
                    Dock           = DockStyle.Top,
                    DropDownArrows = true,
                };

                object obj = GlobalResource.ResourceManager.GetObject("gtk_cancel");
                if (obj != null)
                {
                    if (obj is Bitmap)
                    {
                        this.mToolbar.ImageList.Images.Add((System.Drawing.Image)obj, Color.Magenta);
                    }
                    else
                    {
                        this.mToolbar.ImageList.Images.Add((Icon)obj);
                    }
                }

                ToolBarButton closeButton = new ToolBarButton()
                {
                    ImageIndex = 0, ToolTipText = "Close", Tag = "CLOSE"
                };
                mToolbar.Buttons.Add(closeButton);
                mToolbar.ButtonClick += mToolbar_ButtonClick;
                SplitContainer sc = new SplitContainer()
                {
                    Orientation      = Orientation.Horizontal,
                    IsSplitterFixed  = true,
                    FixedPanel       = FixedPanel.Panel1,
                    SplitterDistance = 20,
                    Dock             = DockStyle.Fill
                };
                sc.Panel1.Controls.Add(mToolbar);
                MyControl.Dock = DockStyle.Fill;
                masterPanel.Controls.Add(MyControl);

                sc.Panel2.Controls.Add(masterPanel);
                List <string> paletteNames = new List <string>();
                for (int i = 0; i < CMNApplication.ESWCmn.ESW.Count; i++)
                {
                    paletteNames.Add(CMNApplication.ESWCmn.ESW[i].Name);
                }

                if (!paletteNames.Contains(this.MyPaletteHeader))
                {
                    CMNApplication.ESWCmn.Add(MyPaletteHeader, sc);
                }
                for (int i = 0; i < CMNApplication.ESWCmn.ESW.Count; i++)
                {
                    if (CMNApplication.ESWCmn.ESW[i].Name == this.MyPaletteHeader)
                    {
                        CMNApplication.ESWCmn.ESW.Activate(i);
                        return;
                    }
                }
            }
        }