Exemplo n.º 1
0
        public List <Program> GetPrograms(EnabledState isEnabled, int minInstanceCount)
        {
            var programs = GetOverridePrograms();

            if (programs == null)
            {
                var db = new x360ceModelContainer();
                IQueryable <Program> list = db.Programs;
                if (isEnabled == EnabledState.Enabled)
                {
                    list = list.Where(x => x.IsEnabled);
                }
                else if (isEnabled == EnabledState.Disabled)
                {
                    list = list.Where(x => !x.IsEnabled);
                }
                if (minInstanceCount > 0)
                {
                    list = list.Where(x => x.InstanceCount == minInstanceCount);
                }
                programs = list.ToList();
                db.Dispose();
                db = null;
            }
            return(programs);
        }
        public void OnGUI(Rect rect)
        {
            // Remove preview popup on mouse scroll wheel events
            if (Event.current.type == EventType.ScrollWheel)
            {
                PopupWindowWithoutFocus.Hide();
            }

            int keyboardControlID = GUIUtility.GetControlID(FocusType.Keyboard);

            m_TreeView.OnGUI(rect, keyboardControlID);

            // Keyboard space toggles selection enabledness
            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Space &&
                m_Selection != null && m_Selection.Count > 0 && GUIUtility.keyboardControl == keyboardControlID)
            {
                var pitem = m_Selection[0];
                if (pitem != null)
                {
                    EnabledState newEnabled = (pitem.enableState == EnabledState.None) ? EnabledState.All : EnabledState.None;
                    pitem.enableState = newEnabled;
                    ItemWasToggled(m_Selection[0]);
                }

                Event.current.Use();
            }
        }
Exemplo n.º 3
0
        public ContentLoaderStartButton()
        {
            Debug.WriteLine("ContentLoaderStartButton.ctor()");
#warning APF->APF/ALE 2010-09-23: Debugcode, löschen wenn das Parent-Problem gelöst wurde
            // OpenWindowForDebugging();

            _enabledState =
                null != ArcMap.Application
                    ? EnabledState.Enabled
                    : EnabledState.Disabled;

            try
            {
                SetMouseCursor(CursorId.Wait);
                ContainerFacade.CreateContainer();

                var presenter = ContainerFacade.ResolveType<IAddInButtonPresenter>();
                presenter.SetView(this);
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception);
            }
            finally
            {
                SetMouseCursor(CursorId.Default);
            }
        }
Exemplo n.º 4
0
 public List<Program> GetPrograms(EnabledState isEnabled, int minInstanceCount)
 {
     var db = new x360ceModelContainer();
     IQueryable<Program> list = db.Programs;
     if (isEnabled == EnabledState.Enabled) list = list.Where(x => x.IsEnabled);
     else if (isEnabled == EnabledState.Disabled) list = list.Where(x => !x.IsEnabled);
     if (minInstanceCount > 0) list = list.Where(x => x.InstanceCount == minInstanceCount);
     return list.ToList();
 }
