Example #1
0
        private void LoadConfig()
        {
            RedmineBaseUrlTextBox.Text     = Settings.Default.RedmineURL;
            AuthenticationCheckBox.Checked = Settings.Default.RedmineAuthentication;
            RedmineUsernameTextBox.Text    = Settings.Default.RedmineUser;
            RedminePasswordTextBox.Text    = Settings.Default.RedminePassword;
            radioButtonJson.Checked        = Settings.Default.CommunicationType == Net.Api.MimeFormat.json;
            radioButtonXml.Checked         = Settings.Default.CommunicationType != Net.Api.MimeFormat.json;

            MinimizeToSystemTrayCheckBox.Checked = Settings.Default.MinimizeToSystemTray;
            MinimizeOnStartTimerCheckBox.Checked = Settings.Default.MinimizeOnStartTimer;
            CheckForUpdatesCheckBox.Checked      = Settings.Default.CheckForUpdates;
            CacheLifetime.Value = Settings.Default.CacheLifetime;
            PopupTimout.Value   = Settings.Default.PopupInterval;
            PauseTimerOnLockCheckBox.Checked     = Settings.Default.PauseTickingOnLock;
            RedmineVersionComboBox.SelectedIndex = RedmineVersionComboBox.FindStringExact(Languages.LangTools.GetTextForApiVersion((ApiVersion)Settings.Default.ApiVersion));
            UpdateIssueIfStateCheckBox.Checked   = Settings.Default.UpdateIssueIfNew;
            try {
                Languages.Lang.Culture = new System.Globalization.CultureInfo(Settings.Default.LanguageCode);
            }
            catch (Exception)
            {
                Languages.Lang.Culture = System.Globalization.CultureInfo.CurrentUICulture;
            }
            LanguageComboBox.SelectedIndex  = LanguageComboBox.FindStringExact(Languages.Lang.Culture.DisplayName);
            AddNoteOnChangeCheckBox.Checked = Settings.Default.AddNoteOnChangeStatus;
            OnlyShowMyProjects.Checked      = Settings.Default.OnlyMyProjects;
        }
Example #2
0
 private void LanguageSelector_GotFocus(object sender, RoutedEventArgs e)
 {
     Dispatcher.BeginInvoke(
         DispatcherPriority.ContextIdle,
         new Action(delegate()
     {
         LanguageComboBox.Focus();
     }));
 }
Example #3
0
        protected void RefreshLanguages()
        {
            int currentIndex = LanguageComboBox.FindString(CultureInfo.CurrentUICulture.TwoLetterISOLanguageName);

            if (currentIndex != -1)
            {
                SelectedIndex = currentIndex;
            }
            else
            {
                SelectedIndex = LanguageComboBox.FindString("العربية");
            }
        }
Example #4
0
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            this.Loaded -= OnLoaded;

            var mainWindowViewModel = Window.GetWindow(this)?.DataContext as MainWindowViewModel;

            if (mainWindowViewModel is null)
            {
                return;
            }

            // Binding in xaml will not work because MainWindowViewModel may be null when Options is instantiated.
            var booleanInverseConverter = new BooleanInverseConverter();

            PathGroupBox.SetBinding(
                UIElement.IsEnabledProperty,
                new Binding(nameof(MainWindowViewModel.IsCheckOrCopyOngoing))
            {
                Source    = mainWindowViewModel,
                Mode      = BindingMode.OneWay,
                Converter = booleanInverseConverter
            });

            FileGroupBox.SetBinding(
                UIElement.IsEnabledProperty,
                new Binding(nameof(MainWindowViewModel.IsCheckOrCopyOngoing))
            {
                Source    = mainWindowViewModel,
                Mode      = BindingMode.OneWay,
                Converter = booleanInverseConverter
            });

            ChooseDeleteOnCopyButton.SetBinding(
                SlidingToggleButton.IsCheckedCopyProperty,
                new Binding(nameof(MainWindowViewModel.IsBrowserOpen))
            {
                Source = mainWindowViewModel,
                Mode   = BindingMode.OneWayToSource,
            });

            LanguageComboBox.SetBinding(
                UIElement.IsEnabledProperty,
                new Binding(nameof(MainWindowViewModel.IsCheckOrCopyOngoing))
            {
                Source    = mainWindowViewModel,
                Mode      = BindingMode.OneWay,
                Converter = booleanInverseConverter
            });
        }
