public PropertyCmdView(PropertyCall propertyCall, bool isNew) { InitializeComponent(); if (isNew) { this.Text = Rekod.Properties.Resources.CMD_NewProgram; } else { this.Text = Rekod.Properties.Resources.CMD_SettingsProgram; } if (propertyCall == null) { return; } _propertyCall = propertyCall; this.txtIcon.Text = _propertyCall.Icon; this.txtFile.Text = _propertyCall.File; this.txtTitle.Text = _propertyCall.Title; this.txtParams.Text = _propertyCall.Params; this.pIcon.BackgroundImage = IconModule.GetIcon(txtIcon.Text, txtFile.Text).ToBitmap(); }
private void PropertyCallUpdate(PropertyCall value) { if (value == null) { return; } int index = listBox1.Items.IndexOf(value); listBox1.Items.Remove(value); listBox1.Items.Insert(index, value); listBox1.SetSelected(index, true); SaveSettings(); }
private void PropertyCallAdd(PropertyCall value) { if (value == null) { value = new PropertyCall(); if (!PropertyCallOpen(value, true)) { return; } } listBox1.Items.Add(value); SaveSettings(); UpdateCount(); }
private bool PropertyCallOpen(PropertyCall value, bool isNew) { if (value == null) { return(false); } var property = new PropertyCmdView(value, isNew); if (property.ShowDialog() == DialogResult.OK) { return(true); } return(false); }
private void PropertyCallDown(PropertyCall value) { if (value == null) { return; } int index = listBox1.Items.IndexOf(value); if (index == listBox1.Items.Count - 1) { return; } listBox1.Items.Remove(value); listBox1.Items.Insert(index + 1, value); listBox1.SetSelected(index + 1, true); SaveSettings(); }
private void PropertyCallDelelte(PropertyCall value) { if (value == null) { return; } var dialogResult = MessageBox.Show(this.ParentForm, Rekod.Properties.Resources.CMD_DeleteConfirm, Rekod.Properties.Resources.CMD_Confirmation, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes) { listBox1.Items.Remove(value); SaveSettings(); } UpdateCount(); }
/// <summary> Считываем параметры с файла /// </summary> /// <param name="sSettings"></param> /// <returns></returns> public static List <PropertyCall> ReadXSettings(XElement sSettings) { var tempList = new List <PropertyCall>(); var calls = sSettings.Element("cmds"); if (calls == null) { return(tempList); } foreach (var item in calls.Elements("cmd")) { var f = new PropertyCall() { File = GetValue(item, "command"), Title = GetValue(item, "title"), Icon = GetValue(item, "icon"), Params = GetValue(item, "params") }; tempList.Add(f); } return(tempList); }