Ejemplo n.º 1
0
        public MainNotifyIcon(IContainer container, CoreInvoker coreInvoker)
        {
            _coreInvoker = coreInvoker;
            _container   = container;

            #region Initialization

            _notifyIcon = new NotifyIcon(container)
            {
                Text    = Application.ProductName,
                Icon    = coreInvoker.GetIcon(),
                Visible = true
            };

            _notifyIcon.MouseClick += (s, e) =>
            {
                _notifyIcon.Icon = coreInvoker.GetIcon();
                if (e.Button != MouseButtons.Right)
                {
                    return;
                }

                MainContextMenuInstance.Show();
            };

            #endregion
        }
Ejemplo n.º 2
0
        public MainSettingForm(IContainer container, CoreInvoker coreInvoker)
        {
            _container   = container;
            _coreInvoker = coreInvoker;
            InitializeComponent();

            VisibleChanged += (s, e) =>
            {
                if (Visible)
                {
                    Activate();
                }
            };
            Activated += (s, e) => ChangeTheme();

            #region Initialization

            LoadText();

            LoadSettings();

            LoadEvent();

            #endregion
        }
Ejemplo n.º 3
0
        public SettingFormViewModel(CoreInvoker coreInvoker)
        {
            _coreInvoker = coreInvoker;
            GetUserSettings();
            GetCultureResource();

            #region Command

            #endregion

            #region AutoModegroupBox

            this.WhenAnyValue(p => p.IsSettingDisable)
            .Where(p => p)
            .Subscribe(_ => coreInvoker.ModeSwitch.SetAutoMode(AutoModeType.Disable));

            this.WhenAnyValue(p => p.IsSettingForegroundMode)
            .Where(p => p)
            .Subscribe(_ => coreInvoker.ModeSwitch.SetAutoMode(AutoModeType.ForegroundMode));

            this.WhenAnyValue(p => p.IsSettingBlacklistMode)
            .Where(p => p)
            .Subscribe(_ => coreInvoker.ModeSwitch.SetAutoMode(AutoModeType.BlacklistMode));

            this.WhenAnyValue(p => p.IsSettingWhitelistMode)
            .Where(p => p)
            .Subscribe(_ => coreInvoker.ModeSwitch.SetAutoMode(AutoModeType.WhitelistMode));

            // todo

            #endregion
        }
Ejemplo n.º 4
0
        public MainNotifyIcon(IContainer container, CoreInvoker coreInvoker)
        {
            _coreInvoker = coreInvoker;

            #region Initialization

            _notifyIcon = new NotifyIcon(container)
            {
                Text    = Application.ProductName,
                Icon    = coreInvoker.GetIcon(),
                Visible = true
            };

            _notifyIcon.MouseClick += _notifyIcon_MouseClick;

            #endregion
        }
Ejemplo n.º 5
0
        public MainContextMenu(IContainer container, CoreInvoker coreInvoker)
        {
            InitializeComponent();

            _container   = container;
            _coreInvoker = coreInvoker;

            VisibleChanged += (s, e) =>
            {
                if (Visible)
                {
                    Activate();
                }
            };
            Activated += (s, e) =>
            {
                ChangeTheme();
                SetPosition();
            };
            Deactivate += (s, e) => Hide();

            #region Initialization

            exitMenuButton.Text   = coreInvoker.GetText("TrayExit");
            exitMenuButton.Image  = Resources.Empty;
            exitMenuButton.Click += (s, e) => Application.Exit();

            stopButton.Text   = coreInvoker.GetText("TrayStop");
            stopButton.Click += (s, e) =>
            {
                _coreInvoker.UserSettings.ModeType = AutoModeType.Disable;
                _coreInvoker.ModeSwitch.LoadSetting();
                SetAutoModeTypeIcon();
                _coreInvoker.SaveUserSettings();
            };

            WhitelistButton.Text   = coreInvoker.GetText("TrayWhitelistMode");
            WhitelistButton.Click += (s, e) =>
            {
                _coreInvoker.UserSettings.ModeType = AutoModeType.WhitelistMode;
                _coreInvoker.ModeSwitch.LoadSetting();
                SetAutoModeTypeIcon();
                _coreInvoker.SaveUserSettings();
            };

            BlacklistButton.Text   = coreInvoker.GetText("TrayBlacklistMode");
            BlacklistButton.Click += (s, e) =>
            {
                _coreInvoker.UserSettings.ModeType = AutoModeType.BlacklistMode;
                _coreInvoker.ModeSwitch.LoadSetting();
                SetAutoModeTypeIcon();
                _coreInvoker.SaveUserSettings();
            };

            foreButton.Text   = coreInvoker.GetText("TrayAutoMode2");
            foreButton.Click += (s, e) =>
            {
                _coreInvoker.UserSettings.ModeType = AutoModeType.ForegroundMode;
                _coreInvoker.ModeSwitch.LoadSetting();
                SetAutoModeTypeIcon();
                _coreInvoker.SaveUserSettings();
            };

            apiButton.Text   = coreInvoker.GetText("TrayAutoMode1");
            apiButton.Click += (s, e) =>
            {
                _coreInvoker.UserSettings.ModeType = AutoModeType.AutoHideApiMode;
                _coreInvoker.ModeSwitch.LoadSetting();
                SetAutoModeTypeIcon();
                _coreInvoker.SaveUserSettings();
            };

            settingsButton.Text = coreInvoker.GetText("TraySettings");

            aboutButton.Text   = coreInvoker.GetText("TrayAbout");
            aboutButton.Image  = Resources.Empty;
            aboutButton.Click += (s, e) => Process.Start("https://github.com/ChanpleCai/SmartTaskbar/releases");

            #endregion
        }
