コード例 #1
0
ファイル: WpfWorkbench.cs プロジェクト: giszzt/GeoSOS
        /// <summary>
        /// Ribbon Initial 初始化Ribbon界面
        /// </summary>
        public void RibbonInitial()
        {
            RibbonContainer.ApplicationMenu = menu;

            #region 添加Pad到ApplicationMenu-View中
            RibbonApplicationMenuItem viewItem = new RibbonApplicationMenuItem();
            viewItem.Header = StringParser.Parse("${res:Ribbon.ApplicationMenu.View}");
            viewItem.Name   = "View";
            RibbonContainer.ApplicationMenu.Items.Add(viewItem);

            foreach (PadDescriptor content in AddInTree.BuildItems <PadDescriptor>(padsPath, this, false))
            {
                if (content != null)
                {
                    ShowPad(content);
                    viewItem.Items.Add(new PadToRibbon(content));
                }
            }

            #endregion

            #region 界面样式
            RibbonApplicationMenuItem styleItem = new RibbonApplicationMenuItem();
            styleItem.Header = StringParser.Parse("${res:Ribbon.ApplicationMenu.Themes}");
            styleItem.Name   = "Theme";
            RibbonContainer.ApplicationMenu.Items.Add(styleItem);
            #endregion

            RibbonService.AddItemsToRibbon(RibbonContainer, this, ribbonPath);
        }
コード例 #2
0
ファイル: WpfWorkbench.cs プロジェクト: giszzt/GeoSOS
        //by hanz
        //void SetProjectTitle(object sender, Project.ProjectEventArgs e)
        //{
        //    if (e.Project != null) {
        //        Title = e.Project.Name + " - " + ResourceService.GetString("MainWindow.DialogName");
        //    } else {
        //        Title = ResourceService.GetString("MainWindow.DialogName");
        //    }
        //}

        //by hanz
        //void CheckRemovedOrReplacedFile(object sender, FileEventArgs e)
        //{
        //    foreach (OpenedFile file in FileService.OpenedFiles)
        //    {
        //        if (FileUtility.IsBaseDirectory(e.FileName, file.FileName))
        //        {
        //            foreach (IViewContent content in file.RegisteredViewContents.ToArray())
        //            {
        //                // content.WorkbenchWindow can be null if multiple view contents
        //                // were in the same WorkbenchWindow and both should be closed
        //                // (e.g. Windows Forms Designer, Subversion History View)
        //                if (content.WorkbenchWindow != null)
        //                {
        //                    content.WorkbenchWindow.CloseWindow(true);
        //                }
        //            }
        //        }
        //    }
        //    Editor.PermanentAnchorService.FileDeleted(e);
        //}

        //by hanz
        //void CheckRenamedFile(object sender, FileRenameEventArgs e)
        //{
        //    if (e.IsDirectory) {
        //        foreach (OpenedFile file in FileService.OpenedFiles) {
        //            if (file.FileName != null && FileUtility.IsBaseDirectory(e.SourceFile, file.FileName)) {
        //                file.FileName = new FileName(FileUtility.RenameBaseDirectory(file.FileName, e.SourceFile, e.TargetFile));
        //            }
        //        }
        //    } else {
        //        OpenedFile file = FileService.GetOpenedFile(e.SourceFile);
        //        if (file != null) {
        //            file.FileName = new FileName(e.TargetFile);
        //        }
        //    }
        //    Editor.PermanentAnchorService.FileRenamed(e);
        //}

        /// <summary>
        /// 时刻监测Condition,更新界面
        /// </summary>
        void UpdateMenu()
        {
            MenuService.UpdateStatus(mainMenu.ItemsSource);

            if (toolBars != null)
            {
                foreach (System.Windows.Controls.ToolBar tb in toolBars)
                {
                    ToolBarService.UpdateStatus(tb.ItemsSource);
                }
            }

            if (toolStrips != null)
            {
                foreach (System.Windows.Forms.ToolStrip ts in toolStrips)
                {
                    ICSharpCode.Core.WinForms.ToolbarService.UpdateToolbar(ts);
                }
            }

            RibbonService.UpdateStatus(RibbonContainer);
        }