Пример #1
0
        public ActionTreeViewItem(SwitcherActionBase action, NetworkTreeViewItem parentNetworkItem)
            : base()
        {
            if (action == null)
                throw new ArgumentNullException("action", "Action cannot be null");

            this.ActionId = action.Id;
            this.Header = action.Name;
            this.ParentNetworkItem = parentNetworkItem;
        }
Пример #2
0
        public ActionTreeViewItem(SwitcherActionBase action, NetworkTreeViewItem parentNetworkItem)
            : base()
        {
            if (action == null)
            {
                throw new ArgumentNullException("action", "Action cannot be null");
            }

            this.ActionId          = action.Id;
            this.Header            = action.Name;
            this.ParentNetworkItem = parentNetworkItem;
        }
        private void LoadNetworkTreeView()
        {
            treeViewNetworks.Items.Clear();

            foreach (var item in SettingsManager.Instance.GetNetworkConfigurations())
            {
                NetworkTreeViewItem ni = null;

                if (item.Id == SwitcherActionBase.DeactivateNetworkId)
                    ni = new UnknownNetworkTreeViewItem(item, this.addInManager.GetActionsByIds(item.Actions));
                else
                    ni = new NetworkTreeViewItem(item, this.addInManager.GetActionsByIds(item.Actions));

                if (!(ni is UnknownNetworkTreeViewItem) && ni.NetworkId == NetworkManager.CurrentNetworkConfigurationId)
                    ni.FontWeight = FontWeights.Bold;
                else
                    ni.FontWeight = FontWeights.Normal;

                treeViewNetworks.Items.Add(ni);

                if (item.Id == this.selectedNetworkIdOnNextRefreshInTreeView)
                {
                    ni.IsSelected = true;
                    if (this.selectedActionIdOnNextRefreshInTreeView != Guid.Empty)
                        ni.SelectAction(this.selectedActionIdOnNextRefreshInTreeView);
                }
            }
        }