// Helper function public Module AddModuleFromData(Loading.ModuleData moduleData) { Modules.Module module = Loading.CardLoading.GetModuleFromData(moduleData); module.Setup(this, moduleData); this.AddModule(moduleData.Type, module); return(module); }
private static void HandleInputChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Channel channel = (d as Channel); AudioWire input = (e.NewValue) as AudioWire; // storing the value in a class variable allows it to be accessed from any thread. channel._input = input; if (input == null) { channel.ChannelName = "Unassigned"; } else { Modules.Module source = input.Target as Modules.Module; if (source == null) { channel.ChannelName = "Unknown"; } else { channel.ChannelName = source.Description; } } }
private void editModuleRestrictions_Click(object sender, EventArgs e) { if (this.addedModulesList.SelectedIndex >= 0) { Modules.Module m = (Modules.Module)addedModulesList.Items[addedModulesList.SelectedIndex]; RestrictionEditingForm restrictionEditingForm = new RestrictionEditingForm(m); restrictionEditingForm.TopMost = true; restrictionEditingForm.Show(); } }
// Helper function public void AddModulesFromData(List <Loading.ModuleData> moduleDatas) { if (moduleDatas != null) { foreach (Loading.ModuleData moduleData in moduleDatas) { Modules.Module module = Loading.CardLoading.GetModuleFromData(moduleData); module.Setup(this, moduleData); this.AddModule(moduleData.Type, module); } } }
private void modulesSelection_SelectedIndexChanged(object sender, EventArgs e) { if (modulesSelection.SelectedIndex == -1) { return; } Modules.Module m = (Modules.Module)Activator.CreateInstance(modulesSelection.Items[modulesSelection.SelectedIndex].GetType()); addedModulesList.Items.Add(m); addedModulesList.SelectedIndex = addedModulesList.Items.Count - 1; modulesSelection.SelectedIndex = -1; this.changed = true; }
private void loadModule(Modules.Module m) { this.clearEditPanel(); Control[] controls = m.getEditControls(); if (controls.Length == 0) { Label infoLabel = new Label(); infoLabel.Text = "No controls for this Module"; infoLabel.Width = 200; controls = new Control[] { infoLabel }; } this.editPanel.Controls.AddRange(controls); }
private void loadModules() { string @namespace = "CheckMaster.Modules"; var q = from t in Assembly.GetExecutingAssembly().GetTypes() where t.IsClass && t.Namespace == @namespace select t; q.ToList().ForEach(m => { if (m.Name.Contains("MasterModule") == false) { Modules.Module instance = (Modules.Module)Activator.CreateInstance(m); this.modulesSelection.Items.Add(instance); } } ); }
private void addedModulesList_SelectedIndexChanged(object sender, EventArgs e) { if (addedModulesList.SelectedIndex == -1) { clearEditPanel(); this.removeModuleButton.Enabled = false; this.editModuleRestrictions.Enabled = false; return; } this.addedSuccessModulesList.SelectedIndex = -1; Modules.Module m = (Modules.Module)addedModulesList.Items[addedModulesList.SelectedIndex]; loadModule(m); this.removeModuleButton.Enabled = true; this.editModuleRestrictions.Enabled = true; this.changed = true; }
private void fileSelect(Modules.Module module) { SaveFileDialog sfd = new SaveFileDialog { Filter = "Text Files|*.txt", FileName = module.filename }; if (sfd.ShowDialog() == DialogResult.OK) { if (!sfd.CheckFileExists) { FileStream fs = File.Create(sfd.FileName); fs.Close(); } module.filename = sfd.FileName; } sfd.Dispose(); }
public Unit(Loading.UnitCardData Data) { BaseAttack = Data.Attack; BaseHealth = Data.Health; BaseVP = Data.Victory; Name = Data.mName; CanBeShort = Data.CanBeShort; CanBeLong = Data.CanBeLong; Actions.Add(new ActionInfo("Attack", new Attack_Action(false, 0), PlayerType.Enemy, 1, 1)); if (Data.mActions != null) { foreach (Loading.ActionData actionData in Data.mActions) { if (actionData.mIsPlaced) { PAHolder.AddAction(Loading.CardLoading.GetActionInfoFromData(actionData)); } else { Actions.Add(Loading.CardLoading.GetActionInfoFromData(actionData)); } } } if (Data.mModules != null) { foreach (Loading.ModuleData MD in Data.mModules) { Modules.Module M = Loading.CardLoading.GetModuleFromData(MD); M.Setup(this, MD); AddModule(MD.Type, M); } } Classes = new List <string>(Data.Classes); }
public RestrictionEditingForm(Modules.Module module) { this.module = module; init(); }
public void ParseStringToEnum_TestParameterizedInput(string inputFromCommand, Modules.Module translatedEnum) { Proxy.Setup(x => x.GetText(It.Is <string>(s => s == "moduleVariable"))).Returns(inputFromCommand); var result = EnumParser.ParseStringToEnum <Modules.Module>(Proxy.Object, "moduleVariable", typeof(Modules.Module)); Assert.Equal(translatedEnum, result); }