public static void Reload()
        {
            if (instance != null)
            {
                instance.Close();
                instance = null;
            }

            instance = new EnochianTimerWindow();
        }
        public static void Reload()
        {
            if (instance != null)
            {
                instance.Close();
                instance = null;
            }

            instance = new EnochianTimerWindow();
        }
Beispiel #3
0
        /// <summary>
        /// Load
        /// </summary>
        /// <param name="sender">イベント発生元</param>
        /// <param name="e">イベント引数</param>
        private void ConfigPanel_Load(object sender, EventArgs e)
        {
            this.TargetJobComboBox.DataSource    = Job.GetJobList();
            this.TargetJobComboBox.ValueMember   = "JobId";
            this.TargetJobComboBox.DisplayMember = "JobName";

            this.LoadSettings();

            this.TekiyoButton.Click += (s1, e1) =>
            {
                try
                {
                    FF14Watcher.Deinitialize();

                    Settings.Default.OverlayTop          = (int)MPTimerWindow.Default.Top;
                    Settings.Default.OverlayLeft         = (int)MPTimerWindow.Default.Left;
                    Settings.Default.EnochianOverlayTop  = (int)EnochianTimerWindow.Default.Top;
                    Settings.Default.EnochianOverlayLeft = (int)EnochianTimerWindow.Default.Left;

                    this.SaveSettings();

                    FF14Watcher.Default.UpdateTargetJobId();

                    MPTimerWindow.Reload();
                    MPTimerWindow.Default.Show();
                    EnochianTimerWindow.Reload();
                    EnochianTimerWindow.Default.Show();

                    Trace.WriteLine("Change settings.");
                }
                finally
                {
                    FF14Watcher.Initialize();
                }
            };

            this.ShokikaButton.Click += (s1, e1) =>
            {
                try
                {
                    FF14Watcher.Deinitialize();

                    Settings.Default.Reset();
                    Settings.Default.Save();

                    MPTimerWindow.Default.Top        = Settings.Default.OverlayTop;
                    MPTimerWindow.Default.Left       = Settings.Default.OverlayLeft;
                    EnochianTimerWindow.Default.Top  = Settings.Default.EnochianOverlayTop;
                    EnochianTimerWindow.Default.Left = Settings.Default.EnochianOverlayLeft;

                    this.LoadSettings();

                    FF14Watcher.Default.UpdateTargetJobId();

                    MPTimerWindow.Reload();
                    MPTimerWindow.Default.Show();
                    EnochianTimerWindow.Reload();
                    EnochianTimerWindow.Default.Show();

                    Trace.WriteLine("Reset settings.");
                }
                finally
                {
                    FF14Watcher.Initialize();
                }
            };

            this.ProgressBarShiftColorButton.Click += (s1, e1) =>
            {
                var button = s1 as Button;
                this.colorDialog.Color = button.BackColor;
                if (this.colorDialog.ShowDialog(this.ParentForm) == DialogResult.OK)
                {
                    button.BackColor = this.colorDialog.Color;
                }
            };

            this.ProgressBarShiftOutlineColorButton.Click += (s1, e1) =>
            {
                var button = s1 as Button;
                this.colorDialog.Color = button.BackColor;
                if (this.colorDialog.ShowDialog(this.ParentForm) == DialogResult.OK)
                {
                    button.BackColor = this.colorDialog.Color;
                }
            };

            this.EnochianBarShiftColorButton.Click += (s1, e1) =>
            {
                var button = s1 as Button;
                this.colorDialog.Color = button.BackColor;
                if (this.colorDialog.ShowDialog(this.ParentForm) == DialogResult.OK)
                {
                    button.BackColor = this.colorDialog.Color;
                }
            };

            this.EnochianBarShiftOutlineColorButton.Click += (s1, e1) =>
            {
                var button = s1 as Button;
                this.colorDialog.Color = button.BackColor;
                if (this.colorDialog.ShowDialog(this.ParentForm) == DialogResult.OK)
                {
                    button.BackColor = this.colorDialog.Color;
                }
            };

            this.OverlayLocationXNumericUpDown.DataBindings.Add(
                new Binding("Value", MPTimerWindow.Default.ViewModel, "Left", false, DataSourceUpdateMode.OnPropertyChanged));
            this.OverlayLocationYNumericUpDown.DataBindings.Add(
                new Binding("Value", MPTimerWindow.Default.ViewModel, "Top", false, DataSourceUpdateMode.OnPropertyChanged));
            this.EnochianXNumericUpDown.DataBindings.Add(
                new Binding("Value", EnochianTimerWindow.Default.ViewModel, "Left", false, DataSourceUpdateMode.OnPropertyChanged));
            this.EnochianYNumericUpDown.DataBindings.Add(
                new Binding("Value", EnochianTimerWindow.Default.ViewModel, "Top", false, DataSourceUpdateMode.OnPropertyChanged));
        }