Пример #1
0
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                List <MapLayout> mapLayouts       = Config.MapAssociations.GetAllMaps();
                List <object>    mapLayoutChoices = new List <object>()
                {
                    "Recommended"
                };
                mapLayouts.ForEach(mapLayout => mapLayoutChoices.Add(mapLayout));

                ToolStripMenuItem itemSelectMap = new ToolStripMenuItem("Select Map");
                itemSelectMap.Click += (sender, e) =>
                {
                    SelectionForm form = new SelectionForm();
                    form.Initialize(
                        "Select a Map",
                        "Set Map",
                        mapLayoutChoices,
                        mapLayoutChoice => _mapLayoutChoice = mapLayoutChoice);
                    form.Show();
                };
                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(itemSelectMap);
            }

            return(_contextMenuStrip);
        }
        protected override ContextMenuStrip GetContextMenuStrip(MapTracker targetTracker)
        {
            if (_contextMenuStrip == null)
            {
                List <BackgroundImage> backgroundImages       = Config.MapAssociations.GetAllBackgroundImages();
                List <object>          backgroundImageChoices = new List <object>()
                {
                    "Recommended"
                };
                backgroundImages.ForEach(backgroundImage => backgroundImageChoices.Add(backgroundImage));

                ToolStripMenuItem itemSelectMap = new ToolStripMenuItem("Select Background");
                itemSelectMap.Click += (sender, e) =>
                {
                    SelectionForm form = new SelectionForm();
                    form.Initialize(
                        "Select a Background",
                        "Set Background",
                        backgroundImageChoices,
                        backgroundChoice => _backgroundChoice = backgroundChoice);
                    form.Show();
                };
                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(itemSelectMap);
            }

            return(_contextMenuStrip);
        }
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                List <BackgroundImage> backgroundImages       = Config.MapAssociations.GetAllBackgroundImages();
                List <object>          backgroundImageChoices = new List <object>()
                {
                    "Recommended"
                };
                backgroundImages.ForEach(backgroundImage => backgroundImageChoices.Add(backgroundImage));
                backgroundImageChoices.ForEach(backgroundImage => _dictionary[backgroundImage.ToString()] = backgroundImage);

                ToolStripMenuItem itemSelectMap = new ToolStripMenuItem("Select Background");
                itemSelectMap.Click += (sender, e) =>
                {
                    SelectionForm form = new SelectionForm();
                    form.Initialize(
                        "Select a Background",
                        "Set Background",
                        backgroundImageChoices,
                        backgroundChoice =>
                    {
                        MapObjectSettings settings = new MapObjectSettings(
                            changeBackground: true, newBackground: backgroundChoice.ToString());
                        GetParentMapTracker().ApplySettings(settings);
                    });
                    form.Show();
                };
                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(itemSelectMap);
            }

            return(_contextMenuStrip);
        }
Пример #4
0
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                List <MapLayout> mapLayouts       = Config.MapAssociations.GetAllMaps();
                List <object>    mapLayoutChoices = new List <object>()
                {
                    "Recommended"
                };
                mapLayouts.ForEach(mapLayout => mapLayoutChoices.Add(mapLayout));
                mapLayoutChoices.ForEach(mapLayout => _dictionary[mapLayout.ToString()] = mapLayout);

                ToolStripMenuItem itemSelectMap = new ToolStripMenuItem("Select Level");
                itemSelectMap.Click += (sender, e) =>
                {
                    SelectionForm form = new SelectionForm();
                    form.Initialize(
                        "Select a Level",
                        "Set Level",
                        mapLayoutChoices,
                        mapLayoutChoice =>
                    {
                        MapObjectSettings settings = new MapObjectSettings(
                            changeMap: true, newMap: mapLayoutChoice.ToString());
                        GetParentMapTracker().ApplySettings(settings);
                    });
                    form.Show();
                };
                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(itemSelectMap);
            }

            return(_contextMenuStrip);
        }
Пример #5
0
        public Autodesk.Revit.UI.Result Execute(ExternalCommandData revit,
                                                ref string message, ElementSet elements)
        {
            UIApplication uiapp = revit.Application;
            UIDocument    uidoc = uiapp.ActiveUIDocument;

            Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;
            Document doc = uidoc.Document;


            FormCollection fc = Application.OpenForms;

            foreach (System.Windows.Forms.Form frm in fc) //tries looking for the Open Form to get the spline from
            {
                if (frm.Name == "SelectionForm")
                {
                    isFormOpen = true;
                }
            }

            if (isFormOpen == false)
            {
                isFormOpen = true;

                SelectionForm form = new SelectionForm(uidoc);

                form.FormBorderStyle = FormBorderStyle.FixedDialog;
                form.MaximizeBox     = false;
                form.MinimizeBox     = false;
                form.StartPosition   = FormStartPosition.CenterScreen;

                form.Show();
            }
            else
            {
                MessageBox.Show("Form Already Open, Please Close Previous Instance", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }



            /*
             * ReferenceArray ra = new ReferenceArray();
             * ISelectionFilter selFilter = new DetailLineFilter();
             *
             * try
             * {
             *  splineRefrence = uidoc.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element, selFilter);
             *  selectedSpline = uidoc.Document.GetElement(splineRefrence.ElementId);
             *  RenumberSplineForm form = new RenumberSplineForm(uidoc,selectedSpline);
             *  form.ShowDialog();
             *
             *  form.Dispose();
             * }
             * catch(Exception ex)
             * {
             *  TaskDialog.Show("Error", ex.Message);
             * }
             */



            return(Result.Succeeded);
        }