Exemplo n.º 5
0
        public static void EnabledAllChannels(EnabledState inState)
        {
            List <string> channelKeys = new List <string>(EnabledChannels.Keys);

            foreach (string channelKey in channelKeys)
            {
                EnabledChannels[channelKey] = inState;
            }
        }
 public AdsProjectSettings(string path, SettingsScope scopes, IEnumerable <string> keywords = null)
     : base(path, scopes, k_ServiceName, keywords)
 {
     m_StateMachine = new SimpleStateMachine <AdsEvent>();
     m_StateMachine.AddEvent(AdsEvent.Enabling);
     m_StateMachine.AddEvent(AdsEvent.Disabling);
     m_EnabledState  = new EnabledState(m_StateMachine, this);
     m_DisabledState = new DisabledState(m_StateMachine, this);
     m_StateMachine.AddState(m_EnabledState);
     m_StateMachine.AddState(m_DisabledState);
 }
 private void EnableChildrenRecursive(TreeViewItem parentItem, EnabledState enabled)
 {
     if (parentItem.hasChildren)
     {
         foreach (TreeViewItem item in parentItem.children)
         {
             PackageExportTreeViewItem item2 = item as PackageExportTreeViewItem;
             item2.enabledState = enabled;
             this.EnableChildrenRecursive(item2, enabled);
         }
     }
 }
 private void EnableChildrenRecursive(TreeViewItem parentItem, EnabledState enabled)
 {
     if (parentItem.hasChildren)
     {
         foreach (TreeViewItem item in parentItem.children)
         {
             PackageExportTreeViewItem item2 = item as PackageExportTreeViewItem;
             item2.enabledState = enabled;
             this.EnableChildrenRecursive(item2, enabled);
         }
     }
 }
 private void EnableChildrenRecursive(TreeViewItem parentItem, EnabledState state)
 {
     if (parentItem.hasChildren)
     {
         foreach (TreeViewItem item in parentItem.children)
         {
             PackageImportTreeViewItem item2 = item as PackageImportTreeViewItem;
             item2.enableState = state;
             this.EnableChildrenRecursive(item2, state);
         }
     }
 }
        public void OnGUI(Rect rect)
        {
            int controlID = GUIUtility.GetControlID(FocusType.Keyboard);

            this.m_TreeView.OnGUI(rect, controlID);
            if ((((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.Space)) && ((this.m_Selection != null) && (this.m_Selection.Count > 0))) && (GUIUtility.keyboardControl == controlID))
            {
                EnabledState state = (this.m_Selection[0].enabledState == EnabledState.All) ? EnabledState.None : EnabledState.All;
                this.m_Selection[0].enabledState = state;
                this.ItemWasToggled(this.m_Selection[0]);
                Event.current.Use();
            }
        }
        EnabledState GetFolderChildrenEnabledState(PackageImportTreeViewItem folder)
        {
            if (folder.item != null && !folder.item.isFolder)
            {
                Debug.LogError("Should be a folder item!");
            }

            if (!folder.hasChildren)
            {
                return(EnabledState.None);
            }

            EnabledState amount = EnabledState.NotSet;

            int i = 0;

            for (; i < folder.children.Count; ++i)
            {
                // We dont want to consider project assets in this calculation as they are
                // ignored
                var firstValidChild = folder.children[i] as PackageImportTreeViewItem;
                if (ItemShouldBeConsideredForEnabledCheck(firstValidChild))
                {
                    amount = firstValidChild.enableState;
                    break;
                }
            }

            ++i;
            for (; i < folder.children.Count; ++i)
            {
                // We dont want to consider project assets in this calculation as they are
                // ignored
                var childItem = folder.children[i] as PackageImportTreeViewItem;
                if (ItemShouldBeConsideredForEnabledCheck(childItem))
                {
                    if (amount != childItem.enableState)
                    {
                        amount = EnabledState.Mixed;
                        break;
                    }
                }
            }

            if (amount == EnabledState.NotSet)
            {
                return(EnabledState.None);
            }

            return(amount);
        }
