public void Clear()
 {
     Files.Clear();
     Routings.Clear();
     Controllers.Clear();
     ConditionalRouting.Clear();
     ConditionalPassthroughs.Clear();
 }
예제 #2
0
파일: ScreenState.cs 프로젝트: kuggaa/VAS
 public virtual Task <bool> UnloadState()
 {
     Log.Debug($"Unloading state {Name}");
     foreach (var controller in Controllers)
     {
         controller.Dispose();
     }
     Controllers.Clear();
     return(AsyncHelpers.Return(true));
 }
예제 #3
0
 public static void LoadControllers()
 {
     Controllers.Clear();
     foreach (var dev in MuniaController.ListDevices())
     {
         Controllers.Add(dev);
     }
     foreach (var dev in ArduinoControllerManager.ListDevices())
     {
         Controllers.Add(dev);
     }
 }
예제 #4
0
 private void LoadControllerToList()
 {
     Controllers.Clear();
     checkedListBox_controllerlist.Items.Clear();
     if (Controllers.LoadControllers() > 0)
     {
         for (int i = 0; i < Controllers.Count; i++)
         {
             checkedListBox_controllerlist.Items.Add(Controllers.Get(i).GetProductName(), false);
         }
     }
 }
예제 #5
0
파일: ScreenState.cs 프로젝트: kuggaa/VAS
 protected override void DisposeManagedResources()
 {
     base.DisposeManagedResources();
     Controllers?.ForEach((c) => c.Dispose());
     Panel?.Dispose();
     if (ViewModelOwner)
     {
         ViewModel?.Dispose();
     }
     ViewModel = default(TViewModel);
     Controllers.Clear();
     Panel      = null;
     KeyContext = null;
 }
예제 #6
0
        private void Reset()
        {
            EventManager.Ins.Reset();
            Camera.Ins.Reset();
            Scene.Ins.Reset();

            State = new MapEditorStateNormal(this);

            EventManager.Ins.Subscribe(EventEnum.KeyDown, (s, e) => State.HandleKeyDown((e as KeyDownEventArgs).key));
            EventManager.Ins.Subscribe(EventEnum.KeyUp, (s, e) => State.HandleKeyUp((e as KeyUpEventArgs).key));

            Controllers.Clear();
            Controllers.Add(new KeyboardController());
            Controllers.Add(new MouseController());
        }
예제 #7
0
파일: Window.cs 프로젝트: ulkyome/HtmlUi
        /// <summary>
        /// Destroys the controllers.
        /// </summary>
        internal void DestroyControllers()
        {
            foreach (var controller in Controllers.Values)
            {
                controller.Dispose();
            }

            Controllers.Clear();

            foreach (var observableController in ObservableControllers.Values)
            {
                observableController.Dispose();
            }

            ObservableControllers.Clear();
        }
예제 #8
0
        private void ReadSettings()
        {
            UserPreference = JsonConvert.DeserializeObject <UserPreference>(Properties.Settings.Default["preference"].ToString());
            List <IController> ctrls = new List <IController>();

            if (UserPreference != null)
            {
                Type   t  = typeof(Helper);
                string ns = t.Namespace;
                foreach (string vendor in UserPreference.Vendors)
                {
                    AccountOption accOpt = (dynamic)UserPreference.GetType().GetProperty(vendor + "Account").GetValue(UserPreference);
                    foreach (var acc in accOpt.Accounts)
                    {
                        if (acc.IsActivate)
                        {
                            string      clsName = ns + "." + vendor + "Controller";
                            Type        type    = Type.GetType(clsName);
                            IController ctrl    = Activator.CreateInstance(type, this) as IController;
                            ctrl.ConnParam = acc;
                            // if some connection is connected, then remain unchanged
                            IController ic = Controllers.FirstOrDefault(x => x.DisplayName == ctrl.DisplayName);
                            if (ic != null && ic.IsConnected)
                            {
                                ctrls.Add(ic);
                            }
                            else
                            {
                                ctrls.Add(ctrl);
                            }
                        }
                    }
                    Controllers.Clear();
                    foreach (var item in ctrls)
                    {
                        Controllers.Add(item);
                    }
                }
            }
        }
예제 #9
0
 public static void LoadControllers()
 {
     Controllers.Clear();
     foreach (var dev in MuniaController.ListDevices())
     {
         Controllers.Add(dev);
     }
     foreach (var dev in ArduinoController.ListDevices())
     {
         Controllers.Add(dev);
     }
     foreach (var dev in XInputController.ListDevices())
     {
         Controllers.Add(dev);
     }
     foreach (var dev in GenericController.ListDevices())
     {
         Controllers.Add(dev);
     }
     foreach (var dev in MappedController.ListDevices())
     {
         Controllers.Add(dev);
     }
 }
