Пример #1
0
        private void NewInspector(Inspector inspector)
        {
            Object currentObject = inspector.CurrentItem;

            if (Ribbon != null)
            {
                Ribbon.InvalidateControl("buttonReadReport");
            }
        }
Пример #2
0
 public void OnRefresh(IRibbonControl control)
 {
     if (ribbon != null)
     {
         ribbon.InvalidateControl(control.Id);
     }
 }
Пример #3
0
 public override void CollectSettings()
 {
     if (updated)
     {
         ribbon.InvalidateControl("ribFavoritesMenu");
     }
 }
Пример #4
0
 public void OnLogonPressed(IRibbonControl control)
 {
     if (ribbon != null)
     {
         ribbon.InvalidateControl(control.Id);
     }
 }
Пример #5
0
 public static void InvalidateRibbon()
 {
     if (_thisRibbon != null)
     {
         _thisRibbon.Invalidate();
         _thisRibbon.InvalidateControl("openApiTab");
     }
 }
Пример #6
0
        public override bool CollectSettings()
        {
            if (updated)
            {
                ribbon.InvalidateControl("ribFavoritesMenu");
            }

            return(false);
        }
Пример #7
0
 internal void Invalidate(string controlId = null)
 {
     if (!String.IsNullOrEmpty(controlId))
     {
         _ribbon.InvalidateControl(controlId);
     }
     else
     {
         _ribbon.Invalidate();
     }
 }
Пример #8
0
        /// <summary>
        /// togguleButton押下
        /// </summary>
        public void TogglePressAction(IRibbonControl control, bool pressed)
        {
            switch (control.Id)
            {
            case RibbonItem.発注制御ボタン:
                _orderPressed = pressed;
                _thisRibbon.InvalidateControl(RibbonItem.発注制御ボタン);
                break;

            case RibbonItem.更新制御ボタン:
                _updatePressed = pressed;
                _thisRibbon.InvalidateControl(RibbonItem.更新制御ボタン);
                break;

            default: break;
            }

            string val = pressed ? "1" : "0";

            settingUpdate(control.Id, val);
        }
Пример #9
0
        public void SaveFavorites(XElement root)
        {
            try
            {
                PathFactory.EnsurePathExists(PathFactory.GetAppDataPath());
                root.Save(path, SaveOptions.None);

                if (ribbon != null)
                {
                    ribbon.InvalidateControl("ribFavoritesMenu");
                }
            }
            catch (Exception exc)
            {
                logger.WriteLine($"cannot save {path}");
                logger.WriteLine(exc);
            }
        }
Пример #10
0
 public void LogNewestLastButton_OnAction(IRibbonControl control, bool pressed)
 {
     try
     {
         LogDisplay.DisplayOrder = DisplayOrder.NewestLast;
         _ribbonUi.InvalidateControl("DisplayOrderMenu");
         _ribbonUi.InvalidateControl("LogNewestLastButton");
         _ribbonUi.InvalidateControl("LogNewestFirstButton");
     }
     catch (Exception ex)
     {
         ProcessUnhandledException(ex);
     }
 }
Пример #11
0
 private void InvalidateRibbon(string id = null)
 {
     try
     {
         if (ribbonUI != null)
         {
             if (id != null)
             {
                 ribbonUI.InvalidateControl(id);
             }
             else
             {
                 ribbonUI.Invalidate();
             }
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex);
     }
 }
Пример #12
0
        public override bool CollectSettings()
        {
            var settings = provider.GetCollection(Name);

            settings.Add("kbdshorts", shortcutsBox.Checked);

            provider.SetCollection(settings);

            // the actual favorites are stored in a separate file...

            // if nothing was deleted then check if they reordered
            if (!updated)
            {
                for (int i = 0; i < favorites.Count; i++)
                {
                    if (favorites[i].Index != i)
                    {
                        updated = true;
                        break;
                    }
                }
            }

            if (updated)
            {
                var root = FavoritesProvider.MakeMenuRoot();
                foreach (var favorite in favorites)
                {
                    root.Add(favorite.Root);
                }

                new FavoritesProvider(ribbon).SaveFavorites(root);
            }
            else if (shortcuts != shortcutsBox.Checked)
            {
                ribbon.InvalidateControl("ribFavoritesMenu");
            }

            return(false);
        }
