public void toolStripMenuItem_Reboot_Click(object sender, EventArgs e) { OpeInfoTable.GetInstance().UnregisterAllOpeToHotKey(Window.GetHWnd()); //OpeScript.GetInstance().CloseLua(); System.Diagnostics.Process.Start(Application.ResourceAssembly.Location); Application.Current.Shutdown(); }
private static void SaveDataTableToXML(OpeInfoTable dt, string xmlPath) { using (FileStream fs = new FileStream(xmlPath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite)) { XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(dt.GetType()); serializer.Serialize(fs, dt); } }
public MainSettingWindow() { InitializeComponent(); dgOpeList.DataContext = OpeInfoTable.GetInstance(); _LLKeyboardProc = new KeyboardHook.LowLevelKeyboardProc(LLKeyboardProc); hHandle = KeyboardHook.SetHook(_LLKeyboardProc); }
private void CloseWithOK() { UnregisterHotkeys(); OpeInfoTable.GetInstance().Save(); OpeScript.GetInstance().Initialize(); MyHide(); }
private void btnEditScript_Click(object sender, RoutedEventArgs e) { DataGridRow curt_row = VisualTreeUtil.FindParent <DataGridRow>(sender as DependencyObject); int idx = int.Parse((dgOpeList.Columns[0].GetCellContent(curt_row) as TextBlock).Text); ScriptSettingWindow script_setting_window = new ScriptSettingWindow(OpeInfoTable.GetInstance().GetRowById(idx)); script_setting_window.Owner = this; script_setting_window.ShowDialog(); }
private static void addRuntimeData(ref OpeInfoTable table) { if (table.Columns.Contains("Enabled") == false) { table.Columns.Add("Enabled", typeof(bool)); table.Columns["Enabled"].DefaultValue = true; foreach (DataRow row in table.Rows) { row["Enabled"] = true; } } }
private void CloseWithCancel() { UnregisterHotkeys(); OpeInfoTable.GetInstance().RollBackBeforeEditing(); // Update reference. dgOpeList.DataContext = OpeInfoTable.GetInstance(); dgOpeList.Items.Refresh(); OpeScript.GetInstance().Initialize(); MyHide(); }
private void StopSimulation() { grdDebugSet.Visibility = Visibility.Hidden; GridLengthConverter gridLengthConverter = new GridLengthConverter(); RDefSim.Height = (GridLength)gridLengthConverter.ConvertFrom("0"); MakeEnableDgOpeList(); OpeScript.GetInstance().Initialize(); OpeInfoTable.GetInstance().UnregisterAllOpeToHotKey(GetHWnd()); btnSimulation.IsChecked = false; }
private void StartSimulation() { MakeDisenableDgOpeList(); RowDefinition row_def = new RowDefinition(); GridLengthConverter gridLengthConverter = new GridLengthConverter(); RDefSim.Height = (GridLength)gridLengthConverter.ConvertFrom("1*"); grdDebugSet.Visibility = Visibility.Visible; OpeScript.GetInstance().Initialize(TbxOutput); OpeInfoTable.GetInstance().RegisterAllOpeToHotKey(GetHWnd()); btnSimulation.IsChecked = true; }
private static void LoadDataTableFromXML(ref OpeInfoTable dt, string xmlPath) { try { using (FileStream fs = new FileStream(xmlPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { XmlSerializer serializer = new XmlSerializer(typeof(OpeInfoTable)); dt = (OpeInfoTable)serializer.Deserialize(fs); } } catch (Exception e) { dt = null; return; } }
private static OpeInfoTable Load() { OpeInfoTable table = null; LoadDataTableFromXML(ref table, SETTING_FILE_NAME); if (table != null) { addRuntimeData(ref table); return(table); } else { return(new OpeInfoTable(true)); } }
public static int GetNextHighestPriority() { int max_priority = 0; foreach (DataRow r in OpeInfoTable.GetInstance().Rows) { if (r["HotKeyObject"] is ComboKey) { int tmp = ((ComboKey)r["HotKeyObject"]).Priority; if (tmp > max_priority) { max_priority = tmp; } } } return(max_priority + 1); }
private void ThreadPreprocessMessageMethod(ref MSG msg, ref bool handled) { const int WM_HOTKEY = 0x0312; switch (msg.message) { case WM_HOTKEY: int id = msg.wParam.ToInt32(); int combo_id; if (ComboKey.FindComboToFire(id, out combo_id)) { OpeInfoTable.GetInstance().DoOpeScript(combo_id); } else { OpeInfoTable.GetInstance().DoOpeScript(id); } handled = true; break; } }
private void dgOpeList_PreviewKeyDown(object sender, KeyEventArgs e) { if (dgOpeList.CurrentColumn.Header.ToString() != "HotKey") { return; } ModifierKeys modifierKeys = Keyboard.Modifiers; DataRowView selected_item = (DataRowView)dgOpeList.SelectedItem; if (isBeingPressedWinKey) { modifierKeys |= ModifierKeys.Windows; } if (HotKey.CanSet(e, modifierKeys)) { OpeInfoTable.SetHotkey(e, modifierKeys, selected_item.Row); e.Handled = true; } else { if (HotKey.IsClearKey(e)) { OpeInfoTable.ClearHotKey(selected_item.Row); } if (modifierKeys == ModifierKeys.None && e.Key == Key.F2) { e.Handled = false; return; } e.Handled = false; } }
private void dgOpeList_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { if (e.Column.Header.ToString() != "HotKey") { return; } if (e.EditAction == DataGridEditAction.Cancel) { return; } if (e.EditingElement is TextBox) { if (OpeInfoTable.SetComboKey(((TextBox)e.EditingElement).Text, ((DataRowView)e.Row.DataContext).Row)) { e.Cancel = false; } else { e.Cancel = true; } } }
public void toolStripMenuItem_Exit_Click(object sender, EventArgs e) { OpeInfoTable.GetInstance().UnregisterAllOpeToHotKey(Window.GetHWnd()); //OpeScript.GetInstance().CloseLua(); Application.Current.Shutdown(); }
private void UnregisterHotkeys() { OpeInfoTable.GetInstance().UnregisterAllOpeToHotKey(GetHWnd()); }
private void OpenSetting() { OpeInfoTable.GetInstance().UnregisterAllOpeToHotKey(Window.GetHWnd()); Window.MyShow(); }
private void btnAdd_Click(object sender, RoutedEventArgs e) { OpeInfoTable.GetInstance().AddRowAsDefault(); }