Ejemplo n.º 6
0
        public SettingForm(CoreInvoker taskbarController)
        {
            InitializeComponent();

            #region Reactive Binding

            ViewModel = new SettingFormViewModel(taskbarController);

            this.WhenActivated(disposables =>
            {
                #region Icon

                this.OneWayBind(ViewModel,
                                m => m.IconStyle,
                                v => v.Icon,
                                vmToViewConverterOverride: new IconStyleIconConverter())
                .DisposeWith(disposables);

                #endregion

                #region Text

                #region AutoModeGroupBox

                this.OneWayBind(ViewModel,
                                m => m.SettingModeText,
                                v => v.groupBox_AutoMode.Text)
                .DisposeWith(disposables);

                this.OneWayBind(ViewModel,
                                m => m.SettingDisableText,
                                v => v.radioButtonDisableMode.Text)
                .DisposeWith(disposables);

                this.OneWayBind(ViewModel,
                                m => m.SettingForegroundModeText,
                                v => v.radioButtonForegroundMode.Text)
                .DisposeWith(disposables);

                this.OneWayBind(ViewModel,
                                m => m.SettingBlacklistModeText,
                                v => v.radioButtonBlacklistMode.Text)
                .DisposeWith(disposables);

                this.OneWayBind(ViewModel,
                                m => m.SettingWhitelistModeText,
                                v => v.radioButtonWhitelistMode.Text)
                .DisposeWith(disposables);

                #endregion

                #endregion

                #region AutoModeGroupBox

                this.Bind(ViewModel,
                          m => m.IsSettingDisable,
                          v => v.radioButtonDisableMode.Checked);

                this.Bind(ViewModel,
                          m => m.IsSettingForegroundMode,
                          v => v.radioButtonForegroundMode.Checked);

                this.Bind(ViewModel,
                          m => m.IsSettingBlacklistMode,
                          v => v.radioButtonBlacklistMode.Checked);

                this.Bind(ViewModel,
                          m => m.IsSettingWhitelistMode,
                          v => v.radioButtonWhitelistMode.Checked);

                #endregion
            });

            #endregion
        }
Ejemplo n.º 7
0
        public Tray(IContainer container, CoreInvoker autotaskbarController)
        {
            _autotaskbarController = autotaskbarController;

            #region Initialization

            ViewModel = new TrayViewModel(autotaskbarController);
            var font = new Font("Segoe UI", 9F);

            _settings = new ToolStripMenuItem
            {
                Text = ViewModel.TraySettingsText,
                Font = font
            };

            _exit = new ToolStripMenuItem
            {
                Text = ViewModel.TrayExitText,
                Font = font
            };

            var contextMenuStrip = new ContextMenuStrip(container)
            {
                Renderer = new TrayRenderer()
            };

            contextMenuStrip.Items.AddRange(new ToolStripItem[]
            {
                _settings,
                new ToolStripSeparator(),
                _exit
            });

            _notifyIcon = new NotifyIcon(container)
            {
                ContextMenuStrip = contextMenuStrip,
                Text             = Application.ProductName,
                Icon             = GetIcon(),
                Visible          = true
            };

            _settings.Click += Settings_Click;
            _exit.Click     += Exit_Click;
            _notifyIcon.MouseDoubleClick += NotifyIcon_MouseDoubleClick;

            #endregion

            #region Reactive Binding

            this.WhenActivated(disposables =>
            {
                this.OneWayBind(ViewModel, model => model.IconStyle,
                                view => view._notifyIcon.Icon,
                                vmToViewConverterOverride: new IconStyleIconConverter())
                .DisposeWith(disposables);

                this.OneWayBind(ViewModel, model => model.TraySettingsText,
                                view => view._settings.Text)
                .DisposeWith(disposables);

                this.OneWayBind(ViewModel, model => model.TrayExitText,
                                view => view._exit.Text)
                .DisposeWith(disposables);
            });

            #endregion
        }
