Esempio n. 1
0
        public void Dispose()
        {
            if (IsDisposed)
            {
                return;
            }

            IsDisposed = true;

            if (CommandViewFactory != null)
            {
                CommandViewFactory.Dispose();
            }

            _config      = null;
            _parser      = null;
            _gestureView = null;
            _intentStore = null;
            _pathTracker = null;

            SupportedCommands.Clear();
            SupportedCommands  = null;
            CommandViewFactory = null;

            _form.Dispose();
            _form = null;

            //GC.Collect();
        }
        public SettingsFormController(IConfig config, GestureParser parser,
                                      Win32MousePathTracker2 pathTracker, JsonGestureIntentStore intentStore,
                                      CanvasWindowGestureView gestureView, GlobalHotKeyManager hotkeyMgr)
        {
            _config      = config;
            _parser      = parser;
            _pathTracker = pathTracker;
            _intentStore = intentStore;
            _gestureView = gestureView;
            _hotkeyMgr   = hotkeyMgr;

            #region 初始化支持的命令和命令视图
            //Add Command Types
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(DoNothingCommand)), typeof(DoNothingCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(HotKeyCommand)), typeof(HotKeyCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(WebSearchCommand)), typeof(WebSearchCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(WindowControlCommand)), typeof(WindowControlCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(TaskSwitcherCommand)), typeof(TaskSwitcherCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(OpenFileCommand)), typeof(OpenFileCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(SendTextCommand)), typeof(SendTextCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(GotoUrlCommand)), typeof(GotoUrlCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(CmdCommand)), typeof(CmdCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(ScriptCommand)), typeof(ScriptCommand));

            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(PauseWGesturesCommand)), typeof(PauseWGesturesCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(ChangeAudioVolumeCommand)), typeof(ChangeAudioVolumeCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(AddToBacklistCommand)), typeof(AddToBacklistCommand));

            CommandViewFactory.Register <AddToBacklistCommand, GeneralNoParameterCommandView>();
            CommandViewFactory.Register <OpenFileCommand, OpenFileCommandView>();
            CommandViewFactory.Register <DoNothingCommand, GeneralNoParameterCommandView>();
            CommandViewFactory.Register <HotKeyCommand, HotKeyCommandView>();
            CommandViewFactory.Register <GotoUrlCommand, GotoUrlCommandView>();
            CommandViewFactory.Register <PauseWGesturesCommand, GeneralNoParameterCommandView>();
            CommandViewFactory.Register <WebSearchCommand, WebSearchCommandView>();
            CommandViewFactory.Register <WindowControlCommand, WindowControlCommandView>();
            CommandViewFactory.Register <CmdCommand, CmdCommandView>();
            CommandViewFactory.Register <SendTextCommand, SendTextCommandView>();
            CommandViewFactory.Register <TaskSwitcherCommand, TaskSwitcherCommandView>();
            CommandViewFactory.Register <ScriptCommand, ScriptCommandView>();
            CommandViewFactory.Register <ChangeAudioVolumeCommand, GeneralNoParameterCommandView>();
            #endregion

            #region Hotcorner
            SupportedHotCornerCommands.Add(NamedAttribute.GetNameOf(typeof(DoNothingCommand)), typeof(DoNothingCommand));
            SupportedHotCornerCommands.Add(NamedAttribute.GetNameOf(typeof(HotKeyCommand)), typeof(HotKeyCommand));
            SupportedHotCornerCommands.Add(NamedAttribute.GetNameOf(typeof(CmdCommand)), typeof(CmdCommand));

            HotCornerCommandViewFactory.Register <DoNothingCommand, GeneralNoParameterCommandView>();
            HotCornerCommandViewFactory.Register <HotKeyCommand, HotKeyCommandView>();
            HotCornerCommandViewFactory.Register <CmdCommand, CmdCommandView>();
            #endregion

            _form = new SettingsForm(this);
        }