Exemplo n.º 12
0
        public AdsProjectSettings(string path, SettingsScope scopes, IEnumerable <string> keywords = null)
            : base(path, scopes, k_ServiceName, keywords)
        {
            m_StateMachine = new SimpleStateMachine <AdsEvent>();
            m_StateMachine.AddEvent(AdsEvent.Enabling);
            m_StateMachine.AddEvent(AdsEvent.Disabling);
            m_EnabledState  = new EnabledState(m_StateMachine, this);
            m_DisabledState = new DisabledState(m_StateMachine, this);
            m_AppleGameId   = AdvertisementSettings.GetGameId(RuntimePlatform.IPhonePlayer);
            m_AndroidGameId = AdvertisementSettings.GetGameId(RuntimePlatform.Android);

            m_StateMachine.AddState(m_EnabledState);
            m_StateMachine.AddState(m_DisabledState);
        }
        void EnableChildrenRecursive(TreeViewItem parentItem, EnabledState enabled)
        {
            if (!parentItem.hasChildren)
            {
                return;
            }

            foreach (TreeViewItem tvitem in parentItem.children)
            {
                var pitem = tvitem as PackageExportTreeViewItem;
                pitem.enabledState = enabled;
                EnableChildrenRecursive(pitem, enabled);
            }
        }
        void EnableChildrenRecursive(TreeViewItem parentItem, EnabledState state)
        {
            if (!parentItem.hasChildren)
            {
                return;
            }

            foreach (TreeViewItem tvitem in parentItem.children)
            {
                var pitem = tvitem as PackageImportTreeViewItem;
                pitem.enableState = state;

                EnableChildrenRecursive(pitem, state);
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConfigurationObjectTag" /> class
        /// representing a <see cref="VirtualResource" /> object.
        /// </summary>
        /// <param name="resource">The <see cref="VirtualResource" />.</param>
        /// <exception cref="ArgumentNullException"><paramref name="resource" /> is null.</exception>
        public ConfigurationObjectTag(VirtualResource resource)
        {
            if (resource == null)
            {
                throw new ArgumentNullException(nameof(resource));
            }

            Id           = resource.VirtualResourceId;
            ObjectType   = ConfigurationObjectType.VirtualResource;
            ResourceType = EnumUtil.Parse <VirtualResourceType>(resource.ResourceType);
            Name         = resource.Name;
            ParentId     = resource.EnterpriseScenarioId;
            FolderId     = resource.FolderId;
            EnabledState = resource.Enabled ? EnabledState.Enabled : EnabledState.Disabled;
        }
Exemplo n.º 16
0
 public List<Program> GetPrograms(EnabledState isEnabled, int minInstanceCount)
 {
     var programs = GetOverridePrograms();
     if (programs == null)
     {
         var db = new x360ceModelContainer();
         IQueryable<Program> list = db.Programs;
         if (isEnabled == EnabledState.Enabled) list = list.Where(x => x.IsEnabled);
         else if (isEnabled == EnabledState.Disabled) list = list.Where(x => !x.IsEnabled);
         if (minInstanceCount > 0) list = list.Where(x => x.InstanceCount == minInstanceCount);
         programs = list.ToList();
         db.Dispose();
         db = null;
     }
     return programs;
 }
Exemplo n.º 17
0
        public static void EnabledChannel(string channel, EnabledState state)
        {
            if (channel == null)
            {
                return;
            }

            if (!EnabledChannels.ContainsKey(channel))
            {
                EnabledChannels.Add(channel, state);
            }
            else
            {
                EnabledChannels[channel] = state;
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConfigurationObjectTag" /> class
        /// representing a <see cref="VirtualResourceMetadata" /> object.
        /// </summary>
        /// <param name="metadata">The <see cref="VirtualResourceMetadata" />.</param>
        /// <exception cref="ArgumentNullException"><paramref name="metadata" /> is null.</exception>
        public ConfigurationObjectTag(VirtualResourceMetadata metadata)
        {
            if (metadata == null)
            {
                throw new ArgumentNullException(nameof(metadata));
            }

            Id           = metadata.VirtualResourceMetadataId;
            ObjectType   = ConfigurationObjectType.VirtualResourceMetadata;
            ResourceType = EnumUtil.Parse <VirtualResourceType>(metadata.ResourceType);
            MetadataType = metadata.MetadataType;
            Name         = metadata.Name;
            ParentId     = metadata.VirtualResourceId;
            FolderId     = metadata.FolderId;
            EnabledState = metadata.Enabled ? EnabledState.Enabled : EnabledState.Disabled;
        }
Exemplo n.º 19
0
        public override void ExecuteCmdlet()
        {
            var existingPolicy = FrontDoorManagementClient.Policies.List(ResourceGroupName)
                                 .Where(p => p.Name.ToLower() == Name.ToLower());

            if (existingPolicy.Count() != 0)
            {
                throw new PSArgumentException(string.Format(Resources.Error_CreateExistingWebApplicationFirewallPolicy,
                                                            Name,
                                                            ResourceGroupName));
            }
            var updateParameters = new Management.FrontDoor.Models.WebApplicationFirewallPolicy1
            {
                Location    = "global",
                CustomRules = new Management.FrontDoor.Models.CustomRules {
                    Rules = Customrule?.ToList().Select(x => x.ToSdkCustomRule()).ToList()
                },
                ManagedRules = new Management.FrontDoor.Models.ManagedRuleSets
                {
                    RuleSets = ManagedRule?.ToList().Select(x => x.ToSdkAzManagedRule()).ToList()
                },
                PolicySettings = new Management.FrontDoor.Models.PolicySettings
                {
                    EnabledState = this.IsParameterBound(c => c.EnabledState) ? EnabledState.ToString() : PSEnabledState.Enabled.ToString(),
                    Mode         = this.IsParameterBound(c => c.Mode) ? Mode.ToString() : PSMode.Prevention.ToString()
                }
            };

            if (ShouldProcess(Resources.WebApplicationFirewallPolicyTarget, string.Format(Resources.CreateWebApplicationFirewallPolicy, Name)))
            {
                try
                {
                    var policy = FrontDoorManagementClient.Policies.CreateOrUpdate(
                        ResourceGroupName,
                        Name,
                        updateParameters
                        );
                    WriteObject(policy.ToPSPolicy());
                }
                catch (Microsoft.Azure.Management.FrontDoor.Models.ErrorResponseException e)
                {
                    throw new PSArgumentException(string.Format(
                                                      Resources.Error_ErrorResponseFromServer,
                                                      e.Response.Content));
                }
            }
        }
        void RecursiveComputeEnabledStateForFolders(PackageImportTreeViewItem pitem, HashSet <PackageImportTreeViewItem> done)
        {
            if (pitem.item != null && !pitem.item.isFolder)
            {
                return;
            }

            // Depth first recursion to allow parent folders be dependant on child folders

            // Recurse
            if (pitem.hasChildren)
            {
                foreach (var child in pitem.children)
                {
                    RecursiveComputeEnabledStateForFolders(child as PackageImportTreeViewItem, done);
                }
            }
            else if (pitem.item.isFolder)
            {
                // since the folder is empty, we don't need to set the enabled check depending of it's children
                done.Add(pitem);
            }

            // Now do logic
            if (!done.Contains(pitem))
            {
                EnabledState amount = GetFolderChildrenEnabledState(pitem);
                pitem.enableState = amount;

                // If 'item' is mixed then all of its parents will also be mixed
                if (amount == EnabledState.Mixed)
                {
                    done.Add(pitem);
                    var current = pitem.parent as PackageImportTreeViewItem;
                    while (current != null)
                    {
                        if (!done.Contains(current))
                        {
                            current.enableState = EnabledState.Mixed;
                            done.Add(current);
                        }
                        current = current.parent as PackageImportTreeViewItem;
                    }
                }
            }
        }
        public void OnGUI(Rect rect)
        {
            int keyboardControlID = GUIUtility.GetControlID(FocusType.Keyboard);

            m_TreeView.OnGUI(rect, keyboardControlID);

            // Keyboard space toggles selection enabledness
            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Space &&
                m_Selection != null && m_Selection.Count > 0 && GUIUtility.keyboardControl == keyboardControlID)
            {
                EnabledState newEnabled = m_Selection[0].enabledState != EnabledState.All ? EnabledState.All : EnabledState.None;
                m_Selection[0].enabledState = newEnabled;
                ItemWasToggled(m_Selection[0]);

                Event.current.Use();
            }
        }
Exemplo n.º 22
0
 public static CssProperty LookupProperty(string aProperty, EnabledState aEnabled)
 {
     CssProperty res = (CssProperty)gPropertyTable.GetOrDefault(aProperty, -1);
     if (res >= CssProperty.PropertyCount) {
         if (IsEnabled(res) || aEnabled == EnabledState.Any) {
             res = gAliases[res - CssProperty.PropertyCount];
             Debug.Assert(0 <= res && res < CssProperty.PropertyCount, "aliases must not point to other aliases");
         }
         else {
             res = CssProperty.Unknown;
         }
     }
     if (res != CssProperty.Unknown && aEnabled == EnabledState.Enabled && !IsEnabled(res)) {
         res = CssProperty.Unknown;
     }
     return res;
 }
 public void SetFormEnabledState(EnabledState enabled)
 {
     switch (enabled)
     {
         case EnabledState.Integrated:
             EnableInstances(true);
             EnableUserPassword(false);
             break;
         case EnabledState.SqlServerAuth:
             EnableInstances(true);
             EnableUserPassword(true);
             break;
         case EnabledState.Disabled:
             EnableInstances(false);
             EnableUserPassword(false);
             break;
     }
 }
Exemplo n.º 24
0
        public AnalyticsProjectSettings(string path, SettingsScope scopes, IEnumerable <string> keywords = null)
            : base(path, scopes, k_ServiceName, keywords)
        {
            m_StateMachine = new SimpleStateMachine <ServiceEvent>();

            m_StateMachine.AddEvent(ServiceEvent.Disabled);
            m_StateMachine.AddEvent(ServiceEvent.Integrating);
            m_StateMachine.AddEvent(ServiceEvent.Enabled);

            m_DisabledState    = new DisabledState(m_StateMachine, this);
            m_IntegrationState = new IntegrationState(m_StateMachine, this);
            m_EnabledState     = new EnabledState(m_StateMachine, this);

            m_StateMachine.AddState(m_DisabledState);
            m_StateMachine.AddState(m_IntegrationState);
            m_StateMachine.AddState(m_EnabledState);

            m_ValidationPoller = new AnalyticsValidationPoller();
        }
Exemplo n.º 25
0
        public void SetFormEnabledState(EnabledState enabled)
        {
            switch (enabled)
            {
            case EnabledState.Integrated:
                EnableInstances(true);
                EnableUserPassword(false);
                break;

            case EnabledState.SqlServerAuth:
                EnableInstances(true);
                EnableUserPassword(true);
                break;

            case EnabledState.Disabled:
                EnableInstances(false);
                EnableUserPassword(false);
                break;
            }
        }
        void RecursiveComputeEnabledStateForFolders(PackageExportTreeViewItem pitem, HashSet <PackageExportTreeViewItem> done)
        {
            if (!pitem.isFolder)
            {
                return;
            }

            // Depth first recursion to allow parent folders be dependant on child folders

            // Recurse
            if (pitem.hasChildren)
            {
                foreach (var child in pitem.children)
                {
                    RecursiveComputeEnabledStateForFolders(child as PackageExportTreeViewItem, done);
                }
            }

            // Now do logic
            if (!done.Contains(pitem))
            {
                EnabledState enabledState = GetFolderChildrenEnabledState(pitem);
                pitem.enabledState = enabledState;

                // If 'item' is mixed then all of its parents will also be mixed
                if (enabledState == EnabledState.Mixed)
                {
                    done.Add(pitem);
                    var current = pitem.parent as PackageExportTreeViewItem;
                    while (current != null)
                    {
                        if (!done.Contains(current))
                        {
                            current.enabledState = EnabledState.Mixed;
                            done.Add(current);
                        }
                        current = current.parent as PackageExportTreeViewItem;
                    }
                }
            }
        }
Exemplo n.º 27
0
        void GetPrograms()
        {
            MainForm.Current.LoadingCircle = true;
            var ws = new WebServiceClient();

            ws.Url = MainForm.Current.OptionsPanel.InternetDatabaseUrlComboBox.Text;
            EnabledState enabled = EnabledState.None;

            if (IncludeEnabledCheckBox.CheckState == CheckState.Checked)
            {
                enabled = EnabledState.Enabled;
            }
            if (IncludeEnabledCheckBox.CheckState == CheckState.Unchecked)
            {
                enabled = EnabledState.Disabled;
            }
            int minInstances = (int)MinimumInstanceCountNumericUpDown.Value;

            ws.GetProgramsCompleted += ProgramsWebServiceClient_GetProgramsCompleted;
            ws.GetProgramsAsync(enabled, minInstances);
        }
        public void OnGUI(Rect rect)
        {
            if (Event.current.type == EventType.ScrollWheel)
            {
                PopupWindowWithoutFocus.Hide();
            }
            int controlID = GUIUtility.GetControlID(FocusType.Keyboard);

            this.m_TreeView.OnGUI(rect, controlID);
            if ((((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.Space)) && ((this.m_Selection != null) && (this.m_Selection.Count > 0))) && (GUIUtility.keyboardControl == controlID))
            {
                PackageImportTreeViewItem item = this.m_Selection[0];
                if (item != null)
                {
                    EnabledState state = (item.enableState != EnabledState.None) ? EnabledState.None : EnabledState.All;
                    item.enableState = state;
                    this.ItemWasToggled(this.m_Selection[0]);
                }
                Event.current.Use();
            }
        }
        private EnabledState GetFolderChildrenEnabledState(PackageImportTreeViewItem folder)
        {
            if ((folder.item != null) && !folder.item.isFolder)
            {
                UnityEngine.Debug.LogError("Should be a folder item!");
            }
            if (!folder.hasChildren)
            {
                return(EnabledState.None);
            }
            EnabledState notSet = EnabledState.NotSet;
            int          num    = 0;

            while (num < folder.children.Count)
            {
                PackageImportTreeViewItem pitem = folder.children[num] as PackageImportTreeViewItem;
                if (this.ItemShouldBeConsideredForEnabledCheck(pitem))
                {
                    notSet = pitem.enableState;
                    break;
                }
                num++;
            }
            num++;
            while (num < folder.children.Count)
            {
                PackageImportTreeViewItem item2 = folder.children[num] as PackageImportTreeViewItem;
                if (this.ItemShouldBeConsideredForEnabledCheck(item2) && (notSet != item2.enableState))
                {
                    notSet = EnabledState.Mixed;
                    break;
                }
                num++;
            }
            if (notSet == EnabledState.NotSet)
            {
                return(EnabledState.None);
            }
            return(notSet);
        }
Exemplo n.º 30
0
        public static CssProperty LookupProperty(string aProperty, EnabledState aEnabled)
        {
            CssProperty res = (CssProperty)gPropertyTable.GetOrDefault(aProperty, -1);

            if (res >= CssProperty.PropertyCount)
            {
                if (IsEnabled(res) || aEnabled == EnabledState.Any)
                {
                    res = gAliases[res - CssProperty.PropertyCount];
                    Debug.Assert(0 <= res && res < CssProperty.PropertyCount, "aliases must not point to other aliases");
                }
                else
                {
                    res = CssProperty.Unknown;
                }
            }
            if (res != CssProperty.Unknown && aEnabled == EnabledState.Enabled && !IsEnabled(res))
            {
                res = CssProperty.Unknown;
            }
            return(res);
        }
Exemplo n.º 31
0
        void GetPrograms()
        {
            var ws = new WebServiceClient();

            ws.Url = SettingsManager.Options.InternetDatabaseUrl;
            EnabledState enabled = EnabledState.None;

            if (IncludeEnabledCheckBox.CheckState == CheckState.Checked)
            {
                enabled = EnabledState.Enabled;
            }
            if (IncludeEnabledCheckBox.CheckState == CheckState.Unchecked)
            {
                enabled = EnabledState.Disabled;
            }
            int minInstances = (int)MinimumInstanceCountNumericUpDown.Value;

            ws.GetProgramsCompleted += ProgramsWebServiceClient_GetProgramsCompleted;
            System.Threading.ThreadPool.QueueUserWorkItem(delegate(object state)
            {
                ws.GetProgramsAsync(enabled, minInstances);
            });
        }
Exemplo n.º 32
0
        /// <summary>
        /// Sets the robot enabled state
        /// </summary>
        /// <param name="state">The state to set</param>
        public static void SetEnabledState(EnabledState state)
        {
            switch (state)
            {
            case EnabledState.Disabled:
                SimData.DriverStation.ControlData.Enabled    = false;
                SimData.DriverStation.ControlData.EStop      = false;
                SimData.DriverStation.ControlData.DsAttached = true;
                break;

            case EnabledState.Enabled:
                SimData.DriverStation.ControlData.Enabled    = true;
                SimData.DriverStation.ControlData.EStop      = false;
                SimData.DriverStation.ControlData.DsAttached = true;
                break;

            case EnabledState.EStopped:
                SimData.DriverStation.ControlData.Enabled    = false;
                SimData.DriverStation.ControlData.EStop      = true;
                SimData.DriverStation.ControlData.DsAttached = true;
                break;
            }
        }
 public void SetAllEnabled(EnabledState enabled)
 {
     this.EnableChildrenRecursive(this.m_TreeView.data.root, enabled);
     this.ComputeEnabledStateForFolders();
 }
        /// <summary>
        /// Sets the robot enabled state
        /// </summary>
        /// <param name="state">The state to set</param>
        public static void SetEnabledState(EnabledState state)
        {
            switch (state)
            {
                case EnabledState.Disabled:
                    HalDSData["control"]["enabled"] = false;
                    HalDSData["control"]["eStop"] = false;
                    HalDSData["control"]["ds_attached"] = true;
                    break;
                case EnabledState.Enabled:
                    HalDSData["control"]["enabled"] = true;
                    HalDSData["control"]["eStop"] = false;
                    HalDSData["control"]["ds_attached"] = true;
                    break;
                case EnabledState.EStopped:
                    HalDSData["control"]["enabled"] = false;
                    HalDSData["control"]["eStop"] = true;
                    HalDSData["control"]["ds_attached"] = true;
                    break;
            }

        }
Exemplo n.º 35
0
 public void SetEnabledState(EnabledState enabledState)
 {
     _enabledState = enabledState;
 }
Exemplo n.º 36
0
        public override void ExecuteCmdlet()
        {
            if (ParameterSetName == ObjectParameterSet)
            {
                ResourceIdentifier identifier = new ResourceIdentifier(InputObject.Id);
                ResourceGroupName = identifier.ResourceGroupName;
                Name = InputObject.Name;
            }
            else if (ParameterSetName == ResourceIdParameterSet)
            {
                ResourceIdentifier identifier = new ResourceIdentifier(ResourceId);
                ResourceGroupName = identifier.ResourceGroupName;
                Name = identifier.ResourceName;
            }


            var existingPolicy = FrontDoorManagementClient.Policies.List(ResourceGroupName)
                                 .FirstOrDefault(x => x.Name.ToLower() == Name.ToLower());


            if (existingPolicy == null)
            {
                throw new PSArgumentException(string.Format(
                                                  Resources.Error_WebApplicationFirewallPolicyNotFound,
                                                  Name,
                                                  ResourceGroupName));
            }

            SdkPolicy updateParameters;

            if (ParameterSetName == ObjectParameterSet)
            {
                updateParameters = InputObject.ToSdkFirewallPolicy();
            }
            else
            {
                updateParameters = existingPolicy;
            }

            if (this.IsParameterBound(c => c.EnabledState))
            {
                updateParameters.PolicySettings.EnabledState = EnabledState.ToString();
            }

            if (this.IsParameterBound(c => c.Mode))
            {
                updateParameters.PolicySettings.Mode = Mode;
            }

            if (this.IsParameterBound(c => c.Customrule))
            {
                updateParameters.CustomRules = new Management.FrontDoor.Models.CustomRuleList()
                {
                    Rules = Customrule.ToList().Select(x => x.ToSdkCustomRule()).ToList()
                };
            }

            if (this.IsParameterBound(c => c.ManagedRule))
            {
                updateParameters.ManagedRules = new Management.FrontDoor.Models.ManagedRuleSetList()
                {
                    ManagedRuleSets = ManagedRule.ToList().Select(x => x.ToSdkAzManagedRule()).ToList()
                };
            }

            if (this.IsParameterBound(c => c.CustomBlockResponseBody))
            {
                updateParameters.PolicySettings.CustomBlockResponseBody = CustomBlockResponseBody == null ? CustomBlockResponseBody : Convert.ToBase64String(Encoding.UTF8.GetBytes(CustomBlockResponseBody));
            }

            if (this.IsParameterBound(c => c.CustomBlockResponseStatusCode))
            {
                updateParameters.PolicySettings.CustomBlockResponseStatusCode = CustomBlockResponseStatusCode;
            }

            if (this.IsParameterBound(c => c.RedirectUrl))
            {
                updateParameters.PolicySettings.RedirectUrl = RedirectUrl;
            }

            if (this.IsParameterBound(c => c.RequestBodyCheck))
            {
                updateParameters.PolicySettings.RequestBodyCheck = RequestBodyCheck;
            }

            if (ShouldProcess(Resources.WebApplicationFirewallPolicyTarget, string.Format(Resources.WebApplicationFirewallPolicyChangeWarning, Name)))
            {
                try
                {
                    var policy = FrontDoorManagementClient.Policies.CreateOrUpdate(
                        ResourceGroupName,
                        Name,
                        updateParameters
                        );
                    WriteObject(policy.ToPSPolicy());
                }
                catch (Microsoft.Azure.Management.FrontDoor.Models.ErrorResponseException e)
                {
                    throw new PSArgumentException(string.Format(
                                                      Resources.Error_ErrorResponseFromServer,
                                                      e.Response.Content));
                }
            }
        }
Exemplo n.º 37
0
 public void GetProgramsAsync(EnabledState isEnabled, int minInstanceCount, object userState = null)
 {
     InvokeAsync("GetPrograms", GetProgramsCompleted, userState, new object[] { isEnabled, minInstanceCount });
 }
Exemplo n.º 38
0
		public void SetEnablesState(EnabledState enabledState)
		{
			Enabled = EnabledState.Enabled == enabledState;
		}
Exemplo n.º 39
0
 private void acceptButton_Click(object sender, EventArgs e)
 {
     _enabledState = WinForms.DisableBut(cancelButton);
     cancelButton.DialogResult = DialogResult.None;
     connectWorker.RunWorkerAsync();
 }
 public void SetAllEnabled(EnabledState enabled)
 {
     this.EnableChildrenRecursive(this.m_TreeView.data.root, enabled);
     this.ComputeEnabledStateForFolders();
 }
 public void SetFormEnabledState(EnabledState enabled)
 {
     FormEnabled = enabled;
 }
Exemplo n.º 42
0
        /// <summary>
        /// Sets the robot enabled state
        /// </summary>
        /// <param name="state">The state to set</param>
        public static void SetEnabledState(EnabledState state)
        {
            switch (state)
            {
                case EnabledState.Disabled:
                    SimData.DriverStation.ControlData.Enabled = false;
                    SimData.DriverStation.ControlData.EStop = false;
                    SimData.DriverStation.ControlData.DsAttached = true;
                    break;
                case EnabledState.Enabled:
                    SimData.DriverStation.ControlData.Enabled = true;
                    SimData.DriverStation.ControlData.EStop = false;
                    SimData.DriverStation.ControlData.DsAttached = true;
                    break;
                case EnabledState.EStopped:
                    SimData.DriverStation.ControlData.Enabled = false;
                    SimData.DriverStation.ControlData.EStop = true;
                    SimData.DriverStation.ControlData.DsAttached = true;
                    break;
            }

        }
Exemplo n.º 43
0
        internal static AfdOriginData DeserializeAfdOriginData(JsonElement element)
        {
            Optional <SystemData> systemData = default;
            ResourceIdentifier    id         = default;
            string       name = default;
            ResourceType type = default;
            Optional <WritableSubResource> azureOrigin                = default;
            Optional <string>               hostName                  = default;
            Optional <int>                  httpPort                  = default;
            Optional <int>                  httpsPort                 = default;
            Optional <string>               originHostHeader          = default;
            Optional <int?>                 priority                  = default;
            Optional <int?>                 weight                    = default;
            Optional <object>               sharedPrivateLinkResource = default;
            Optional <EnabledState>         enabledState              = default;
            Optional <AfdProvisioningState> provisioningState         = default;
            Optional <DeploymentStatus>     deploymentStatus          = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("systemData"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    systemData = SystemData.DeserializeSystemData(property.Value);
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("azureOrigin"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            azureOrigin = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("hostName"))
                        {
                            hostName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("httpPort"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            httpPort = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("httpsPort"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            httpsPort = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("originHostHeader"))
                        {
                            originHostHeader = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("priority"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                priority = null;
                                continue;
                            }
                            priority = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("weight"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                weight = null;
                                continue;
                            }
                            weight = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("sharedPrivateLinkResource"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                sharedPrivateLinkResource = null;
                                continue;
                            }
                            sharedPrivateLinkResource = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("enabledState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enabledState = new EnabledState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new AfdProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("deploymentStatus"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            deploymentStatus = new DeploymentStatus(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new AfdOriginData(id, name, type, systemData.Value, azureOrigin, hostName.Value, Optional.ToNullable(httpPort), Optional.ToNullable(httpsPort), originHostHeader.Value, Optional.ToNullable(priority), Optional.ToNullable(weight), sharedPrivateLinkResource.Value, Optional.ToNullable(enabledState), Optional.ToNullable(provisioningState), Optional.ToNullable(deploymentStatus)));
        }
Exemplo n.º 44
0
 public void GetProgramsAsync(EnabledState isEnabled, int minInstanceCount, object userState = null)
 {
     InvokeAsync("GetPrograms", GetProgramsCompleted, userState, new object[] { isEnabled, minInstanceCount });
 }
Exemplo n.º 45
0
 public virtual void SetEnabledState(EnabledState state)
 {
     Enabled = EnabledState.Enabled == state;
 }
Exemplo n.º 46
0
 public List<Program> GetPrograms(EnabledState isEnabled, int minInstanceCount)
 {
     object[] results = Invoke("GetPrograms", new object[] { isEnabled, minInstanceCount });
     return (List<Program>)results[0];
 }