public RotationManagerForm(RotationManagerController rotationManagerController) { InitializeComponent(); var executableFileInfo = new FileInfo(Application.ExecutablePath); string executableDirectoryName = executableFileInfo.DirectoryName; OurDirectory = executableDirectoryName; RotationSettings.LoadSettings(); this.rotationManagerController = rotationManagerController ?? new RotationManagerController(); }
private void LoadBehavior() { rotationManagerController = new RotationManagerController(); ClearTree(BeRotations); rotationManagerController.Load(OurDirectory + "\\Rotations\\" + BeTBSelectBehavior.SelectedItem + ".xml"); foreach (Rotation rule in rotationManagerController.Rotations) { AddCondition(rule, BeRotations); } BeTabs.Enabled = true; BeBarRuleModifier.Enabled = true; RotationSettings.LoadedRotationManager = BeTBSelectBehavior.SelectedItem.ToString(); RotationSettings.SaveSettings(); }
private void BeTbNewBehaviorPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (e.KeyValue == 13) { SaveRotationManager(); rotationManagerController = new RotationManagerController { Name = BeTBNewBehavior.Text }; rotationManagerController.ResetControllers(); ClearTree(BeRotations); BeTBSelectBehavior.Items.Add(rotationManagerController.Name); BeTBSelectBehavior.SelectedIndex = BeTBSelectBehavior.FindStringExact(rotationManagerController.Name); BeTBNewBehavior.Text = "Enter name and press return to create."; RotationSettings.LoadedRotationManager = rotationManagerController.Name; SaveRotationManager(); LoadBehavior(); } }
private void Start() { if (_firstTime) { LoadFirstTime(); _firstTime = false; } if (File.Exists(OurDirectory + "\\Rotations\\" + RotationSettings.LoadedRotationManager + ".xml")) { RotationManagerController = new RotationManagerController(); RotationManagerController.Load(OurDirectory + "\\Rotations\\" + RotationSettings.LoadedRotationManager + ".xml"); } foreach (Rotation rotation in RotationManagerController.Rotations.Where(r => r.Active)) { try { CheckBuffAndKeys(rotation.Rules.GetRules); var hotkey = new Hotkey(); hotkey.Windows = rotation.Windows; hotkey.Shift = rotation.Shift; hotkey.Alt = rotation.Alt; hotkey.Control = rotation.Ctrl; Rotation rotation1 = rotation; hotkey.KeyCode = (Keys)RotationSettings.KeysList.FirstOrDefault(k => k.Text == rotation1.Key).Code; hotkey.Pressed += delegate { StartRotation(rotation1.Name); }; if (!hotkey.GetCanRegister(this)) { Logging.Write("Cannot register {0} as hotkey", rotation.Key); } else { hotkey.Register(this); _hotKeys.Add(hotkey); } } catch { Logging.Write("Cannot register {0} as hotkey", rotation.Key); } } }
private void RotatorFormLoad(object sender, EventArgs e) { var executableFileInfo = new FileInfo(Application.ExecutablePath); string executableDirectoryName = executableFileInfo.DirectoryName; OurDirectory = executableDirectoryName; RotationSettings.LoadSettings(); if (RotationManagerController == null) { if (File.Exists(OurDirectory + "\\Rotations\\" + RotationSettings.LoadedRotationManager + ".xml")) { RotationManagerController = new RotationManagerController(); RotationManagerController.Load(OurDirectory + "\\Rotations\\" + RotationSettings.LoadedRotationManager + ".xml"); } else { Logging.Write("Could not load the rotation manager"); RotationManagerController = null; } } }
private void BeTbNewBehaviorPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (e.KeyValue == 13) { SaveRotationManager(); rotationManagerController = new RotationManagerController {Name = BeTBNewBehavior.Text}; rotationManagerController.ResetControllers(); ClearTree(BeRotations); BeTBSelectBehavior.Items.Add(rotationManagerController.Name); BeTBSelectBehavior.SelectedIndex = BeTBSelectBehavior.FindStringExact(rotationManagerController.Name); BeTBNewBehavior.Text = "Enter name and press return to create."; RotationSettings.LoadedRotationManager = rotationManagerController.Name; SaveRotationManager(); LoadBehavior(); } }
private void Start() { if (_firstTime) { LoadFirstTime(); _firstTime = false; } if (File.Exists(OurDirectory + "\\Rotations\\" + RotationSettings.LoadedRotationManager + ".xml")) { RotationManagerController = new RotationManagerController(); RotationManagerController.Load(OurDirectory + "\\Rotations\\" + RotationSettings.LoadedRotationManager + ".xml"); } foreach (Rotation rotation in RotationManagerController.Rotations.Where(r => r.Active)) { try { CheckBuffAndKeys(rotation.Rules.GetRules); var hotkey = new Hotkey(); hotkey.Windows = rotation.Windows; hotkey.Shift = rotation.Shift; hotkey.Alt = rotation.Alt; hotkey.Control = rotation.Ctrl; Rotation rotation1 = rotation; hotkey.KeyCode = (Keys) RotationSettings.KeysList.FirstOrDefault(k => k.Text == rotation1.Key).Code; hotkey.Pressed += delegate { StartRotation(rotation1.Name); }; if (!hotkey.GetCanRegister(this)) { Logging.Write("Cannot register {0} as hotkey", rotation.Key); } else { hotkey.Register(this); _hotKeys.Add(hotkey); } } catch { Logging.Write("Cannot register {0} as hotkey", rotation.Key); } } }