Exemple #1
0
        public static void SetRibbonVisibility()
        {
            string json = Properties.Settings.Default.Toolbar_UserPreferences;

            if (null == json || json.Length < 1)
            {
                return;
            }

            RibbonVisibility jsonToolbars = JsonConvert.DeserializeObject <RibbonVisibility>(json);

            foreach (ToolbarTab toolbarTab in s_arcadisRibbon.Tabs)
            {
                TabVis tabVis = GetJsonTab(jsonToolbars, toolbarTab.TabName);
                if (null == tabVis)
                {
                    toolbarTab.RibbonTab.IsVisible = true;
                    continue;
                }

                if (toolbarTab.TabName == tabVis.TabName)
                {
                    if (tabVis.TabName == Utils.k_arcadisMainTab)
                    {
                        toolbarTab.RibbonTab.IsVisible = true;
                    }
                    else
                    {
                        if (null != tabVis)
                        {
                            toolbarTab.RibbonTab.IsVisible = tabVis.Visible;
                        }
                    }
                }

                foreach (ToolbarPanel toolbarPanel in toolbarTab.Panels)
                {
                    PanelVis panelVis = GetJsonPanel(jsonToolbars, toolbarTab.TabName, toolbarPanel.PanelName);
                    if (null != panelVis)
                    {
                        toolbarPanel.Panel.Visible = panelVis.Visible;
                    }

                    foreach (ToolbarCommand toolbarCommand in toolbarPanel.Commands)
                    {
                        CommandVis commandVis = GetJsonCommand(jsonToolbars, toolbarTab.TabName, toolbarPanel.PanelName, toolbarCommand.CommandName);
                        if (null != commandVis)
                        {
                            toolbarCommand.Command.Visible = commandVis.Visible;
                        }
                    }
                }
            }
        }
Exemple #2
0
 public static TabVis GetJsonTab(RibbonVisibility ribbon, string tab)
 {
     foreach (TabVis tabVis in ribbon.Tabs)
     {
         if (tabVis.TabName == tab)
         {
             return(tabVis);
         }
     }
     return(null);
 }
Exemple #3
0
 public static PanelVis GetJsonPanel(RibbonVisibility ribbon, string strTab, string strPanel)
 {
     foreach (TabVis tabVis in ribbon.Tabs)
     {
         if (tabVis.TabName == strTab)
         {
             foreach (PanelVis panelVis in tabVis.Panels)
             {
                 if (panelVis.PanelName == strPanel)
                 {
                     return(panelVis);
                 }
             }
         }
     }
     return(null);
 }
Exemple #4
0
 public static CommandVis GetJsonCommand(RibbonVisibility ribbon, string strTab, string strPanel, string strCommand)
 {
     foreach (TabVis tabVis in ribbon.Tabs)
     {
         if (tabVis.TabName == strTab)
         {
             foreach (PanelVis panelVis in tabVis.Panels)
             {
                 if (panelVis.PanelName == strPanel)
                 {
                     foreach (CommandVis commandVis in panelVis.Commands)
                     {
                         if (commandVis.CommandName == strCommand)
                         {
                             return(commandVis);
                         }
                     }
                 }
             }
         }
     }
     return(null);
 }