Ejemplo n.º 8
0
 public CultureResource(CoreInvoker coreInvoker)
 {
     _coreInvoker = coreInvoker;
     LanguageChange();
 }
Ejemplo n.º 9
0
 public MainSettingForm(IContainer container, CoreInvoker coreInvoker)
 {
     InitializeComponent();
 }
Ejemplo n.º 10
0
 public TrayViewModel(CoreInvoker coreInvoker)
 {
     _coreInvoker = coreInvoker;
     GetUserConfig();
     GetCultureResource();
 }
Ejemplo n.º 11
0
        public MainSettingForm(IContainer container, CoreInvoker coreInvoker)
        {
            _container   = container;
            _coreInvoker = coreInvoker;
            InitializeComponent();

            VisibleChanged += (s, e) =>
            {
                if (Visible)
                {
                    Activate();
                }
            };
            Activated  += (s, e) => ChangeTheme();
            Deactivate += (s, e) => Hide();

            #region Initialization

            #region Text

            groupBoxState0.Text = coreInvoker.GetText("SettTaskbarState0");
            groupBoxState1.Text = coreInvoker.GetText("SettTaskbarState1");
            groupBoxState2.Text = coreInvoker.GetText("SettTaskbarState2");

            groupBoxTransparentMode0.Text         =
                groupBoxTransparentMode1.Text     =
                    groupBoxTransparentMode2.Text =
                        coreInvoker.GetText("SettTransparentMode");

            checkBoxIsAutoHide0.Text         =
                checkBoxIsAutoHide1.Text     =
                    checkBoxIsAutoHide2.Text =
                        coreInvoker.GetText("SettIsAutoHide");

            checkBoxHideTaskbar0.Text         =
                checkBoxHideTaskbar1.Text     =
                    checkBoxHideTaskbar2.Text =
                        coreInvoker.GetText("SettHideTaskbar");

            checkBoxIconSize0.Text         =
                checkBoxIconSize1.Text     =
                    checkBoxIconSize2.Text =
                        coreInvoker.GetText("SettIconSize");

            radioButtonDisable0.Text         =
                radioButtonDisable1.Text     =
                    radioButtonDisable2.Text =
                        coreInvoker.GetText("SettDisable");

            radioButtonTransparent0.Text         =
                radioButtonTransparent1.Text     =
                    radioButtonTransparent2.Text =
                        coreInvoker.GetText("SettTransparent");

            radioButtonBlur0.Text         =
                radioButtonBlur1.Text     =
                    radioButtonBlur2.Text =
                        coreInvoker.GetText("SettBlur");

            #endregion

            #region Event

            checkBoxIsAutoHide0.CheckedChanged += (s, e) =>
            {
                _coreInvoker.UserSettings.ResetState.IsAutoHide = checkBoxIsAutoHide0.Checked;
                _coreInvoker.SaveUserSettings();
            };

            checkBoxIsAutoHide1.CheckedChanged += (s, e) =>
            {
                _coreInvoker.UserSettings.ReadyState.IsAutoHide = checkBoxIsAutoHide1.Checked;
                _coreInvoker.SaveUserSettings();
            };

            checkBoxIsAutoHide2.CheckedChanged += (s, e) =>
            {
                _coreInvoker.UserSettings.TargetState.IsAutoHide = checkBoxIsAutoHide2.Checked;
                _coreInvoker.SaveUserSettings();
            };

            checkBoxHideTaskbar0.CheckedChanged += (s, e) =>
            {
                _coreInvoker.UserSettings.ResetState.HideTaskbarCompletely = checkBoxHideTaskbar0.Checked;
                _coreInvoker.SaveUserSettings();
            };

            checkBoxHideTaskbar1.CheckedChanged += (s, e) =>
            {
                _coreInvoker.UserSettings.ReadyState.HideTaskbarCompletely = checkBoxHideTaskbar1.Checked;
                _coreInvoker.SaveUserSettings();
            };

            checkBoxHideTaskbar2.CheckedChanged += (s, e) =>
            {
                _coreInvoker.UserSettings.TargetState.HideTaskbarCompletely = checkBoxHideTaskbar2.Checked;
                _coreInvoker.SaveUserSettings();
            };

            checkBoxIconSize0.CheckedChanged += (s, e) =>
            {
                _coreInvoker.UserSettings.ResetState.IconSize = checkBoxIconSize0.Checked ? Constant.IconSmall : Constant.IconLarge;
                _coreInvoker.SaveUserSettings();
            };

            checkBoxIconSize1.CheckedChanged += (s, e) =>
            {
                _coreInvoker.UserSettings.ReadyState.IconSize = checkBoxIconSize1.Checked ? Constant.IconSmall : Constant.IconLarge;
                _coreInvoker.SaveUserSettings();
            };

            checkBoxIconSize2.CheckedChanged += (s, e) =>
            {
                _coreInvoker.UserSettings.TargetState.IconSize = checkBoxIconSize2.Checked ? Constant.IconSmall : Constant.IconLarge;
                _coreInvoker.SaveUserSettings();
            };

            radioButtonDisable0.CheckedChanged += (s, e) =>
            {
                if (!radioButtonDisable0.Checked)
                {
                    return;
                }

                _coreInvoker.UserSettings.ResetState.TransparentMode = TransparentModeType.Disable;
                _coreInvoker.SaveUserSettings();
            };

            radioButtonDisable1.CheckedChanged += (s, e) =>
            {
                if (!radioButtonDisable1.Checked)
                {
                    return;
                }

                _coreInvoker.UserSettings.ReadyState.TransparentMode = TransparentModeType.Disable;
                _coreInvoker.SaveUserSettings();
            };

            radioButtonDisable2.CheckedChanged += (s, e) =>
            {
                if (!radioButtonDisable2.Checked)
                {
                    return;
                }

                _coreInvoker.UserSettings.TargetState.TransparentMode = TransparentModeType.Disable;
                _coreInvoker.SaveUserSettings();
            };

            radioButtonTransparent0.CheckedChanged += (s, e) =>
            {
                if (!radioButtonTransparent0.Checked)
                {
                    return;
                }

                _coreInvoker.UserSettings.ResetState.TransparentMode = TransparentModeType.Transparent;
                _coreInvoker.SaveUserSettings();
            };

            radioButtonTransparent1.CheckedChanged += (s, e) =>
            {
                if (!radioButtonTransparent1.Checked)
                {
                    return;
                }

                _coreInvoker.UserSettings.ReadyState.TransparentMode = TransparentModeType.Transparent;
                _coreInvoker.SaveUserSettings();
            };

            radioButtonTransparent2.CheckedChanged += (s, e) =>
            {
                if (!radioButtonTransparent2.Checked)
                {
                    return;
                }

                _coreInvoker.UserSettings.TargetState.TransparentMode = TransparentModeType.Transparent;
                _coreInvoker.SaveUserSettings();
            };

            radioButtonBlur0.CheckedChanged += (s, e) =>
            {
                if (!radioButtonBlur0.Checked)
                {
                    return;
                }

                _coreInvoker.UserSettings.ResetState.TransparentMode = TransparentModeType.Blur;
                _coreInvoker.SaveUserSettings();
            };

            radioButtonBlur1.CheckedChanged += (s, e) =>
            {
                if (!radioButtonBlur1.Checked)
                {
                    return;
                }

                _coreInvoker.UserSettings.ReadyState.TransparentMode = TransparentModeType.Blur;
                _coreInvoker.SaveUserSettings();
            };

            radioButtonBlur2.CheckedChanged += (s, e) =>
            {
                if (!radioButtonBlur2.Checked)
                {
                    return;
                }

                _coreInvoker.UserSettings.TargetState.TransparentMode = TransparentModeType.Blur;
                _coreInvoker.SaveUserSettings();
            };

            #endregion

            LoadSettings();

            #endregion
        }