Example #1
0
        /// <summary>
        /// Updates the options. When a user changes the options through the options form,
        /// this ensures anything he's changes takes effect immediately.
        /// </summary>
        public void UpdateOptions()
        {
            NBM.Plugin.Settings.GlobalSettings globalSettings = NBM.Plugin.Settings.GlobalSettings.Instance();

            // add offline treenode
            if (globalSettings.HideOfflineContacts)
            {
                this.contactTreeView.HideOfflineList();
            }
            else
            {
                this.contactTreeView.ShowOfflineList();
            }

            this.ShowInTaskbar       = globalSettings.DisplayTaskBar;
            this.TopMost             = globalSettings.AlwaysOnTop;
            this.sysTrayIcon.Visible = true;


            foreach (Protocol protocol in this.protocolList)
            {
                ProtocolTreeNode node = this.contactTreeView.GetProtocolNode(protocol);
                if (node != null)
                {
                    node.Visible = protocol.Settings.Enabled;
                }
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="storage"></param>
        /// <returns></returns>
        public static GlobalSettings Instance(IStorage storage)
        {
            if (storage == null)
                throw new ArgumentNullException("Storage cannot be null");

            if (instance == null)
                instance = new GlobalSettings(storage);
            return instance;
        }