Пример #13
0
        public void AddFavorite()
        {
            XElement root;

            if (File.Exists(path))
            {
                root = XElement.Load(path, LoadOptions.None);
            }
            else
            {
                root = MakeMenuRoot();
            }

            using (var one = new OneNote())
            {
                var info = one.GetPageInfo();

                var name = EmojiDialog.RemoveEmojis(info.Name);
                if (name.Length > 50)
                {
                    name = name.Substring(0, 50) + "...";
                }

                // similar to mongo ObjectId, a random-enough identifier for our needs
                var id = ((DateTimeOffset.Now.ToUnixTimeSeconds() << 32)
                          + new Random().Next()).ToString("x");

                root.Add(new XElement(ns + "splitButton",
                                      new XAttribute("id", $"omFavorite{id}"),
                                      new XElement(ns + "button",
                                                   new XAttribute("id", $"omFavoriteLink{id}"),
                                                   new XAttribute("onAction", "NavigateToFavorite"),
                                                   new XAttribute("imageMso", "FileLinksToFiles"),
                                                   new XAttribute("label", name),
                                                   new XAttribute("tag", info.Link),
                                                   new XAttribute("screentip", info.Path)
                                                   ),
                                      new XElement(ns + "menu",
                                                   new XAttribute("id", $"omFavoriteMenu{id}"),
                                                   new XElement(ns + "button",
                                                                new XAttribute("id", $"omFavoriteRemoveButton{id}"),
                                                                new XAttribute("onAction", "RemoveFavorite"),
                                                                new XAttribute("label", "Remove this item"),
                                                                new XAttribute("imageMso", "HyperlinkRemove"),
                                                                new XAttribute("tag", $"omFavorite{id}")
                                                                )
                                                   )
                                      ));

                // sort by name/label
                var items =
                    from e in root.Elements(ns + "splitButton")
                    let key = e.Element(ns + "button").Attribute("label").Value
                              orderby key
                              select e;

                root = MakeMenuRoot();
                foreach (var item in items)
                {
                    root.Add(item);
                }

                logger.WriteLine($"Saving favorite '{info.Path}' ({info.Link})");
            }

            try
            {
                PathFactory.EnsurePathExists(PathFactory.GetAppDataPath());
                root.Save(path, SaveOptions.None);

                ribbon.InvalidateControl("ribFavoritesMenu");
            }
            catch (Exception exc)
            {
                logger.WriteLine($"Cannot save {path}");
                logger.WriteLine(exc);
            }
        }
Пример #14
0
 public void InvalidateToggle()
 {
     ribbon.InvalidateControl("tglTogglePgBrk");
 }
Пример #15
0
 private void TaskPane_OnVisibleStateChange(CustomTaskPane customTaskPaneInst)
 {
     _ribbon.InvalidateControl("btnTaskPane");
 }
Пример #16
0
        public override bool CollectSettings()
        {
            // record changes from defaults
            var element = new XElement(SettingsName);

            for (int i = 0; i < map.Count; i++)
            {
                if (!map[i].Hotkey.Equals(defaultMap[i].Hotkey))
                {
                    element.Add(new XElement("command",
                                             new XAttribute("command", map[i].MethodName),
                                             new XAttribute("keys", map[i].Hotkey.Keys | map[i].Hotkey.Modifiers)
                                             ));
                }
            }

            var updated = false;

            // compare against saved settings
            var collection = provider.GetCollection(Name);

            if (collection != null)
            {
                var settings = collection.Get <XElement>(SettingsName);
                if (settings != null)
                {
                    if (settings.Elements().Count() != element.Elements().Count())
                    {
                        updated = true;
                    }
                    else
                    {
                        foreach (var candidate in element.Elements("command"))
                        {
                            var setting = settings.Elements("command")
                                          .FirstOrDefault(e =>
                                                          e.Attribute("command")?.Value == candidate.Attribute("command").Value);

                            if (setting == null ||
                                setting.Attribute("keys").Value != candidate.Attribute("keys").Value)
                            {
                                updated = true;
                                break;
                            }
                        }
                    }
                }
                else
                {
                    updated = element.HasElements;
                }
            }

            if (updated)
            {
                if (element.HasElements)
                {
                    collection.Add(SettingsName, element);
                    provider.SetCollection(collection);
                }
                else
                {
                    provider.RemoveCollection(Name);
                }

                ribbon.InvalidateControl("ribOneMoreMenu");
            }

            return(updated);
        }
Пример #17
0
 public void ReportMailItem(IRibbonControl control)
 {
     Globals.ThisAddIn.SendReport(GetMailItemBasedOnControl(control));
     ribbon.InvalidateControl(control.Id);
 }
 /// <summary>
 /// When the new button is pressed, the save should be enabled
 /// </summary>
 /// <param name="Doc"></param>
 void Application_NewDocument(Microsoft.Office.Interop.Word.Document Doc)
 {
     buttonText = "New Document Created";
     ribbon.InvalidateControl("btnTest");
 }