/// <summary> /// プラグインを後片付けする /// </summary> void IActPluginV1.DeInitPlugin() { try { Trace.WriteLine("DeInitPlugin begin."); // Windowの位置を保存する 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; Settings.Default.Save(); FF14Watcher.Deinitialize(); MPTimerWindow.Default.Close(); EnochianTimerWindow.Default.Close(); this.PluginStatusLabel.Text = "Plugin Exited"; } catch (Exception ex) { Trace.WriteLine( "ACT.MPTimer 플러그인 종료 도중 에러가 발생했습니다." + Environment.NewLine + ex.ToString()); } finally { Trace.WriteLine("DeInitPlugin end."); Trace.Flush(); } }
/// <summary> /// 初期化する /// </summary> public static void Initialize() { lock (lockObject) { if (instance == null) { instance = new FF14Watcher() { PreviousMP = -1 }; instance.watchTimer = new Timer() { Interval = 100, AutoReset = false, Enabled = false }; instance.watchTimer.Elapsed += instance.watchTimer_Elapsed; // 監視を開始する instance.watchTimer.Start(); // ログの読み取りをセットする ActGlobals.oFormActMain.OnLogLineRead += instance.oFormActMain_OnLogLineRead; } } }
/// <summary> /// プラグインを後片付けする /// </summary> void IActPluginV1.DeInitPlugin() { // Windowの位置を保存する Settings.Default.OverlayTop = (int)this.MPTimerWindow.Top; Settings.Default.OverlayLeft = (int)this.MPTimerWindow.Left; Settings.Default.Save(); FF14Watcher.Deinitialize(); this.MPTimerWindow.Close(); this.PluginStatusLabel.Text = "Plugin Exited"; }
/// <summary> /// 後片付けをする /// </summary> public static void Deinitialize() { if (instance != null) { // エノキアンタイマーを終了する instance.EndEnochianTimer(); if (instance.watchTimer != null) { instance.watchTimer.Stop(); instance.watchTimer.Dispose(); instance.watchTimer = null; } instance = null; } }
/// <summary> /// 初期化する /// </summary> public static void Initialize() { if (instance == null) { instance = new FF14Watcher() { PreviousMP = -1 }; // 監視タスクを開始する instance.isWorking = true; instance.watchTask = TaskUtil.StartSTATask(instance.WatchCore); // エノキアンタイマーを開始する instance.StartEnochianTimer(); } }
/// <summary> /// 後片付けをする /// </summary> public static void Deinitialize() { lock (lockObject) { if (instance != null) { ActGlobals.oFormActMain.OnLogLineRead -= instance.oFormActMain_OnLogLineRead; if (instance.watchTimer != null) { instance.watchTimer.Stop(); instance.watchTimer.Dispose(); instance.watchTimer = null; } instance = null; } } }
/// <summary> /// 後片付けをする /// </summary> public static void Deinitialize() { if (instance != null) { // エノキアンタイマーを終了する instance.EndEnochianTimer(); // 監視タスクを終了する if (instance.watchTask != null) { instance.isWorking = false; instance.watchTask.Wait(); instance.watchTask.Dispose(); instance.watchTask = null; } instance = null; } }
/// <summary> /// プラグインを初期化する /// </summary> /// <param name="pluginScreenSpace"></param> /// <param name="pluginStatusText"></param> void IActPluginV1.InitPlugin( TabPage pluginScreenSpace, Label pluginStatusText) { try { TraceUtility.Initialize(); Trace.WriteLine("InitPlugin begin."); pluginScreenSpace.Text = "MPTimer"; // 設定Panelを追加する pluginScreenSpace.Controls.Add(ConfigPanel.Default); // アップデートを確認する Task.Run(() => { this.Update(); }); // オーバーレイを表示する MPTimerWindow.Default.Show(); EnochianTimerWindow.Default.Show(); // FF14監視スレッドを開始する FF14Watcher.Initialize(); this.PluginStatusLabel = pluginStatusText; this.PluginStatusLabel.Text = "Plugin Started"; } catch (Exception ex) { Trace.WriteLine( "ACT.MPTimer 플러그인 초기화 도중 에러가 발생했습니다." + Environment.NewLine + ex.ToString()); } finally { Trace.WriteLine("InitPlugin end."); } }
/// <summary> /// 初期化する /// </summary> public static void Initialize() { if (instance == null) { instance = new FF14Watcher() { PreviousMP = -1 }; instance.watchTimer = new Timer() { Interval = Settings.Default.ParameterRefreshRate, Enabled = false }; instance.watchTimer.Elapsed += instance.watchTimer_Elapsed; // 監視を開始する instance.watchTimer.Start(); } }
/// <summary> /// プラグインを初期化する /// </summary> /// <param name="pluginScreenSpace"></param> /// <param name="pluginStatusText"></param> void IActPluginV1.InitPlugin( TabPage pluginScreenSpace, Label pluginStatusText) { try { pluginScreenSpace.Text = "MPTimer"; // アップデートを確認する this.Update(); // FF14監視スレッドを開始する FF14Watcher.Initialize(); // MP回復タイミングFormを表示する this.MPTimerWindow = new MPTimerWindow(); this.MPTimerWindow.Show(); if (Settings.Default.ClickThrough) { this.MPTimerWindow.ToTransparentWindow(); } // 設定Panelを追加する var panel = new ConfigPanel(); panel.MPTimerWindow = this.MPTimerWindow; panel.Dock = DockStyle.Fill; pluginScreenSpace.Controls.Add(panel); this.PluginStatusLabel = pluginStatusText; this.PluginStatusLabel.Text = "Plugin Started"; } catch (Exception ex) { ActGlobals.oFormActMain.WriteExceptionLog( ex, "ACT.MPTimer プラグインの初期化で例外が発生しました。"); } }
/// <summary> /// 初期化する /// </summary> public static void Initialize() { if (instance == null) { instance = new FF14Watcher() { PreviousMP = -1 }; instance.watchTimer = new Timer() { Interval = Settings.Default.ParameterRefreshRate, Enabled = false }; instance.watchTimer.Elapsed += instance.watchTimer_Elapsed; // エノキアンタイマーを開始する instance.StartEnochianTimer(); // 監視を開始する instance.watchTimer.Start(); } }
/// <summary> /// 後片付けをする /// </summary> public static void Deinitialize() { if (instance != null) { if (instance.watchTimer != null) { instance.watchTimer.Stop(); instance.watchTimer.Dispose(); instance.watchTimer = null; } instance = null; } }
/// <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)); }