Esempio n. 3
0
        public SettingsFormController(IConfig config, GestureParser parser,
                                      Win32MousePathTracker2 pathTracker, JsonGestureIntentStore intentStore,
                                      CanvasWindowGestureView gestureView)
        {
            _config      = config;
            _parser      = parser;
            _pathTracker = pathTracker;
            _intentStore = intentStore;
            _gestureView = gestureView;

            #region 初始化支持的命令和命令视图
            SupportedCommands  = new Dictionary <string, Type>();
            CommandViewFactory = new CommandViewFactory <CommandViewUserControl>()
            {
                EnableCaching = false
            };

            //Add Command Types
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(DoNothingCommand)), typeof(DoNothingCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(HotKeyCommand)), typeof(HotKeyCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(WebSearchCommand)), typeof(WebSearchCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(WindowControlCommand)), typeof(WindowControlCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(TaskSwitcherCommand)), typeof(TaskSwitcherCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(OpenFileCommand)), typeof(OpenFileCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(SendTextCommand)), typeof(SendTextCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(GotoUrlCommand)), typeof(GotoUrlCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(CmdCommand)), typeof(CmdCommand));

            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(PauseWGesturesCommand)), typeof(PauseWGesturesCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(ChangeAudioVolumeCommand)), typeof(ChangeAudioVolumeCommand));



            CommandViewFactory.Register <OpenFileCommand, OpenFileCommandView>();
            CommandViewFactory.Register <DoNothingCommand, GeneralNoParameterCommandView>();
            CommandViewFactory.Register <HotKeyCommand, HotKeyCommandView>();
            CommandViewFactory.Register <GotoUrlCommand, GotoUrlCommandView>();
            CommandViewFactory.Register <PauseWGesturesCommand, GeneralNoParameterCommandView>();
            CommandViewFactory.Register <WebSearchCommand, WebSearchCommandView>();
            CommandViewFactory.Register <WindowControlCommand, WindowControlCommandView>();
            CommandViewFactory.Register <CmdCommand, CmdCommandView>();
            CommandViewFactory.Register <SendTextCommand, SendTextCommandView>();
            CommandViewFactory.Register <TaskSwitcherCommand, TaskSwitcherCommandView>();

            CommandViewFactory.Register <ChangeAudioVolumeCommand, GeneralNoParameterCommandView>();



            #endregion

            _form = new SettingsForm(this);
        }
        public SettingsFormController(IConfig config, GestureParser parser,
            Win32MousePathTracker2 pathTracker, JsonGestureIntentStore intentStore,
            CanvasWindowGestureView gestureView)
        {
            _config = config;
            _parser = parser;
            _pathTracker = pathTracker;
            _intentStore = intentStore;
            _gestureView = gestureView;

            #region 初始化支持的命令和命令视图
            SupportedCommands = new Dictionary<string, Type>();
            CommandViewFactory = new CommandViewFactory<CommandViewUserControl>() { EnableCaching = false };

            //Add Command Types
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(DoNothingCommand)), typeof(DoNothingCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(HotKeyCommand)), typeof(HotKeyCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(WebSearchCommand)), typeof(WebSearchCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(WindowControlCommand)), typeof(WindowControlCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(TaskSwitcherCommand)), typeof(TaskSwitcherCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(OpenFileCommand)), typeof(OpenFileCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(SendTextCommand)), typeof(SendTextCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(GotoUrlCommand)), typeof(GotoUrlCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(CmdCommand)), typeof(CmdCommand));

            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(PauseWGesturesCommand)), typeof(PauseWGesturesCommand));
            SupportedCommands.Add(NamedAttribute.GetNameOf(typeof(ChangeAudioVolumeCommand)), typeof(ChangeAudioVolumeCommand));

            CommandViewFactory.Register<OpenFileCommand, OpenFileCommandView>();
            CommandViewFactory.Register<DoNothingCommand, GeneralNoParameterCommandView>();
            CommandViewFactory.Register<HotKeyCommand, HotKeyCommandView>();
            CommandViewFactory.Register<GotoUrlCommand, GotoUrlCommandView>();
            CommandViewFactory.Register<PauseWGesturesCommand, GeneralNoParameterCommandView>();
            CommandViewFactory.Register<WebSearchCommand, WebSearchCommandView>();
            CommandViewFactory.Register<WindowControlCommand, WindowControlCommandView>();
            CommandViewFactory.Register<CmdCommand, CmdCommandView>();
            CommandViewFactory.Register<SendTextCommand, SendTextCommandView>();
            CommandViewFactory.Register<TaskSwitcherCommand, TaskSwitcherCommandView>();

            CommandViewFactory.Register<ChangeAudioVolumeCommand, GeneralNoParameterCommandView>();

            #endregion

            _form = new SettingsForm(this);
        }