Example #5
0
        public Options(MainWindow mainWindow)
        {
            InitializeComponent();

            _mainWindowViewModel = mainWindow?.DataContext as MainWindowViewModel ?? throw new InvalidOperationException();
            this.DataContext     = new OptionsViewModel(_mainWindowViewModel.Settings);

            // If Options is defined in MainWindow's xaml, it will be instantiated before MainWindowViewModel
            // and so binding to MainWindowViewModel will not work.
            var booleanInverseConverter = new BooleanInverseConverter();

            PathGroupBox.SetBinding(
                UIElement.IsEnabledProperty,
                new Binding(nameof(MainWindowViewModel.IsCheckOrCopyOngoing))
            {
                Source    = _mainWindowViewModel,
                Mode      = BindingMode.OneWay,
                Converter = booleanInverseConverter
            });

            FileGroupBox.SetBinding(
                UIElement.IsEnabledProperty,
                new Binding(nameof(MainWindowViewModel.IsCheckOrCopyOngoing))
            {
                Source    = _mainWindowViewModel,
                Mode      = BindingMode.OneWay,
                Converter = booleanInverseConverter
            });

            LanguageComboBox.SetBinding(
                UIElement.IsEnabledProperty,
                new Binding(nameof(MainWindowViewModel.IsCheckOrCopyOngoing))
            {
                Source    = _mainWindowViewModel,
                Mode      = BindingMode.OneWay,
                Converter = booleanInverseConverter
            });
        }
