Exemplo n.º 1
0
        private void MakeTree()
        {
            PlugInManager compManager = new PlugInManager();

            if (_type == RendererType.featureRenderer)
            {
                foreach (XmlNode xmlnode in compManager.GetPluginNodes(Plugins.Type.IFeatureRenderer))
                {
                    IFeatureRenderer renderer = (IFeatureRenderer)compManager.CreateInstance(xmlnode);
                    if (renderer == null || !renderer.CanRender(_layer, null))
                    {
                        continue;
                    }

                    TreeNode parent = null;
                    foreach (TreeNode cat in tvRenderer.Nodes)
                    {
                        if (cat.Text == renderer.Category)
                        {
                            parent = cat;
                            break;
                        }
                    }
                    if (parent == null)
                    {
                        parent = new TreeNode(renderer.Category);
                        tvRenderer.Nodes.Add(parent);
                    }

                    TreeNode rNode = new RendererNode(renderer);
                    parent.Nodes.Add(rNode);
                }
            }
            else if (_type == RendererType.labelRenderer)
            {
                TreeNode parent = new TreeNode("Label Renderers");
                foreach (XmlNode xmlnode in compManager.GetPluginNodes(Plugins.Type.ILabelRenderer))
                {
                    ILabelRenderer renderer = (ILabelRenderer)compManager.CreateInstance(xmlnode);
                    if (renderer == null || !renderer.CanRender(_layer, null))
                    {
                        continue;
                    }

                    parent.Nodes.Add(new LabelRendererNode(renderer));
                }
                tvRenderer.Nodes.Add(parent);
            }

            foreach (TreeNode parent in tvRenderer.Nodes)
            {
                parent.Expand();
            }
        }
        public AdditionalFieldsControl()
        {
            InitializeComponent();

            PlugInManager compMan    = new PlugInManager();
            var           autoFields = compMan.GetPluginNodes(Plugins.Type.IAutoField);

            if (autoFields != null)
            {
                tablePanel.RowCount = autoFields.Count();
                tablePanel.Height   = autoFields.Count() * 25;
                tablePanel.Resize  += new EventHandler(tablePanel_Resize);

                int row = 0;
                foreach (XmlNode comp in autoFields)
                {
                    IAutoField aField = compMan.CreateInstance(comp) as IAutoField;
                    if (aField == null)
                    {
                        continue;
                    }

                    TextBox           box      = new TextBox();
                    AutoFieldCheckBox checkBox = new AutoFieldCheckBox(aField, box);

                    box.Text = aField.AutoFieldPrimayName;

                    tablePanel.Controls.Add(checkBox, 0, row);
                    tablePanel.Controls.Add(box, 1, row++);
                }
            }
        }