예제 #10
0
        /// <summary>
        /// Sets up the DirectInput controllers and Initializes the XInput Controllers.
        /// Basically instantiates all of the controllers and sets them up.
        /// </summary>
        public void SetupControllerManager()
        {
            // Clear current controller (on hotplug events)
            Controllers.Clear();

            // Acquire the DirectInput devices. (Finds, loads and sets up all DInput Devices)
            DInputManager.AcquireDevices();

            // Instantiate three XInput Controllers
            XInputController xInputController1 = new XInputController(0);
            XInputController xInputController2 = new XInputController(1);
            XInputController xInputController3 = new XInputController(2);
            XInputController xInputController4 = new XInputController(3);

            // Place all controllers in Controllers list.
            Controllers.AddRange(DInputManager.RetrieveDevices());
            Controllers.Add(xInputController1);
            Controllers.Add(xInputController2);
            Controllers.Add(xInputController3);
            Controllers.Add(xInputController4);

            // Fire hotplug delegate.
            ControllerHotplugEventDelegate?.Invoke();
        }
예제 #11
0
 private void Clear()
 {
     this.root = new Isop.Client.Transfer.Root();
     GlobalParameters.Clear();
     Controllers.Clear();
 }
예제 #12
0
        public bool Initialize()
        {
            string gg  = eXtensibleWebApiConfig.CatchAll;
            Guid   gid = new Guid(gg);

            _IsInitialized = Controllers != null && Controllers.Count() > 0;
            int i = 1;

            if (_IsInitialized)
            {
                List <Endpoint> list = new List <Endpoint>();


                string filepath = HostingEnvironment.MapPath("~/app_data/api.endpoints.xml");
                info = new FileInfo(filepath);
                if (!info.Exists)
                {
                    foreach (var endpoint in this)
                    {
                        var item = new Endpoint()
                        {
                            SortOrder        = i++,
                            Id               = endpoint.EndpointId.ToString(),
                            Name             = endpoint.EndpointName,
                            Description      = endpoint.EndpointDescription,
                            RoutePattern     = endpoint.EndpointRouteTablePattern,
                            WhitelistPattern = endpoint.EndpointWhitelistPattern,
                            Version          = endpoint.EndpointVersion
                        };
                        list.Add(item);
                    }

                    GenericSerializer.WriteGenericList <Endpoint>(list, info.FullName);
                }
                else
                {
                    List <Endpoint> endpoints = GenericSerializer.ReadGenericList <Endpoint>(info.FullName);

                    // IF endpoints came from existing, then order
                    List <Guid> burned = new List <Guid>();

                    foreach (Endpoint orderedEndpoint in endpoints)
                    {
                        Guid g = new Guid(orderedEndpoint.Id);

                        var found = Controllers.Find(x => x.EndpointId.Equals(g));
                        if (found != null && found.EndpointId != gid)
                        {
                            if (found != null)
                            {
                                burned.Add(g);
                                _OrderedControllers.Add(found);
                            }
                        }
                    }
                    // add any discovered, unordered controllers
                    // to the tail of the explicitly ordered controllers
                    foreach (var controller in Controllers)
                    {
                        if (!burned.Contains(controller.EndpointId) && controller.EndpointId != gid)
                        {
                            _OrderedControllers.Add(controller);
                        }
                    }
                    if (CatchAllController != null)
                    {
                        _OrderedControllers.Add(CatchAllController);
                    }
                    Controllers.Clear();
                    Controllers = _OrderedControllers;

                    foreach (IEndpointController item in _OrderedControllers)
                    {
                        Endpoint model = new Endpoint();
                        model.SortOrder        = i++;
                        model.Id               = item.EndpointId.ToString();
                        model.Name             = item.EndpointName;
                        model.Description      = item.EndpointDescription;
                        model.RoutePattern     = item.EndpointRouteTablePattern;
                        model.WhitelistPattern = item.EndpointWhitelistPattern;
                        model.Version          = item.EndpointVersion;
                        list.Add(model);
                    }



                    // if not under 'development', then persist the
                    // ordered controllers to datastore
                    if (eXtensibleWebApiConfig.IsEditRegistration)
                    {
                        var found = list.Find(x => new Guid(x.Id) == gid);
                        if (found != null)
                        {
                            list.Remove(found);
                        }
                        WriteToDatastore(list);
                    }
                }

                _Endpoints = list;
            }
            return(_IsInitialized);
        }
예제 #13
0
 private static void InitializeOnEnterPlayMode()
 {
     ManagedLog.LogMethod(type: ManagedLog.Type.Structure);
     Controllers.Clear();
     Views.Clear();
 }