Example #6
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (disposing)
            {
                if (ActiveConfig == this)
                {
                    ActiveConfig = null;
                }

                if (TabControl != null)
                {
                    if (!TabControl.IsDisposed)
                    {
                        TabControl.Dispose();
                    }

                    TabControl = null;
                }

                if (KeyBindWindow != null)
                {
                    if (!KeyBindWindow.IsDisposed)
                    {
                        KeyBindWindow.Dispose();
                    }

                    KeyBindWindow = null;
                }

                #region Graphics
                if (GraphicsTab != null)
                {
                    if (!GraphicsTab.IsDisposed)
                    {
                        GraphicsTab.Dispose();
                    }

                    GraphicsTab = null;
                }

                if (FullScreenCheckBox != null)
                {
                    if (!FullScreenCheckBox.IsDisposed)
                    {
                        FullScreenCheckBox.Dispose();
                    }

                    FullScreenCheckBox = null;
                }

                if (VSyncCheckBox != null)
                {
                    if (!VSyncCheckBox.IsDisposed)
                    {
                        VSyncCheckBox.Dispose();
                    }

                    VSyncCheckBox = null;
                }

                if (LimitFPSCheckBox != null)
                {
                    if (!LimitFPSCheckBox.IsDisposed)
                    {
                        LimitFPSCheckBox.Dispose();
                    }

                    LimitFPSCheckBox = null;
                }

                if (ClipMouseCheckBox != null)
                {
                    if (!ClipMouseCheckBox.IsDisposed)
                    {
                        ClipMouseCheckBox.Dispose();
                    }

                    ClipMouseCheckBox = null;
                }
                if (DebugLabelCheckBox != null)
                {
                    if (!DebugLabelCheckBox.IsDisposed)
                    {
                        DebugLabelCheckBox.Dispose();
                    }

                    DebugLabelCheckBox = null;
                }

                if (GameSizeComboBox != null)
                {
                    if (!GameSizeComboBox.IsDisposed)
                    {
                        GameSizeComboBox.Dispose();
                    }

                    GameSizeComboBox = null;
                }
                if (LanguageComboBox != null)
                {
                    if (!LanguageComboBox.IsDisposed)
                    {
                        LanguageComboBox.Dispose();
                    }

                    LanguageComboBox = null;
                }

                #endregion

                #region Sound
                if (SoundTab != null)
                {
                    if (!SoundTab.IsDisposed)
                    {
                        SoundTab.Dispose();
                    }

                    SoundTab = null;
                }

                if (SystemVolumeBox != null)
                {
                    if (!SystemVolumeBox.IsDisposed)
                    {
                        SystemVolumeBox.Dispose();
                    }

                    SystemVolumeBox = null;
                }

                if (MusicVolumeBox != null)
                {
                    if (!MusicVolumeBox.IsDisposed)
                    {
                        MusicVolumeBox.Dispose();
                    }

                    MusicVolumeBox = null;
                }

                if (PlayerVolumeBox != null)
                {
                    if (!PlayerVolumeBox.IsDisposed)
                    {
                        PlayerVolumeBox.Dispose();
                    }

                    PlayerVolumeBox = null;
                }

                if (MonsterVolumeBox != null)
                {
                    if (!MonsterVolumeBox.IsDisposed)
                    {
                        MonsterVolumeBox.Dispose();
                    }

                    MonsterVolumeBox = null;
                }

                if (SpellVolumeBox != null)
                {
                    if (!SpellVolumeBox.IsDisposed)
                    {
                        SpellVolumeBox.Dispose();
                    }

                    SpellVolumeBox = null;
                }

                if (BackgroundSoundBox != null)
                {
                    if (!BackgroundSoundBox.IsDisposed)
                    {
                        BackgroundSoundBox.Dispose();
                    }

                    BackgroundSoundBox = null;
                }
                #endregion

                #region Game
                if (GameTab != null)
                {
                    if (!GameTab.IsDisposed)
                    {
                        GameTab.Dispose();
                    }

                    GameTab = null;
                }

                if (ItemNameCheckBox != null)
                {
                    if (!ItemNameCheckBox.IsDisposed)
                    {
                        ItemNameCheckBox.Dispose();
                    }

                    ItemNameCheckBox = null;
                }

                if (MonsterNameCheckBox != null)
                {
                    if (!MonsterNameCheckBox.IsDisposed)
                    {
                        MonsterNameCheckBox.Dispose();
                    }

                    MonsterNameCheckBox = null;
                }

                if (PlayerNameCheckBox != null)
                {
                    if (!PlayerNameCheckBox.IsDisposed)
                    {
                        PlayerNameCheckBox.Dispose();
                    }

                    PlayerNameCheckBox = null;
                }

                if (UserHealthCheckBox != null)
                {
                    if (!UserHealthCheckBox.IsDisposed)
                    {
                        UserHealthCheckBox.Dispose();
                    }

                    UserHealthCheckBox = null;
                }

                if (MonsterHealthCheckBox != null)
                {
                    if (!MonsterHealthCheckBox.IsDisposed)
                    {
                        MonsterHealthCheckBox.Dispose();
                    }

                    MonsterHealthCheckBox = null;
                }

                if (DamageNumbersCheckBox != null)
                {
                    if (!DamageNumbersCheckBox.IsDisposed)
                    {
                        DamageNumbersCheckBox.Dispose();
                    }

                    DamageNumbersCheckBox = null;
                }

                if (EscapeCloseAllCheckBox != null)
                {
                    if (!EscapeCloseAllCheckBox.IsDisposed)
                    {
                        EscapeCloseAllCheckBox.Dispose();
                    }

                    EscapeCloseAllCheckBox = null;
                }

                if (ShiftOpenChatCheckBox != null)
                {
                    if (!ShiftOpenChatCheckBox.IsDisposed)
                    {
                        ShiftOpenChatCheckBox.Dispose();
                    }

                    ShiftOpenChatCheckBox = null;
                }

                if (RightClickDeTargetCheckBox != null)
                {
                    if (!RightClickDeTargetCheckBox.IsDisposed)
                    {
                        RightClickDeTargetCheckBox.Dispose();
                    }

                    RightClickDeTargetCheckBox = null;
                }

                if (MonsterBoxVisibleCheckBox != null)
                {
                    if (!MonsterBoxVisibleCheckBox.IsDisposed)
                    {
                        MonsterBoxVisibleCheckBox.Dispose();
                    }

                    MonsterBoxVisibleCheckBox = null;
                }

                if (LogChatCheckBox != null)
                {
                    if (!LogChatCheckBox.IsDisposed)
                    {
                        LogChatCheckBox.Dispose();
                    }

                    LogChatCheckBox = null;
                }


                if (KeyBindButton != null)
                {
                    if (!KeyBindButton.IsDisposed)
                    {
                        KeyBindButton.Dispose();
                    }

                    KeyBindButton = null;
                }
                #endregion

                #region Network
                if (NetworkTab != null)
                {
                    if (!NetworkTab.IsDisposed)
                    {
                        NetworkTab.Dispose();
                    }

                    NetworkTab = null;
                }

                if (UseNetworkConfigCheckBox != null)
                {
                    if (!UseNetworkConfigCheckBox.IsDisposed)
                    {
                        UseNetworkConfigCheckBox.Dispose();
                    }

                    UseNetworkConfigCheckBox = null;
                }

                if (IPAddressTextBox != null)
                {
                    if (!IPAddressTextBox.IsDisposed)
                    {
                        IPAddressTextBox.Dispose();
                    }

                    IPAddressTextBox = null;
                }

                if (PortBox != null)
                {
                    if (!PortBox.IsDisposed)
                    {
                        PortBox.Dispose();
                    }

                    PortBox = null;
                }
                #endregion

                #region Colours
                if (ColourTab != null)
                {
                    if (!ColourTab.IsDisposed)
                    {
                        ColourTab.Dispose();
                    }

                    ColourTab = null;
                }

                if (LocalColourBox != null)
                {
                    if (!LocalColourBox.IsDisposed)
                    {
                        LocalColourBox.Dispose();
                    }

                    LocalColourBox = null;
                }

                if (GMWhisperInColourBox != null)
                {
                    if (!GMWhisperInColourBox.IsDisposed)
                    {
                        GMWhisperInColourBox.Dispose();
                    }

                    GMWhisperInColourBox = null;
                }

                if (WhisperInColourBox != null)
                {
                    if (!WhisperInColourBox.IsDisposed)
                    {
                        WhisperInColourBox.Dispose();
                    }

                    WhisperInColourBox = null;
                }

                if (WhisperOutColourBox != null)
                {
                    if (!WhisperOutColourBox.IsDisposed)
                    {
                        WhisperOutColourBox.Dispose();
                    }

                    WhisperOutColourBox = null;
                }

                if (GroupColourBox != null)
                {
                    if (!GroupColourBox.IsDisposed)
                    {
                        GroupColourBox.Dispose();
                    }

                    GroupColourBox = null;
                }

                if (GuildColourBox != null)
                {
                    if (!GuildColourBox.IsDisposed)
                    {
                        GuildColourBox.Dispose();
                    }

                    GuildColourBox = null;
                }

                if (ShoutColourBox != null)
                {
                    if (!ShoutColourBox.IsDisposed)
                    {
                        ShoutColourBox.Dispose();
                    }

                    ShoutColourBox = null;
                }

                if (GlobalColourBox != null)
                {
                    if (!GlobalColourBox.IsDisposed)
                    {
                        GlobalColourBox.Dispose();
                    }

                    GlobalColourBox = null;
                }

                if (ObserverColourBox != null)
                {
                    if (!ObserverColourBox.IsDisposed)
                    {
                        ObserverColourBox.Dispose();
                    }

                    ObserverColourBox = null;
                }

                if (HintColourBox != null)
                {
                    if (!HintColourBox.IsDisposed)
                    {
                        HintColourBox.Dispose();
                    }

                    HintColourBox = null;
                }

                if (SystemColourBox != null)
                {
                    if (!SystemColourBox.IsDisposed)
                    {
                        SystemColourBox.Dispose();
                    }

                    SystemColourBox = null;
                }

                if (GainsColourBox != null)
                {
                    if (!GainsColourBox.IsDisposed)
                    {
                        GainsColourBox.Dispose();
                    }

                    GainsColourBox = null;
                }
                #endregion

                if (SaveButton != null)
                {
                    if (!SaveButton.IsDisposed)
                    {
                        SaveButton.Dispose();
                    }

                    SaveButton = null;
                }

                if (CancelButton != null)
                {
                    if (!CancelButton.IsDisposed)
                    {
                        CancelButton.Dispose();
                    }

                    CancelButton = null;
                }

                if (ExitButton != null)
                {
                    if (!ExitButton.IsDisposed)
                    {
                        ExitButton.Dispose();
                    }

                    ExitButton = null;
                }
            }
        }