Exemplo n.º 3
0
        public void Init(int port)
        {
            _serverConfig = MapServerConfig.ServerByPort(port);

            if (_interpreters.Keys.Count == 0)
            {
                List <IServiceRequestInterpreter> interpreters = new List <IServiceRequestInterpreter>();
                PlugInManager compMan = new PlugInManager();
                foreach (XmlNode interpreterNode in compMan.GetPluginNodes(Plugins.Type.IServiceRequestInterpreter))
                {
                    IServiceRequestInterpreter interpreter = compMan.CreateInstance(interpreterNode) as IServiceRequestInterpreter;
                    if (interpreter == null)
                    {
                        continue;
                    }
                    interpreters.Add(interpreter);
                }
                foreach (IServiceRequestInterpreter interpreter in interpreters)
                {
                    string guid = PlugInManager.PlugInID(interpreter).ToString().ToLower();
                    string name = interpreter.IntentityName.ToLower();
                    if (_interpreters.ContainsKey(guid) || _interpreters.ContainsKey(name))
                    {
                        continue;
                    }

                    _interpreters.Add(guid, interpreter);
                    if (!String.IsNullOrEmpty(name))
                    {
                        _interpreters.Add(name, interpreter);
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void FormDomains_Load(object sender, EventArgs e)
        {
            PlugInManager compMan = new PlugInManager();

            cmbDomains.Items.Add(new DomainItem(null));
            cmbDomains.SelectedIndex = 0;

            foreach (XmlNode domainNode in compMan.GetPluginNodes(gView.Framework.system.Plugins.Type.IFieldDomain))
            {
                IFieldDomain fDomain = compMan.CreateInstance(domainNode) as IFieldDomain;
                if (fDomain == null)
                {
                    continue;
                }

                if (_domain != null && fDomain.GetType().Equals(_domain.GetType()))
                {
                    cmbDomains.Items.Add(new DomainItem(_domain));
                    cmbDomains.SelectedIndex = cmbDomains.Items.Count - 1;
                }
                else
                {
                    cmbDomains.Items.Add(new DomainItem(fDomain));
                }
            }
        }
Exemplo n.º 5
0
        public FormExplorerOptions(IMapDocument document)
        {
            InitializeComponent();

            _document = document;

            PlugInManager compMan = new PlugInManager();

            foreach (XmlNode pageNode in compMan.GetPluginNodes(Plugins.Type.IExplorerOptionPage))
            {
                IExplorerOptionPage page = compMan.CreateInstance(pageNode) as IExplorerOptionPage;
                if (page == null)
                {
                    continue;
                }

                Panel pagePanel = page.OptionPage();
                if (pagePanel == null)
                {
                    continue;
                }

                TabPage tabPage = new TabPage(page.Title);
                tabPage.Controls.Add(pagePanel);

                if (page.Image != null)
                {
                    imageList1.Images.Add(page.Image);
                    tabPage.ImageIndex = imageList1.Images.Count - 1;
                }

                tabControl.TabPages.Add(tabPage);
                _optionPages.Add(page);
            }
        }
        public NetworkEdgeWeightsControl(IFeatureDataset dataset, SelectFeatureclassesControl selected)
        {
            InitializeComponent();

            if (dataset != null)
            {
                _database = dataset.Database as IFeatureDatabase3;
            }

            if (_database == null)
            {
                throw new ArgumentException();
            }

            _selected = selected;

            PlugInManager pluginMan = new PlugInManager();

            foreach (XmlNode calcNode in pluginMan.GetPluginNodes(Plugins.Type.ISimpleNumberCalculation))
            {
                ISimpleNumberCalculation calc = pluginMan.CreateInstance(calcNode) as ISimpleNumberCalculation;
                if (calc == null)
                {
                    continue;
                }

                _calculators.Add(calc);
            }
        }
Exemplo n.º 7
0
        public void AppendContextMenuItems(System.Windows.Forms.ContextMenuStrip strip, object context)
        {
            PlugInManager compMan = new PlugInManager();

            List<IOrder> items = new List<IOrder>();
            foreach (XmlNode toolNode in compMan.GetPluginNodes(Plugins.Type.IExTool))
            {
                IContextMenuItem item = compMan.CreateInstance(toolNode) as IContextMenuItem;
                if (item == null || !item.ShowWith(context) || !(item is IExTool)) continue;

                ((IExTool)item).OnCreate(_application);
                items.Add(item);
            }

            items.Sort(new SortByIOrder());

            int l = -1;
            foreach (IContextMenuItem item in items)
            {
                if (Math.Abs(l - (int)(item.SortOrder / 10)) != 0)
                {
                    l = item.SortOrder / 10;
                    if (strip.Items.Count > 0)
                        strip.Items.Add(new System.Windows.Forms.ToolStripSeparator());
                }
                ToolMenuItem toolItem = new ToolMenuItem(item as IExTool);
                toolItem.Click += new EventHandler(ToolButton_Click);
                strip.Items.Add(toolItem);
            }
        }
Exemplo n.º 8
0
        private void tree_NodeSelected(System.Windows.Forms.TreeNode node)
        {
            if (_toolStripAddress == null) return;
            if (node is ExplorerObjectNode && ((ExplorerObjectNode)node).ExplorerObject != null)
            {
                RemovePathButtons();

                IExplorerObject pathObject = ((ExplorerObjectNode)node).ExplorerObject;
                while (pathObject != null)
                {
                    if (pathObject is IExplorerParentObject)
                        _toolStripAddress.Items.Insert(0, new SubPathParentToolStripItem(this, (IExplorerParentObject)pathObject));

                    SubPathToolStripItem item = new SubPathToolStripItem(pathObject);
                    item.Click += new EventHandler(SubPathItem_Click);
                    _toolStripAddress.Items.Insert(0, item);

                    pathObject = pathObject.ParentExplorerObject;
                }

                _selected.Clear();
                _selected.Add(_exObject = ((ExplorerObjectNode)node).ExplorerObject);

                ViewTabPages(_exObject);

                if (_createNewRibbonGroupBox != null)
                {
                    RemoveCreateNewButtons();
                    PlugInManager compMan = new PlugInManager();
                    foreach (XmlNode compNode in compMan.GetPluginNodes(Plugins.Type.IExplorerObject))
                    {
                        IExplorerObject ex = compMan.CreateInstance(compNode) as IExplorerObject;
                        if (ex is IExplorerObjectCreatable)
                        {
                            if (!((IExplorerObjectCreatable)ex).CanCreate(_exObject)) continue;

                            //if (_toolStripCreateNew.Items.Count == 0)
                            //{
                            //    _toolStripCreateNew.Items.Add(new System.Windows.Forms.ToolStripLabel(gView.Framework.Globalisation.LocalizedResources.GetResString("Create.New", "Create new") + ":"));
                            //}

                            CreateNewToolStripItem createNewItem = new CreateNewToolStripItem(ex);
                            createNewItem.Click += createNewItem_Click;
                            _createNewRibbonGroupBox.Items.Add(createNewItem);
                        }
                    }
                    if (_createNewRibbonGroupBox.Items.Count > 0)
                        _createNewRibbonGroupBox.Visibility = Visibility.Visible;
                }
            }
            else
            {
                RemovePathButtons();
                ViewTabPages(null);
            }

            ValidateButtons();
        }
Exemplo n.º 9
0
        static public void AppendMenuItems(ContextMenuStrip strip, IExplorerObject ExplorerObject)
        {
            if (ExplorerObject == null)
            {
                return;
            }

            Guid          ExplorerObjectGUID = PlugInManager.PlugInID(ExplorerObject);
            PlugInManager compManager        = new PlugInManager();

            var commands = compManager.GetPluginNodes(Plugins.Type.IExplorerCommand);

            if (commands == null)
            {
                return;
            }

            foreach (XmlNode commandNode in commands)
            {
                try
                {
                    IExplorerCommand command = (IExplorerCommand)compManager.CreateInstance(commandNode);
                    if (command == null ||
                        (command.ExplorerObjectGUID != ExplorerObjectGUID && command.ExplorerObjectGUID != KnownExplorerObjectIDs.Any))
                    {
                        continue;
                    }

                    foreach (XmlNode node in command.CommandDefs)
                    {
                        if (node.Attributes["name"] == null)
                        {
                            continue;
                        }

                        ToolStripItem item = new CommandToolStripItem(ExplorerObject, node);
                        item.Click += new EventHandler(CommandItem_Click);

                        if (strip.Items.Count == 0)
                        {
                            strip.Items.Add(new ToolStripSeparator());
                        }

                        strip.Items.Add(item);
                    }
                }
                catch
                {
                }
            }
        }
Exemplo n.º 10
0
        public void Save(IPersistStream stream)
        {
            if (_application == null) return;

            PlugInManager compMan=new PlugInManager();
            foreach (XmlNode comp in compMan.GetPluginNodes(Plugins.Type.IMapApplicationModule))
            {
                IMapApplicationModule module = _application.IMapApplicationModule(PlugInManager.Guid(comp));
                if (module is IPersistable)
                {
                    stream.Save("Module", new ModulePersist(module));
                }
            }
        }
Exemplo n.º 11
0
        public override void Refresh()
        {
            base.Refresh();

            PlugInManager compMan = new PlugInManager();

            foreach (XmlNode compNode in compMan.GetPluginNodes(Plugins.Type.IExplorerObject))
            {
                IExplorerObject exObject = compMan.CreateInstance(compNode) as IExplorerObject;
                if (!(exObject is IOgcGroupExplorerObject))
                {
                    continue;
                }

                base.AddChildObject(exObject);
            }
        }
Exemplo n.º 12
0
        private void FormAddDataset_Load(object sender, System.EventArgs e)
        {
            //if(_map==null) this.Close();

            listView1.Items.Clear();
            PlugInManager compManager = new PlugInManager();

            foreach (XmlNode node in compManager.GetPluginNodes(Plugins.Type.IDataset))
            {
                IDataset dataset = (IDataset)compManager.CreateInstance(node);
                if (dataset == null)
                {
                    continue;
                }
                listView1.Items.Add(new DatasetProviderItem(dataset));
            }
        }
Exemplo n.º 13
0
        private void MakeGUI()
        {
            cmbSymbolTypes.Items.Clear();

            if (PlugInManager.IsPlugin(_symbol))
            {
                PlugInManager compManager = new PlugInManager();

                foreach (XmlNode xmlnode in compManager.GetPluginNodes(Plugins.Type.ISymbol))
                {
                    ISymbol symbol = (ISymbol)compManager.CreateInstance(xmlnode);
                    if (symbol is SymbolCollection)
                    {
                        continue;
                    }

                    if (_symbol.GetType().Equals(symbol.GetType()))
                    {
                        symbol = _symbol;
                    }

                    if (_symbol is IPointSymbol && symbol is IPointSymbol)
                    {
                        cmbSymbolTypes.Items.Add(new SymbolItem(symbol));
                    }
                    if (_symbol is ILineSymbol && symbol is ILineSymbol)
                    {
                        cmbSymbolTypes.Items.Add(new SymbolItem(symbol));
                    }
                    if (_symbol is IFillSymbol && symbol is IFillSymbol)
                    {
                        cmbSymbolTypes.Items.Add(new SymbolItem(symbol));
                    }
                    if (_symbol is ITextSymbol && symbol is ITextSymbol)
                    {
                        ((ITextSymbol)symbol).Text = "Label";
                        cmbSymbolTypes.Items.Add(new SymbolItem(symbol));
                    }
                    if (_symbol.GetType().Equals(symbol.GetType()) &&
                        cmbSymbolTypes.Items.Count > 0)
                    {
                        cmbSymbolTypes.SelectedItem = cmbSymbolTypes.Items[cmbSymbolTypes.Items.Count - 1];
                    }
                }
            }
        }
Exemplo n.º 14
0
        public MapServerConnectionExplorerObject(IExplorerObject parent)
            : base(parent, null, 0)
        {
            List <ToolStripItem> contextItems = new List <ToolStripItem>();

            ToolStripMenuItem importItem = new ToolStripMenuItem(LocalizedResources.GetResString("Menu.Import", "Import"));

            contextItems.Add(importItem);
            ToolStripMenuItem newService = new ToolStripMenuItem(LocalizedResources.GetResString("Menu.NewServiceFromMap", "New Service From gView Map..."));

            newService.Click += new EventHandler(newService_Click);
            newService.Image  = (new MapServiceIcon()).Image;
            importItem.DropDownItems.Add(newService);

            //ToolStripMenuItem newServiceColl = new ToolStripMenuItem("New Map Service Collection ...");
            //newServiceColl.Click += new EventHandler(newServiceColl_Click);
            //importItem.DropDownItems.Add(newServiceColl);

            PlugInManager compMan = new PlugInManager();

            foreach (XmlNode serviceableDS in compMan.GetPluginNodes(Plugins.Type.IServiceableDataset))
            {
                IServiceableDataset ds = compMan.CreateInstance(serviceableDS) as IServiceableDataset;
                if (ds == null)
                {
                    return;
                }

                if (importItem.DropDownItems.Count == 1)
                {
                    importItem.DropDownItems.Add(new ToolStripSeparator());
                }

                ToolStripItem item = new ServiceableDatasetItem(this, ds);
                item.Image = (new MapServiceIcon2()).Image;
                importItem.DropDownItems.Add(item);
            }

            _contextItems = contextItems.ToArray();
        }
Exemplo n.º 15
0
        public override void Refresh()
        {
            base.Refresh();

            string[] drives = System.IO.Directory.GetLogicalDrives();

            foreach (string drive in drives)
            {
                System.IO.DriveInfo info = new System.IO.DriveInfo(drive);

                DriveObject exObject = new DriveObject(this, info.Name.Replace("\\", ""), (uint)info.DriveType);
                base.AddChildObject(exObject);
            }

            ConfigConnections           configStream       = new ConfigConnections("directories");
            Dictionary <string, string> networkDirectories = configStream.Connections;

            if (networkDirectories != null)
            {
                foreach (string dir in networkDirectories.Keys)
                {
                    MappedDriveObject exObject = new MappedDriveObject(this, networkDirectories[dir]);
                    base.AddChildObject(exObject);
                }
            }

            PlugInManager compMan = new PlugInManager();

            foreach (XmlNode exObjectNode in compMan.GetPluginNodes(Plugins.Type.IExplorerObject))
            {
                IExplorerObject exObject = (IExplorerObject)compMan.CreateInstance(exObjectNode);
                if (!(exObject is IExplorerGroupObject))
                {
                    continue;
                }

                base.AddChildObject(exObject);
            }
        }
Exemplo n.º 16
0
        public void Content_DragEnter(DragEventArgs e, IUserData userdata)
        {
            PlugInManager compMan = new PlugInManager();
            bool          found   = false;

            foreach (XmlNode dbNode in compMan.GetPluginNodes(Plugins.Type.IFileFeatureDatabase))
            {
                IFileFeatureDatabase db = compMan.CreateInstance(dbNode) as IFileFeatureDatabase;
                if (db == null)
                {
                    continue;
                }

                found = true;
            }
            if (!found)
            {
                return;
            }

            foreach (string format in e.Data.GetFormats())
            {
                object ob = e.Data.GetData(format);

                if (ob is List <IExplorerObjectSerialization> )
                {
                    foreach (IExplorerObjectSerialization ser in (List <IExplorerObjectSerialization>)ob)
                    {
                        if (ser.ObjectTypes.Contains(typeof(IFeatureDataset)) ||
                            ser.ObjectTypes.Contains(typeof(IFeatureClass)))
                        {
                            e.Effect = DragDropEffects.Copy;
                            return;
                        }
                    }
                }
            }
        }
Exemplo n.º 17
0
        virtual public void WriteMetadata(IPersistStream stream)
        {
            PlugInManager plugins = new PlugInManager();

            if (_providers != null)
            {
                foreach (IMetadataProvider provider in _providers)
                {
                    if (provider == null) continue;

                    // mit ApplyTo noch einmal das this Objekt auf den Provider 
                    // setzen, damit beim speichern immer das aktuelle Object gesetzt wird...
                    provider.ApplyTo(this);
                    stream.Save("IMetadataProvider", provider);
                }
            }
            else
            {
                _providers = new List<IMetadataProvider>();
            }

            foreach (XmlNode providerNode in plugins.GetPluginNodes(Plugins.Type.IMetadataProvider))
            {
                IMetadataProvider provider = plugins.CreateInstance(providerNode) as IMetadataProvider;
                if (provider == null) continue;

                // nach bereits vorhanden suchen...
                IMetadataProvider provider2 = this.MetadataProvider(PlugInManager.PlugInID(provider));
                if (provider2 != null)
                    continue;

                if (provider.ApplyTo(this))
                {
                    stream.Save("IMetadataProvider", provider);
                    _providers.Add(provider);
                }
            }
        }
Exemplo n.º 18
0
        public FormGeoProcessor()
        {
            InitializeComponent();

            PlugInManager compMan = new PlugInManager();

            foreach (XmlNode activityNode in compMan.GetPluginNodes(Plugins.Type.IActivity))
            {
                IActivity activity = compMan.CreateInstance(activityNode) as IActivity;
                if (activity == null)
                {
                    continue;
                }

                CategoryNode catNode = TreeCategoryNode(activity.CategoryName);
                catNode.Nodes.Add(new ActivityNode(activity));
            }

            if (tvActivity.Nodes.Count > 0)
            {
                tvActivity.Nodes[0].Expand();
            }
        }
        private void FillFormatList()
        {
            PlugInManager compMan = new PlugInManager();

            foreach (XmlNode ds in compMan.GetPluginNodes(Plugins.Type.IDataset))
            {
                IRasterFileDataset rds = compMan.CreateInstance(ds) as IRasterFileDataset;
                if (rds == null)
                {
                    continue;
                }

                foreach (string format in rds.SupportedFileFilter.Split('|'))
                {
                    if (format == String.Empty)
                    {
                        continue;
                    }

                    int priority = rds.SupportsFormat(format.Replace("*", ""));
                    //FormatListItem item = FindFormatItem(format);
                    //if (item != null)
                    //{
                    //    if (item.Priority < priority)
                    //    {
                    //        item.Provider = rds.ToString();
                    //        item.Priority = priority;
                    //    }
                    //}
                    //else
                    //{
                    //    lstFormats.Items.Add(new FormatListItem(format, rds.ToString(), priority));
                    //}
                    lstFormats.Items.Add(new FormatListItem(format, rds.ToString(), priority, PlugInManager.PlugInID(rds)));
                }
            }
        }
Exemplo n.º 20
0
        public void OnShowControl(object hook)
        {
            if (hook is IMapDocument)
            {
                tabControl.TabPages.Clear();
                _document = (IMapDocument)hook;

                PlugInManager compMan = new PlugInManager();
                foreach (XmlNode pageNode in compMan.GetPluginNodes(gView.Framework.system.Plugins.Type.IMapOptionPage))
                {
                    IMapOptionPage page = compMan.CreateInstance(pageNode) as IMapOptionPage;
                    if (page == null)
                    {
                        continue;
                    }

                    Panel pagePanel = page.OptionPage(_document);
                    if (pagePanel == null)
                    {
                        continue;
                    }

                    TabPage tabPage = new TabPage(page.Title);
                    tabPage.Controls.Add(pagePanel);

                    if (page.Image != null)
                    {
                        imageList1.Images.Add(page.Image);
                        tabPage.ImageIndex = imageList1.Images.Count - 1;
                    }

                    tabControl.TabPages.Add(tabPage);
                    _optionPages.Add(page);
                }
            }
        }
Exemplo n.º 21
0
        public void OnCreate(object hook)
        {
            if (hook is IMapDocument)
            {
                _doc    = (IMapDocument)hook;
                _module = Module.GetModule(_doc);

                PlugInManager pluginMan = new PlugInManager();
                foreach (XmlNode tracerNode in pluginMan.GetPluginNodes(gView.Framework.system.Plugins.Type.INetworkTracer))
                {
                    INetworkTracer tracer = pluginMan.CreateInstance(tracerNode) as INetworkTracer;
                    if (tracer == null)
                    {
                        continue;
                    }

                    _combo.Items.Add(new NetworkTracerItem(tracer));
                }
                if (_combo.Items.Count > 0)
                {
                    _combo.SelectedIndex = 0;
                }
            }
        }
Exemplo n.º 22
0
        private bool InsertImage(IFeatureUpdater fdb, IFeatureClass rasterFC, FileInfo fi, Dictionary <string, Guid> providers)
        {
            if (!_cancelTracker.Continue)
            {
                _errMsg = "Canceled by user...";
                return(false);
            }

            if (ReportAction != null)
            {
                ReportAction(this, "Insert Image: " + fi.FullName);
            }
            if (ReportProgress != null)
            {
                ReportProgress(this, 1);
            }

            System.Drawing.Imaging.ImageFormat format = System.Drawing.Imaging.ImageFormat.Jpeg;
            switch (fi.Extension.ToLower())
            {
            case ".png":
                format = System.Drawing.Imaging.ImageFormat.Png;
                break;

            case ".tif":
            case ".tiff":
                format = System.Drawing.Imaging.ImageFormat.Tiff;
                break;
            }

            #region RasterFileDataset bestimmen
            List <IRasterFileDataset> rFileDatasets = new List <IRasterFileDataset>();
            IRasterFileDataset        rFileDataset  = null;
            IRasterLayer  rasterLayer = null;
            PlugInManager compMan     = new PlugInManager();
            foreach (XmlNode ds in compMan.GetPluginNodes(Plugins.Type.IDataset))
            {
                IRasterFileDataset rds = compMan.CreateInstance(ds) as IRasterFileDataset;
                if (rds == null)
                {
                    continue;
                }

                if (rds.SupportsFormat(fi.Extension) < 0)
                {
                    continue;
                }
                if (providers != null && providers.ContainsKey(fi.Extension.ToLower()))
                {
                    if (!providers[fi.Extension.ToLower()].Equals(PlugInManager.PlugInID(rds)))
                    {
                        continue;
                    }
                }
                rFileDatasets.Add(rds);
            }
            if (rFileDatasets.Count == 0)
            {
                _errMsg = "No Rasterfile Provider for " + fi.Extension;
                return(false);
            }

            // RasterFileDataset nach priorität sortieren
            rFileDatasets.Sort(new RasterFileDatasetComparer(fi.Extension));

            // RasterFileDataset suchen, mit dem sich Bild öffnen läßt
            foreach (IRasterFileDataset rfd in rFileDatasets)
            {
                rfd.AddRasterFile(fi.FullName);

                if (rfd.Elements.Count == 0)
                {
                    //Console.WriteLine(_errMsg = fi.FullName + " is not a valid Raster File...");
                    continue;
                }
                IDatasetElement element = rfd.Elements[0];
                if (!(element is IRasterLayer))
                {
                    //Console.WriteLine(_errMsg = fi.FullName + " is not a valid Raster Layer...");
                    rFileDataset.Dispose();
                    continue;
                }

                // gefunden...
                rasterLayer  = (IRasterLayer)element;
                rFileDataset = rfd;
                break;
            }
            if (rasterLayer == null || rFileDataset == null)
            {
                Console.WriteLine(_errMsg = fi.FullName + " is not a valid Raster Layer...");
                return(false);
            }
            #endregion

            FileInfo fiWorld = null;
            double   cellX   = 1;
            double   cellY   = 1;

            IRasterFile rasterFile = null;
            if (rasterLayer is IRasterFile)
            {
                rasterFile = (IRasterFile)rasterLayer;
            }
            if (rasterLayer.RasterClass != null)
            {
                if (rasterLayer.RasterClass is IRasterFile &&
                    ((IRasterFile)rasterLayer.RasterClass).WorldFile != null)
                {
                    rasterFile = (IRasterFile)rasterLayer.RasterClass;
                }
                else
                {
                    IRasterClass c = (IRasterClass)rasterLayer.RasterClass;
                    cellX = Math.Sqrt(c.dx1 * c.dx1 + c.dx2 * c.dx2);
                    cellY = Math.Sqrt(c.dy1 * c.dy1 + c.dy2 * c.dy2);
                }
            }
            if (rasterFile != null)
            {
                try
                {
                    IRasterWorldFile world = rasterFile.WorldFile;
                    if (world != null)
                    {
                        if (!world.isGeoReferenced)
                        {
                            if (handleNonGeorefAsError)
                            {
                                _errMsg = "Can't add non georeferenced images: " + fi.FullName;
                                return(false);
                            }
                            else
                            {
                                return(true);
                            }
                        }

                        cellX = Math.Sqrt(world.dx_X * world.dx_X + world.dx_Y * world.dx_Y);
                        cellY = Math.Sqrt(world.dy_X * world.dy_X + world.dy_Y * world.dy_Y);

                        fiWorld = new FileInfo(rasterFile.WorldFile.Filename);
                        if (!fiWorld.Exists)
                        {
                            fiWorld = null;
                        }
                    }
                }
                catch
                {
                    fiWorld = null;
                }
            }

            #region Check if already Exits
            //
            // Suchen, ob Image mit gleichen Pfad schon vorhanden ist, wenn ja
            // nur weitermachen, wenn sich das änderungsdatum unterscheidet...
            //

            QueryFilter filter = new QueryFilter();
            filter.AddField("FDB_OID");
            filter.AddField("PATH");
            filter.AddField("LAST_MODIFIED");
            filter.AddField("PATH2");
            filter.AddField("LAST_MODIFIED2");

            string fullName = fi.FullName.Replace(@"\", @"\\");
            if (_fdb is AccessFDB)
            {
                filter.WhereClause = ((AccessFDB)_fdb).DbColName("PATH") + "='" + fullName + "'";
            }
            else
            {
                filter.WhereClause = "PATH='" + fullName + "'";
            }
            int deleteOID = -1;
            using (IFeatureCursor cursor = rasterFC.GetFeatures(filter))
            {
                IFeature existingFeature = cursor.NextFeature;
                if (existingFeature != null)
                {
                    DateTime dt1 = (DateTime)existingFeature["LAST_MODIFIED"];
                    if (Math.Abs(((TimeSpan)(dt1 - fi.LastWriteTimeUtc)).TotalSeconds) > 1.0)
                    {
                        deleteOID = existingFeature.OID;
                    }
                    else if (fiWorld != null &&
                             existingFeature["PATH2"] != System.DBNull.Value &&
                             existingFeature["PATH2"].ToString() != String.Empty)
                    {
                        DateTime dt2 = (DateTime)existingFeature["LAST_MODIFIED2"];
                        if (existingFeature["PATH2"].ToString().ToLower() != fiWorld.FullName.ToLower() ||
                            Math.Abs(((TimeSpan)(dt2 - fiWorld.LastWriteTimeUtc)).TotalSeconds) > 1.0)
                        {
                            deleteOID = existingFeature.OID;
                        }
                    }

                    if (deleteOID == -1)
                    {
                        Console.Write(".");
                        //Console.WriteLine(fi.FullName + " already exists...");
                        return(true);
                    }
                }
            }
            if (deleteOID != -1)
            {
                if (!fdb.Delete(rasterFC, deleteOID))
                {
                    Console.WriteLine(_errMsg = "Can't delete old record " + fi.FullName + "\n" + fdb.lastErrorMsg);
                    return(false);
                }
            }
            //
            ///////////////////////////////////////////////////////////////////
            //
            #endregion

            Feature feature = new Feature();
            feature.Shape = rasterLayer.RasterClass.Polygon;
            feature.Fields.Add(new FieldValue("PATH", fi.FullName));
            feature.Fields.Add(new FieldValue("LAST_MODIFIED", fi.LastWriteTimeUtc));
            if (fiWorld != null)
            {
                feature.Fields.Add(new FieldValue("PATH2", fiWorld.FullName));
                feature.Fields.Add(new FieldValue("LAST_MODIFIED2", fiWorld.LastWriteTimeUtc));
            }
            else
            {
                feature.Fields.Add(new FieldValue("PATH2", ""));
            }
            feature.Fields.Add(new FieldValue("RF_PROVIDER", PlugInManager.PlugInID(rFileDataset).ToString()));
            feature.Fields.Add(new FieldValue("MANAGED", _managed && (rasterLayer is IBitmap)));
            feature.Fields.Add(new FieldValue("FORMAT", fi.Extension.Replace(".", "")));
            feature.Fields.Add(new FieldValue("CELLX", cellX));
            feature.Fields.Add(new FieldValue("CELLY", cellY));
            feature.Fields.Add(new FieldValue("LEVELS", (_managed) ? Math.Max(_levels, 1) : 0));

            if (!fdb.Insert(rasterFC, feature))
            {
                Console.WriteLine("\nERROR@" + fi.FullName + ": " + fdb.lastErrorMsg);
            }
            else
            {
                if (_managed && (rasterLayer is IBitmap) && (fdb is SqlFDB))
                {
                    QueryFilter qfilter = new QueryFilter();
                    qfilter.SubFields = "FDB_OID";
                    if (_fdb is AccessFDB)
                    {
                        filter.WhereClause = ((AccessFDB)_fdb).DbColName("PATH") + "='" + fi.FullName + "'";
                    }
                    else
                    {
                        qfilter.WhereClause = "PATH='" + fi.FullName + "'";
                    }
                    IFeatureCursor cursor = ((SqlFDB)fdb).Query(rasterFC, qfilter);
                    if (cursor != null)
                    {
                        IFeature feat = cursor.NextFeature;
                        if (feat != null)
                        {
                            InsertImageDatasetBitmap(feat.OID, rasterLayer, _levels, format);
                        }
                        cursor.Dispose();
                    }
                }

                Console.WriteLine(">" + fi.FullName + " added...");
            }

            rFileDataset.Dispose();
            return(true);
        }
Exemplo n.º 23
0
        private ContextMenuStrip BuildContextMenu(IExplorerObject exObject, List <IExplorerObject> context, bool emptyContentsClick)
        {
            if (_strip != null && _strip.Visible == true)
            {
                _strip.Close();
            }

            _strip = contextStrip;
            for (int i = _strip.Items.Count - 1; i >= _contextItemCount; i--)
            {
                _strip.Items.RemoveAt(i);
            }

            toolStripMenuItemNew.DropDownItems.Clear();
            PlugInManager compMan = new PlugInManager();

            foreach (XmlNode compNode in compMan.GetPluginNodes(Plugins.Type.IExplorerObject))
            {
                IExplorerObject ex = compMan.CreateInstance(compNode) as IExplorerObject;
                if (ex is IExplorerObjectCreatable)
                {
                    if (!((IExplorerObjectCreatable)ex).CanCreate(_exObject))
                    {
                        continue;
                    }
                    ToolStripItem createNewItem = new CreateNewToolStripItem(ex);
                    createNewItem.Click += new EventHandler(createNewItem_Click);
                    toolStripMenuItemNew.DropDownItems.Add(createNewItem);
                }
            }
            toolStripMenuItemNew.Enabled = (toolStripMenuItemNew.DropDownItems.Count != 0);

            if (_app != null)
            {
                _app.AppendContextMenuItems(_strip, emptyContentsClick ? null : context /*this.SelectedExplorerObjects*/);
            }
            CommandInterpreter.AppendMenuItems(_strip, exObject);

            if (!emptyContentsClick)
            {
                //if (exObject is IExplorerObjectRenamable)
                //{
                //    if (_strip.Items.Count > 0) _strip.Items.Add(new ToolStripSeparator());
                //    _strip.Items.Add(_renameMenuItem);
                //}
                //if (exObject is IExplorerObjectDeletable)
                //{
                //    _strip.Items.Add(_deleteMenuItem);
                //}
            }

            if (exObject is IExplorerObjectContextMenu)
            {
                ToolStripItem[] contextItems = ((IExplorerObjectContextMenu)exObject).ContextMenuItems;
                if (contextItems != null && contextItems.Length > 0)
                {
                    _strip.Items.Add(new ToolStripSeparator());
                    foreach (ToolStripItem contextItem in contextItems)
                    {
                        _strip.Items.Add(contextItem);
                    }
                }
            }
            if (exObject is IExplorerObjectContextMenu2)
            {
                ToolStripItem[] contextItems = ((IExplorerObjectContextMenu2)exObject).ContextMenuItems(RefreshContents);
                if (contextItems != null && contextItems.Length > 0)
                {
                    _strip.Items.Add(new ToolStripSeparator());
                    foreach (ToolStripItem contextItem in contextItems)
                    {
                        _strip.Items.Add(contextItem);
                    }
                }
            }

            if (exObject != null && exObject.Object is IFeatureClass)
            {
                IFeatureClass fc = (IFeatureClass)exObject.Object;
                if (fc.Dataset != null && fc.Dataset.Database is IFeatureDatabaseReplication)
                {
                    _strip.Items.Add(new ToolStripSeparator());
                    _strip.Items.Add(_replicationMenuItem);

                    _appendReplicationIDMenuItem.Enabled = !Replication.FeatureClassHasRelicationID(fc);
                    _checkoutMenuItem.Enabled            = Replication.FeatureClassCanReplicate(fc);
                    _checkinMenuItem.Enabled             = (Replication.FeatureClassGeneration(fc) > 0);
                }
            }

            if (exObject is IMetadata)
            {
                _strip.Items.Add(new ToolStripSeparator());
                _strip.Items.Add(_metadataMenuItem);
            }

            _contextObject = exObject;
            return(_strip);
        }
Exemplo n.º 24
0
        static void Main(string[] args)
        {
            System.Net.ServicePointManager.DefaultConnectionLimit = 256;
            //System.Net.ServicePointManager.MaxServicePoints = 256;
            System.Net.ServicePointManager.CertificatePolicy = new gView.Framework.Web.SimpleHttpsPolicy();

            gView.Framework.system.gViewEnvironment.UserInteractive = false;

            //int x = 0;
            //x = 1 / x;
            try
            {
                //Thread thread = new Thread(new ThreadStart(StartThread2));
                //thread.Start();

                //gView.Framework.system.SystemVariables.ApplicationDirectory = gView.Framework.system.SystemVariables.RegistryApplicationDirectory;
                Logger.Log(loggingMethod.request, "Service EXE started...");

                bool console = false;
                int  port    = -1;

                for (int i = 0; i < args.Length; i++)
                {
                    if (args[i] == "-c")
                    {
                        console = true;
                    }
                    if (args[i] == "-port")
                    {
                        port = int.Parse(args[i + 1]);
                    }
                }
                //port = 8001;
                //console = true;

                Logger.Log(loggingMethod.request, "Current Directory: " + System.Environment.CurrentDirectory);
                //Logger.Log(loggingMethod.request, "Check license...");
                //myLicense = new License(false);

                //Logger.Log(loggingMethod.request, "License Info********");
                //Logger.Log(loggingMethod.request, "ProductID: " + myLicense.ProductID);
                //Logger.Log(loggingMethod.request, "InstallationDate: " + SystemVariables.InstallationTime.ToShortDateString() + " " + SystemVariables.InstallationTime.ToLongTimeString());
                //Logger.Log(loggingMethod.request, "LicenseFile: " + myLicense.LicenseFile);
                //Logger.Log(loggingMethod.request, "LicenseFileExists: " + myLicense.LicenseFileExists.ToString());
                //if (myLicense.LicenseComponents != null)
                //{
                //    Logger.Log(loggingMethod.request, "Components:");
                //    foreach (string component in myLicense.LicenseComponents)
                //        Logger.Log(loggingMethod.request, "   " + component);
                //}

                //LicenseTypes licType = IMS.myLicense.ComponentLicenseType("gview.Server;gview.PersonalMapServer");
                //if (licType == LicenseTypes.Unknown ||
                //    licType == LicenseTypes.Expired)
                //{
                //    Logger.Log(loggingMethod.error, "Server is not licensed...");
                //    return;
                //}
                //Logger.Log(loggingMethod.request, "********************");

                // Interpreter suchen...
                Logger.Log(loggingMethod.request, "Register request interpreters...");
                mapServer = new MapServer(port);

                /*
                 * switch (mapServer.LicType)
                 * {
                 *  case MapServer.ServerLicType.Unknown:
                 *      Logger.Log(loggingMethod.error, "Unkown License");
                 *      if (console)
                 *      {
                 *          Console.WriteLine("Unkown License...");
                 #if(DEBUG)
                 *          Console.ReadLine();
                 #endif
                 *      }
                 *      return;
                 *  case MapServer.ServerLicType.Express:
                 *  case MapServer.ServerLicType.Private:
                 *      System.Diagnostics.Process[] procs = System.Diagnostics.Process.GetProcessesByName("gview.mapserver");
                 *      if (procs.Length > 1)
                 *      {
                 *          Logger.Log(loggingMethod.error, "Your server license type '" + mapServer.LicType.ToString() + "' allows only one server instance!");
                 *          if (console)
                 *          {
                 *              Console.WriteLine("Your server license type '" + mapServer.LicType.ToString() + "' allows only one server instance!");
                 #if(DEBUG)
                 *              Console.ReadLine();
                 #endif
                 *          }
                 *          return;
                 *      }
                 *      break;
                 * }
                 * */
                PlugInManager compMan = new PlugInManager();
                foreach (XmlNode interpreterNode in compMan.GetPluginNodes(Plugins.Type.IServiceRequestInterpreter))
                {
                    IServiceRequestInterpreter interpreter = compMan.CreateInstance(interpreterNode) as IServiceRequestInterpreter;
                    if (interpreter == null)
                    {
                        continue;
                    }
                    interpreter.OnCreate(mapServer);
                    _interpreters.Add(interpreter);
                }

                try
                {
                    SetConsoleTitle("gView.MapServer.Instance." + port);
                }
                catch { }
#if (!DEBUG)
                if (console)
                {
                    //ImageService service = new ImageService();
                    //service.Start(args);

                    Console.WriteLine("Server Instance " + port + " starting...");
                    ServerProcess process = new ServerProcess(port, false);
                    Console.WriteLine("Server Instance is listing on port " + port);
                    Console.ReadLine();

                    process.Stop();
                    //service.Stop();
                }
                else
                {
                    if (port != -1)
                    {
                        Console.WriteLine("Start Server On Port: " + port);
                        ServerProcess process = new ServerProcess(port, true);
                    }

                    else
                    {
                        System.ServiceProcess.ServiceBase[] ServicesToRun;
                        ServicesToRun = new System.ServiceProcess.ServiceBase[] { new ImageService() };
                        System.ServiceProcess.ServiceBase.Run(ServicesToRun);
                    }
                }
#else
                port = (port != -1) ? port : 8001;
                Console.WriteLine("Server Instance " + port + " starting...");
                ServerProcess process = new ServerProcess(port, false);
                Console.WriteLine("Server Instance is listing on port " + port);

                Console.ReadLine();
                Console.WriteLine("Stopping Instance on port " + port);

                process.Stop();
#endif
            }
            catch (Exception ex)
            {
                Logger.Log(loggingMethod.error, ex.Message);
            }
        }
Exemplo n.º 25
0
        public void Content_DragDrop(DragEventArgs e, IUserData userdata)
        {
            PlugInManager compMan = new PlugInManager();
            List <IFileFeatureDatabase> databases = new List <IFileFeatureDatabase>();

            foreach (XmlNode dbNode in compMan.GetPluginNodes(Plugins.Type.IFileFeatureDatabase))
            {
                IFileFeatureDatabase db = compMan.CreateInstance(dbNode) as IFileFeatureDatabase;
                if (db == null)
                {
                    continue;
                }

                databases.Add(db);
            }
            if (databases.Count == 0)
            {
                return;
            }

            bool schemaOnly = false;

            if (userdata != null &&
                userdata.GetUserData("gView.Framework.UI.BaseTools.PasteSchema") != null &&
                userdata.GetUserData("gView.Framework.UI.BaseTools.PasteSchema").Equals(true))
            {
                schemaOnly = true;
            }

            foreach (string format in e.Data.GetFormats())
            {
                object ob = e.Data.GetData(format);
                if (ob is IEnumerable <IExplorerObjectSerialization> )
                {
                    ExplorerObjectManager exObjectManager = new ExplorerObjectManager();

                    List <IExplorerObject> exObjects = new List <IExplorerObject>(exObjectManager.DeserializeExplorerObject((IEnumerable <IExplorerObjectSerialization>)ob));
                    if (exObjects == null)
                    {
                        return;
                    }

                    foreach (IExplorerObject exObject in ListOperations <IExplorerObject> .Clone(exObjects))
                    {
                        IFeatureClass fc = exObject.Object as IFeatureClass;
                        if (fc == null)
                        {
                            continue;
                        }
                    }
                    if (exObjects.Count == 0)
                    {
                        return;
                    }

                    FormFeatureclassCopy dlg = new FormFeatureclassCopy(exObjects, databases, this.FullName);
                    dlg.SchemaOnly = schemaOnly;
                    if (dlg.ShowDialog() != DialogResult.OK)
                    {
                        continue;
                    }

                    if (dlg.SelectedFeatureDatabase == null)
                    {
                        return;
                    }
                    IFileFeatureDatabase fileDB = dlg.SelectedFeatureDatabase;
                    _dataset = fileDB[this.FullName];
                    if (_dataset == null)
                    {
                        return;
                    }

                    //_dataset = new ImportFeatureDataset(dlg.SelectedFeatureDatabase);

                    foreach (FeatureClassListViewItem fcItem in dlg.FeatureClassItems)
                    {
                        ImportDatasetObject(fcItem, schemaOnly);
                    }

                    exObjectManager.Dispose(); // alle ExplorerObjects wieder löschen...
                }
            }
        }
Exemplo n.º 26
0
        public void MakeRibbon()
        {
            PlugInManager pm = new PlugInManager();

            foreach (IExplorerRibbonTab exRibbonTab in OrderedPluginList<IExplorerRibbonTab>.Sort(pm.GetPluginNodes(Plugins.Type.IExplorerRibbonTab)))
            {
                Fluent.RibbonTabItem tabItem = new Fluent.RibbonTabItem();
                tabItem.Header = exRibbonTab.Header;
                ribbon.Tabs.Add(tabItem);
                tabItem.DataContext = exRibbonTab;

                foreach (RibbonGroupBox exGroupBox in exRibbonTab.Groups)
                {
                    Fluent.RibbonGroupBox groupBox = new Fluent.RibbonGroupBox();
                    groupBox.Header = exGroupBox.Header;
                    tabItem.Groups.Add(groupBox);

                    foreach (RibbonItem cartoRibbonItem in exGroupBox.Items)
                    {
                        Guid toolGUID = cartoRibbonItem.Guid;
                        if (toolGUID == new Guid("00000000-0000-0000-0000-000000000000"))
                        {
                            groupBox.Items.Add(new Separator());
                            continue;
                        }

                        object tool = pm.CreateInstance(toolGUID);
                        if (tool == null) continue;

                        #region IToolItem
                        if (tool is IToolItem)
                        {
                            if (((IToolItem)tool).ToolItem != null)
                            {
                                if (((IToolItem)tool).ToolItem is System.Windows.Forms.ToolStripItem)
                                {
                                    StackPanel panel = new StackPanel();
                                    panel.Margin = new Thickness(0, 32, 0, 0);

                                    System.Windows.Forms.ToolStripItem stripItem = (System.Windows.Forms.ToolStripItem)((IToolItem)tool).ToolItem;

                                    System.Windows.Forms.MenuStrip bar = new System.Windows.Forms.MenuStrip();
                                    bar.BackColor = System.Drawing.Color.Transparent; //.FromArgb(223, 234, 246);

                                    bar.Items.Add(stripItem);

                                    WindowsFormsHost host = new WindowsFormsHost();
                                    host.Background = new SolidColorBrush(Color.FromRgb(223, 234, 246));
                                    host.Child = bar;

                                    if (tool is IToolItemLabel)
                                    {
                                        IToolItemLabel label = (IToolItemLabel)tool;
                                        panel.Orientation = label.LabelPosition == ToolItemLabelPosition.top ||
                                                            label.LabelPosition == ToolItemLabelPosition.bottom ? Orientation.Vertical : Orientation.Horizontal;

                                        if (panel.Orientation == Orientation.Vertical)
                                            panel.Margin = new Thickness(0, 13, 0, 0);
                                        TextBlock text = new TextBlock();
                                        text.Text = label.Label;
                                        text.Padding = new Thickness(3);

                                        if (label.LabelPosition == ToolItemLabelPosition.top || label.LabelPosition == ToolItemLabelPosition.left)
                                            panel.Children.Insert(0, text);
                                        else
                                            panel.Children.Add(text);
                                    }

                                    panel.Children.Add(host);

                                    groupBox.Items.Add(panel);
                                }
                            }
                        }
                        #endregion

                        #region IToolMenu
                        else if (tool is IExToolMenu)
                        {
                            DropDownToolButton button = new DropDownToolButton(tool as IExToolMenu);
                            button.Click += new RoutedEventHandler(ToolButton_Click);
                            groupBox.Items.Add(button);
                        }
                        #endregion

                        #region ITool
                        else if (tool is IExTool)
                        {
                            ((IExTool)tool).OnCreate(_application);
                            ToolButton button = new ToolButton(tool as IExTool);
                            button.SizeDefinition = cartoRibbonItem.SizeDefinition;

                            groupBox.Items.Add(button);
                            button.Click += new RoutedEventHandler(ToolButton_Click);
                            
                        }
                        #endregion
                    }
                }

                if (ribbon.Tabs.Count == 1)
                {
                    #region Favorites
                    Fluent.RibbonGroupBox favBox = new Fluent.RibbonGroupBox();
                    favBox.Header = String.Empty;
                    _favDropDownButton = new Fluent.DropDownButton();
                    _favDropDownButton.Header = "Favorites";
                    _favDropDownButton.Icon = _favDropDownButton.LargeIcon = ImageFactory.FromBitmap(global::gView.Desktop.Wpf.DataExplorer.Properties.Resources.folder_heart);

                    Fluent.MenuItem add2fav = new Fluent.MenuItem();
                    add2fav.Header = "Add to favorites...";
                    add2fav.Icon = ImageFactory.FromBitmap(global::gView.Desktop.Wpf.DataExplorer.Properties.Resources.folder_heart);
                    add2fav.Click += new RoutedEventHandler(Add2Favorites_Click);
                    _favDropDownButton.Items.Add(add2fav);

                    bool first = true;
                    foreach (MyFavorites.Favorite fav in (new MyFavorites().Favorites))
                    {
                        if (fav == null) continue;
                        WpfFavoriteMenuItem fItem = new WpfFavoriteMenuItem(fav);
                        fItem.Click += new RoutedEventHandler(MenuItem_Favorite_Click);

                        if (first)
                        {
                            first = false;
                            _favDropDownButton.Items.Add(new Separator());
                        }
                        _favDropDownButton.Items.Add(fItem);
                    }

                    favBox.Items.Add(_favDropDownButton);
                    ribbon.Tabs[0].Groups.Add(favBox);
                    #endregion

                    _createNewRibbonGroupBox = new Fluent.RibbonGroupBox();
                    _createNewRibbonGroupBox.Header = "Create New";
                    _createNewRibbonGroupBox.Visibility = Visibility.Visible;
                    _createNewRibbonGroupBox.Background = new SolidColorBrush(Colors.GreenYellow);
                    
                    ribbon.Tabs[0].Groups.Add(_createNewRibbonGroupBox);
                }
            }

            #region Options
            Fluent.RibbonTabItem optionsTab = new Fluent.RibbonTabItem() { Header = "Options" };
            Fluent.RibbonGroupBox optionsBox = new Fluent.RibbonGroupBox() { Header = String.Empty };
            optionsTab.Groups.Add(optionsBox);

            foreach (XmlNode pageNode in pm.GetPluginNodes(Plugins.Type.IExplorerOptionPage))
            {
                IExplorerOptionPage page = pm.CreateInstance(pageNode) as IExplorerOptionPage;
                if (page == null) continue;

                OptionsButton button = new OptionsButton(page);
                button.Click += new RoutedEventHandler(OptoinButton_Click);
                optionsBox.Items.Add(button);
            }
            ribbon.Tabs.Add(optionsTab);
            #endregion
        }
Exemplo n.º 27
0
        public MainWindow()
        {
            try
            {
                InitializeComponent();

                _application = new ExplorerApplication(this);
                _application.DockWindowAdded += new DockWindowAddedEvent(_application_DockWindowAdded);
                _application.OnShowDockableWindow += new OnShowDockableWindowEvent(_application_OnShowDockableWindow);
                #region Windows Forms Control Disign
                _toolStripAddress = new System.Windows.Forms.ToolStrip();
                _toolStripAddress.Stretch = true;
                _toolStripAddress.GripMargin = new System.Windows.Forms.Padding(1);
                _toolStripAddress.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow;
                _toolStripAddress.BackColor = System.Drawing.Color.White;
                winFormsHostStripAddress.Child = _toolStripAddress;
                #endregion

                _tree = new gView.Framework.UI.Dialogs.FormCatalogTree(_application, false);
                _tree.NodeSelected += new gView.Framework.UI.Dialogs.FormCatalogTree.NodeClickedEvent(tree_NodeSelected);
                _tree.NodeRenamed += new gView.Framework.UI.Dialogs.FormCatalogTree.NodeRenamedEvent(tree_NodeRenamed);
                _tree.NodeDeleted += new gView.Framework.UI.Dialogs.FormCatalogTree.NodeDeletedEvent(tree_NodeDeleted);
                //winFormsHostExplorerTree.Child = _tree;

                PlugInManager compMan = new PlugInManager();
                foreach (XmlNode tabNode in compMan.GetPluginNodes(Plugins.Type.IExplorerTabPage))
                {
                    IExplorerTabPage page = (IExplorerTabPage)compMan.CreateInstance(tabNode);
                    if (page == null || page.Control == null)
                        continue;

                    page.OnCreate(_application);

                    LayoutDocument layoutDoc = new LayoutDocument();
                    layoutDoc.Title = layoutDoc.ContentId = page.Title;
                    layoutDoc.CanClose = false;
                    layoutDoc.CanFloat = false;
                    layoutDoc.Content = new WindowsFormsHost();
                    ((WindowsFormsHost)layoutDoc.Content).Child = page.Control;
                    _tabPages.Add(new TabPage(page, layoutDoc));
                    if (page is gView.Framework.UI.Controls.ContentsList)
                    {
                        ((gView.Framework.UI.Controls.ContentsList)page).ItemSelected += new gView.Framework.UI.Controls.ContentsList.ItemClickedEvent(ContentsList_ItemSelected);
                        _content = (gView.Framework.UI.Controls.ContentsList)page;
                    }
                }
                explorerDocPane.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(explorerDocPane_PropertyChanged);

                anchorPaneRight.Children[0].Hide();
                _application.AddDockableWindow(_tree, DockWindowState.left);

                try
                {
                    XmlDocument doc = new XmlDocument();
                    doc.Load("menu.explorer.xml");

                    MakeMainMenuBar(doc.SelectSingleNode("//Menubar"));
                }
                catch { }

                MakeRibbon();
                ValidateButtons();
            } catch(Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message + "\n" + ex.StackTrace);
            }
        }