private void CreateNewGrpBtn_Click(object sender, EventArgs e) { try { if (LibTree.SelectedNode == null) { //sfasdfasdMessageBox.Show(Common.GetTopForm(), "В какой группе создать группу комплектов", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(Common.GetTopForm(), Common.MLS.Get(MLSConst, "Не выбрана группа в которой создаётся новая группа стандартов. Выберите хотябы корневую:") + Common.MLS.Get(MLSConst, "Комплекты стандартов"), Common.MLS.Get(MLSConst, "Ошибка"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string bpath = (string)LibTree.SelectedNode.Tag; if (bpath.LastIndexOf(".stl") > 0) { bpath = (string)LibTree.SelectedNode.Parent.Tag; } string name = StringDialog.GetString(Common.GetTopForm(), Common.MLS.Get(MLSConst, "Создание группы"), Common.MLS.Get(MLSConst, "Введите имя создаваемогй группы комплектов"), "", true); if (name == null || name.IndexOf(".stl") > 0) { return; } Directory.CreateDirectory(bpath + "\\" + name); ReloadTree(); Log.Out("Добавлена группа стандартов " + bpath + "\\" + name); } catch (Exception ex) { Log.Out(ex); } }
/// <summary> /// Gestisce l'azione dell'add button permettendo l'inserimento di una /// nuova categoria /// </summary> private void AddHandler(Object sender, EventArgs eventArgs) { ICategory selectedNode = _categoryTree.SelectedNode?.Tag as ICategory ?? null; if (selectedNode == null) { MessageBox.Show("Devi selezionare una categoria radice"); return; } // Genero una finestra di dialogo per inserire il nome della categoria string catName = ""; using (StringDialog sd = new StringDialog("Inserisci il nome della categoria")) { if (sd.ShowDialog() == DialogResult.OK) { catName = sd.Response; } else { return; } } // Se il nodo selezionato non è un contenitore lo elimino e lo faccio diventare // un contenitore if (!(selectedNode is IGroupCategory)) { IGroupCategory parent = selectedNode.Parent; parent.RemoveChild(selectedNode); selectedNode = CategoryFactory.CreateGroup(selectedNode.Name, parent); } // Creo la categoria CategoryFactory.CreateCategory(catName, selectedNode as IGroupCategory); }
private void saveMemoryToolStripMenuItem_Click(object sender, EventArgs e) { StringDialog stDialog = new StringDialog("Enter the number of bytes you want to save..."); if (stDialog.ShowDialog() == DialogResult.OK) { int byteLength = 0; try { byteLength = Convert.ToInt32(stDialog.Message, 16); } catch { MessageBox.Show("The entered value was not a valid hex number.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } SaveFileDialog dialog = new SaveFileDialog(); dialog.Filter = "Binary File|*.bin|All Files|*.*"; if (dialog.ShowDialog() == DialogResult.OK) { ulong cellAddress = (ulong)getSelectedCellAddress(); API.ErrorCode error; File.WriteAllBytes(dialog.FileName, API.read <byte>(cellAddress, byteLength, out error)); } } }
private void enterNewValueToolStripMenuItem_Click(object sender, EventArgs e) { if (listView.SelectedItems.Count == 0) { return; } ListViewItem item = listView.SelectedItems[0]; API.ErrorCode error; Registers regs = API.getRegisters(out error); if (error != API.ErrorCode.NO_ERROR) { return; } StringDialog dialog = new StringDialog("Enter new register value"); if (dialog.ShowDialog() == DialogResult.OK) { try { string[] itemSplit = item.Text.Split(new char[] { ':' }); string register = itemSplit[0]; regs = setRegister(regs, register, dialog.Message); API.setRegisters(regs); refresh(); } catch { } } }
internal void Find() { Person foundPerson = null; StringDialog dialog = new StringDialog("A partial last name"); dialog.ShowDialog(); if (dialog.Accept) { string lastName = dialog.YourString; List <Person> candidates = _personRepository.ListByLastName(lastName); switch (candidates.Count) { case 0: ReportIt("No person has last name " + lastName); return; case 1: foundPerson = candidates[0]; break; default: foundPerson = ChooseAUniquePerson(candidates); break; } PersonView view = new PersonView(this); view.Show(); } }
internal void AddContributor(Role role) { StringDialog dialog = new StringDialog("A partial last name"); dialog.ShowDialog(); if (dialog.Accept) { string lastName = dialog.YourString; if (lastName == "") { ReportIt("You must enter a nonempty last name"); return; } Person p = GetPersonFor(lastName); if (p == null) { return; } FilmPerson fp = new FilmPerson(); fp.FilmId = CurrentFilm.Id; fp.PersonId = p.Id; fp.Roles.Add(role); _filmPersonRepository.Add(fp); } }
internal void Find() { StringDialog dialog = new StringDialog("A partial description"); dialog.ShowDialog(); if (dialog.Accept) { string description = dialog.YourString; AbstractLocationRepository lRepo = _locationRepository; Location loc = null; try { loc = lRepo.GetByDescription(description); } catch (Exception ex) { ReportIt("The description must specify a unique location"); } if (loc != null) { LocationView view = new LocationView(this); view.ShowDialog(); } } }
private void CreateNewStBtn_Click(object sender, EventArgs e) { try { if (LibTree.SelectedNode == null) { MessageBox.Show(Common.GetTopForm(), Common.MLS.Get(MLSConst, "Не выбрана группа в которой создаётся стандарт. Выберите хотябы корневую:") + Common.MLS.Get(MLSConst, "Комплекты стандартов"), Common.MLS.Get(MLSConst, "Ошибка"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string bpath = (string)LibTree.SelectedNode.Tag; if (bpath.LastIndexOf(".stl") > 0) { bpath = (string)LibTree.SelectedNode.Parent.Tag; } string name = StringDialog.GetString(Common.GetTopForm(), Common.MLS.Get(MLSConst, "Создание комплекта"), Common.MLS.Get(MLSConst, "Введите имя создаваемого комплекта"), "", true); if (name == null || name.IndexOf(".stl") > 0) { return; } File.Create(bpath + "\\" + name + ".stl").Close(); ReloadTree(); Log.Out("Добавлен комплект " + bpath + "\\" + name + ".stl"); } catch (Exception ex) { Log.Out(ex); } }
public void Stash(params RawPacketReference[] packets) { var dialog = new StringDialog("Stash packets", "Your selected packets will be stored with the name below"); if (dialog.ShowDialog(this) == DialogResult.OK) { _Stash.Add(dialog.Result.Value, packets); } }
private void notify() { StringDialog dialog = new StringDialog("Notification Message"); if (dialog.ShowDialog() == DialogResult.OK) { API.notify(dialog.Message); } }
private void goToAddressToolStripMenuItem_Click(object sender, EventArgs e) { StringDialog dialog = new StringDialog("Go to address"); if (dialog.ShowDialog() == DialogResult.OK) { addressPointer = Convert.ToUInt64(dialog.Message, 16); refresh(); } }
internal void Find() { StringDialog dialog = new StringDialog("A country abbreviation"); dialog.ShowDialog(); if (dialog.Accept) { string abbrev = dialog.YourString; CurrentCountry = _countryRepository.GetByAbbreviation(abbrev); CountryView view = new CountryView(this); view.ShowDialog(); } }
public async void Rename() { var dialog = new StringDialog("Rename mapping", "Mapping name", Mapping.Title); var result = (bool?)await DialogHost.Show(dialog, ProfileViewModel.ProfileDialogIdentifier); if (result == null || !result.Value) { return; } Mapping.Rename(dialog.Value); OnPropertyChanged(nameof(MappingTitle)); }
private void RenameButton_Click(object sender, EventArgs e) { StringDialog dlg = new StringDialog { String = CurrentArea.Name }; if (dlg.ShowDialog() == DialogResult.OK) { CurrentArea.Name = dlg.String; Context.UnsavedChanges = true; AreaList.Items[AreaList.SelectedIndex] = CurrentArea; } }
public async void AddFilter() { var dialog = new StringDialog("Add filter", "Filter name", ""); var result = (bool?)await DialogHost.Show(dialog, MappingViewModel.ProfileViewModel.ProfileDialogIdentifier); if (result == null || !result.Value) { return; } var filterViewModel = new FilterViewModel(this, Plugin.AddFilter(dialog.Value)); Filters.Add(filterViewModel); }
private void BtnAddSubject_Click(object sender, RoutedEventArgs e) { var dialog = new StringDialog("New Subject", "Enter name:") { Icon = (BtnAddSubject.Content as Image)?.Source }; if (dialog.ShowDialog() == true) { _subjects.Add(new TimetableModel(dialog.Value)); SortSubjectList(); _changed = true; } }
private void RenameBtn_Click(object sender, EventArgs e) { try { if (LibTree.SelectedNode == null) { //asdfasdfasdfMessageBox.Show(Common.GetTopForm(), "В что будет переименовывыться", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(Common.GetTopForm(), Common.MLS.Get(MLSConst, "Не выбрана что будет переименовываться"), Common.MLS.Get(MLSConst, "Ошибка"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string path = (string)LibTree.SelectedNode.Tag; if (path.LastIndexOf(".stl") < 0) { string name = StringDialog.GetString(Common.GetTopForm(), Common.MLS.Get(MLSConst, "Переименование"), Common.MLS.Get(MLSConst, "Введите новое имя группы комплектов '") + path + "'", "", true); if (name == null || name.IndexOf(".stl") >= 0) { return; } string new_path = path.Substring(0, path.LastIndexOf("\\")); Directory.Move(path, new_path + "\\" + name); Log.Out("Группа стандартов " + path + " переименована в " + new_path + "\\" + name); } else { string name = StringDialog.GetString(Common.GetTopForm(), Common.MLS.Get(MLSConst, "Переименование"), Common.MLS.Get(MLSConst, "Введите новое имя комплекта стандартов") + " '" + path + "'", "", true); if (name == null || name.IndexOf(".stl") >= 0) { return; } string new_path = path.Substring(0, path.LastIndexOf("\\")); File.Move(path, new_path + "\\" + name + ".stl"); Log.Out("Комплект стандартов " + path + " переименован в " + new_path + "\\" + name + ".stl"); } ReloadTree(); } catch (Exception ex) { Log.Out(ex); } }
private void AddArea_Click(object sender, EventArgs e) { StringDialog dlg = new StringDialog(); if (dlg.ShowDialog() == DialogResult.OK) { Wip.ZoneArea area = new Wip.ZoneArea { Name = dlg.String }; ZoneData.Areas.Add(area); Context.UnsavedChanges = true; AreaList.Items.Add(area); Select(area); } }
internal void Addountry() { StringDialog dialog = new StringDialog("A country abbreviation"); dialog.ShowDialog(); if (dialog.Accept) { string abbreviation = dialog.YourString; AbstractCountryRepository cRepo = _countryRepository; Country c = cRepo.GetByAbbreviation(abbreviation); FilmCountry fc = new FilmCountry(); fc.FilmId = CurrentFilm.Id; fc.CountryId = c.Id; AbstractFilmCountryRepository fcRepo = _filmCountryRepository; fcRepo.Add(fc); } }
private async void CopyProfile(object sender, RoutedEventArgs e) { if (!GetSelectedItem(out var profileItem)) { return; } var dialog = new StringDialog("Copy profile", "Profile name", profileItem.Profile.Title + " Copy"); var result = (bool?)await DialogHost.Show(dialog, "RootDialog"); if (result == null || !result.Value) { return; } Context.ProfilesManager.CopyProfile(profileItem.Profile, dialog.Value); ReloadProfileTree(); }
private async void RenameProfile(object sender, RoutedEventArgs e) { if (!GetSelectedItem(out var profileItem)) { return; } var dialog = new StringDialog("Rename profile", "Profile name", profileItem.Profile.Title); var result = (bool?)await DialogHost.Show(dialog, "RootDialog"); if (result == null || !result.Value) { return; } profileItem.Profile.Rename(dialog.Value); ReloadProfileTree(); }
public void AddTrackingDeviceButtonHandler(Object obj, EventArgs e) { DateRange range = new DateRange(_fromDateTimePicker.Value, _toDateTimePicker.Value); using (StringDialog sd = new StringDialog("Nome da associare a prenotazione base: ")) { if (sd.ShowDialog() == DialogResult.OK) { string name = sd.Response; if (name != null) { _desc = new AssociationDescriptor(range, name); } } else { return; } } if (_desc == null) { _desc = new AssociationDescriptor(range, "Base"); } try { _baseTrackingDevice = _tdCoord.Next; }catch (Exception exception) { MessageBox.Show("Non è possibile recuperare un tracking device. Chiedi allo staff"); _view.Close(); return; } _trackingDeviceLabel.Text = _desc.InformationString + " -> " + _baseTrackingDevice.Id; _associateTrackingDeviceButton.Enabled = false; if (CanCreate()) { _createButton.Enabled = true; } _clearButton.Enabled = true; }
private void BtnRenameSubject_Click(object sender, RoutedEventArgs e) { if (LvSubjects.SelectedItem == null) { return; } var dialog = new StringDialog("Rename Subject", "Enter name:", TimetableControl.Model.Name) { Icon = (BtnRenameSubject.Content as Image)?.Source }; if (dialog.ShowDialog() == true && TimetableControl.Model.Name != dialog.Value) { TimetableControl.Model.Rename(dialog.Value); UpdateTimetable(); SortSubjectList(); _changed = true; } }
private void MMStructProbCreate_Click(object sender, EventArgs e) { try { if (tvDirView.SelectedNode == null) { return; } string str = StringDialog.GetString(MainForm.MForm, Common.MLS.Get(MLSConst, "Введите имя пробы"), Common.MLS.Get(MLSConst, "Создание пробы"), "", true); if (str == null) { return; } Directory.CreateDirectory((string)(tvDirView.SelectedNode.Tag) + "\\" + str + ".p"); LoadTree(); } catch (Exception ex) { Common.Log(ex); } }
private void ToolStripButton3_Click(object sender, EventArgs e) { TreeNode node = treeView1.SelectedNode; if (node.ImageIndex == PROJECT || node.ImageIndex == FOLDER || node.ImageIndex == FOLDER_OPEN) { string path = _filePath.Replace(Path.DirectorySeparatorChar + Path.GetFileName(_filePath) ?? string.Empty, ""); string replace = node.FullPath?.Replace(Path.GetFileName(_filePath) ?? string.Empty, ""); string target = path + replace.Replace("\\", Path.DirectorySeparatorChar.ToString()); if (Directory.Exists(target)) { StringDialog dialog = new StringDialog((text) => !string.IsNullOrEmpty(text)); dialog.Description = "Create Directory Name"; dialog.ShowDialog(); if (dialog.DialogResult == DialogResult.OK) { string newDir = target + Path.DirectorySeparatorChar + dialog.ResultString; if (!Directory.Exists(newDir)) { Directory.CreateDirectory(newDir); string name = replace.Split(Path.DirectorySeparatorChar)[1]; Project proj = _projects[name]; proj.AddItem("Folder", newDir.Replace(path + "\\" + name + "\\", "") + "\\"); proj.Save(); LoadSolution(_solution, _filePath); } else { MessageBox.Show("Created Directory"); } } } } }
private async void AddMapping_OnClick(object sender, RoutedEventArgs e) { if (!(sender is Button button)) { return; } if (!(button.DataContext is PluginItemViewModel pluginItem)) { return; } var dialog = new StringDialog("Create mapping for: " + pluginItem.Name, "Mapping name", ""); var result = (bool?)await DialogHost.Show(dialog, ProfileViewModel.ProfileDialogIdentifier); if (result == null || !result.Value) { return; } var mappingViewModel = ProfileViewModel.AddMapping(dialog.Value); mappingViewModel.AddPlugin(Profile.Context.PluginManager.GetNewPlugin(pluginItem.Plugin)); MappingListView.ScrollIntoView(MappingListView.Items[MappingListView.Items.Count - 1]); }
private void listView1_DoubleClick(Object sender, EventArgs e) { var item = this.listView1.SelectedItems[0]; if (item == null) { return; } if (item.Text == "mPath" || item.Text == "mInjectionSet" || item.Text == "mnVersion") { return; } var type = (Type)item.Tag; if (type == typeof(Boolean)) { var currentBoolean = (Boolean)this._worldData[item.Text]; item.SubItems[1].Text = (!currentBoolean).ToString(); this._worldData[item.Text] = !currentBoolean; } if (type == typeof(Int64)) { var currentInt = (Int64)this._worldData[item.Text]; using (var nd = new NumericDialog(currentInt, 0)) { if (nd.ShowDialog() == DialogResult.OK) { item.SubItems[1].Text = Convert.ToInt64(nd.Result).ToString("N0"); this._worldData[item.Text] = Convert.ToInt64(nd.Result); } } } if (type == typeof(Int32)) { var currentInt = (Int32)this._worldData[item.Text]; using (var nd = new NumericDialog(currentInt, 0)) { if (nd.ShowDialog() == DialogResult.OK) { item.SubItems[1].Text = Convert.ToInt32(nd.Result).ToString("N0"); this._worldData[item.Text] = Convert.ToInt32(nd.Result); } } } if (type == typeof(Single)) { var currentFloat = (Single)this._worldData[item.Text]; using (var nd = new NumericDialog(currentFloat, 7)) { if (nd.ShowDialog() == DialogResult.OK) { item.SubItems[1].Text = Convert.ToSingle(nd.Result).ToString("N7").TrimEnd('0').TrimEnd('.'); this._worldData[item.Text] = Convert.ToSingle(nd.Result); } } } if (type.BaseType == typeof(Enum)) { var currentEnum = (Enum)this._worldData[item.Text]; using (var ed = new EnumDialog(currentEnum)) { if (ed.ShowDialog() == DialogResult.OK) { item.SubItems[1].Text = ed.Result.ToString(); this._worldData[item.Text] = ed.Result; } } } if (type == typeof(string)) { var currentStr = (string)this._worldData[item.Text]; using (var sd = new StringDialog(currentStr)) { if (sd.ShowDialog() == DialogResult.OK) { item.SubItems[1].Text = sd.Result; this._worldData[item.Text] = sd.Result; } } } }
private void MMMeasuringAddMeasuring_Click(object sender, EventArgs e) { try { string bpath = Common.Db.GetFoladerPath(Common.DbNameProbSort) + "\\условия.bin"; if (File.Exists(bpath) == false) { MMMeasuringExp_Click(sender, e); } if (File.Exists(bpath) == false) { return; } SpectrCondition cond; FileStream fs = new FileStream(bpath, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); cond = new SpectrCondition(br); br.Close(); if (tvDirView.SelectedNode == null) { return; } string base_path = (string)(tvDirView.SelectedNode.Tag); if (base_path.IndexOf(".ss") > 0) { base_path = (string)(tvDirView.SelectedNode.Parent.Tag); } if (base_path[base_path.Length - 1] != 'p' || base_path[base_path.Length - 2] != '.') { MessageBox.Show(MainForm.MForm, "Это не проба. Выберите пробу", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DateTime now = new DateTime(DateTime.Now.Ticks); string def_name = "" + (now.Year - 2000); int tmp = now.Month; if (tmp < 10) { def_name += "0"; } def_name += tmp; tmp = now.Day; if (tmp < 10) { def_name += "0"; } def_name += tmp; def_name += " "; tmp = now.Hour; if (tmp < 10) { def_name += "0"; } def_name += tmp + "."; tmp = now.Minute; if (tmp < 10) { def_name += "0"; } def_name += tmp + "."; tmp = now.Second; if (tmp < 10) { def_name += "0"; } def_name += tmp; string def_path = base_path + "\\" + def_name + ".ss"; if (File.Exists(def_path) == true) { int at = 0; while (File.Exists(def_path) == true) { at++; def_path = base_path + "\\" + def_name + "_" + at + ".ss"; } def_name += "_" + at; } string str = StringDialog.GetString(MainForm.MForm, Common.MLS.Get(MLSConst, "Введите имя пробы"), Common.MLS.Get(MLSConst, "Создание пробы"), def_name, true); if (str == null) { return; } MeasuringFile = base_path + "\\" + str; Dev.MeasuringResultFinalCall final_call = new Dev.MeasuringResultFinalCall(btMeasuringNewSpectr_Click_Final); Common.Dev.Measuring(cond, final_call); } catch (Exception ex) { Common.Log(ex); } }