/// <summary> /// Shows a new EditView when the user edits a person and right clicks a booking item and clicks Edit /// </summary> /// <param name="selectedBookingInRightClickMenu">The Booking item to be edited</param> public void ShowNewEditView(Booking selectedBookingInRightClickMenu) { EditView innerEditView = new EditView(selectedBookingInRightClickMenu, true); EditViewController innerController = new EditViewController(innerEditView, outerEditViewController: this); innerEditView.Show(); }
public void ChangeCurrentView(CurrentViewTypes viewType) { switch (viewType) { case CurrentViewTypes.Start: IStartViewModel sVM = new StartViewModel(this); StartView sV = new StartView(); //привязка sV.DataContext = sVM; //отображение MainWindowViewModel.CurrentView = sV; break; case CurrentViewTypes.Edit: IEditViewModel eVM = new EditViewModel(this); EditView eV = new EditView(); //привязка eV.DataContext = eVM; //отображение MainWindowViewModel.CurrentView = eV; break; default: throw new ArgumentOutOfRangeException(nameof(viewType)); } }
public async Task <ActionResult> Edit(int id, EditView model) { var TempDatabase = TemDatabase; Essay obj = TempDatabase.Essays.Include(x => x.Author).First(x => x.Id == id); if (obj == null) { return(Json(new { Completed = false, err = new string[] { "Nie znaleziono rozprawki" } })); } obj.LibraryResource = model.LibraryResource; TempDatabase.Entry(obj).State = EntityState.Modified; try { int f = await TempDatabase.SaveChangesAsync(); if (f >= 0) { return(Json( new { Completed = true } )); } else { return(Json(new { Completed = false, err = new string[] { "Błąd zapisu danych" } })); } } catch (Exception ex) { return(Json(new { Completed = false, err = new string[] { ex.Message } })); } }
private void OnEditCommand(object o) { try { EditView modifier = new EditView(); EditViewModel modele = new EditViewModel(modifier); modifier.DataContext = modele; modifier.ShowDialog(); if (!modele.NormalEnd) { return; } if (modele.Nom == " ") { throw (new ArgumentException("Vous n'avez pas rentrez de nom. Erreur: \n")); } if (!modele.TestI) { if (Speaker == null) { throw (new ArgumentException("Vous n'avez pas sélectioner d'intervenants. Erreur:\n")); } if (Speaker.Nom == modele.Nom && Speaker.TitreDIntervention == modele.Intervention) { throw (new ArgumentException("Vous n'avez pas modifier l'intervenant. Erreur:\n")); } if (modele.Intervention == " ") { throw (new ArgumentException("Vous n'avez pas rentrez d'intervention. Erreur: \n")); } ListeSpeaker[ListeSpeaker.ToList().FindIndex(Intervenant => (Intervenant.Nom == Speaker.Nom && Intervenant.TitreDIntervention == Speaker.TitreDIntervention))].Nom = modele.Nom; ListeSpeaker[ListeSpeaker.ToList().FindIndex(Intervenant => (Intervenant.Nom == Speaker.Nom && Intervenant.TitreDIntervention == Speaker.TitreDIntervention))].TitreDIntervention = modele.Intervention; Speaker = ListeSpeaker[ListeSpeaker.ToList().FindIndex(Intervenant => (Intervenant.Nom == modele.Nom && Intervenant.TitreDIntervention == modele.Intervention))]; UpdateListeSpeaker(); } else { if (Spectator == null) { throw (new ArgumentException("Vous n'avez pas sélectionner de spectateurs. Erreur:\n")); } if (Spectator.Nom == modele.Nom) { throw (new ArgumentException("Vous n'avez pas modifier le spectateur. Erreur:\n")); } ListeSpectator[ListeSpectator.ToList().FindIndex(Internaute => (Internaute.Nom == Spectator.Nom))].Nom = modele.Nom; Spectator = ListeSpectator[ListeSpectator.ToList().FindIndex(Internaute => (Internaute.Nom == modele.Nom))]; UpdateListeSpectator(); } NotifyPropertyChanged("ListeSpectator"); NotifyPropertyChanged("ListeSpeaker"); } catch (Exception E) { ExceptionViewModel v = new ExceptionViewModel(E); ExceptionView ExceptionWindow = new ExceptionView(); ExceptionWindow.DataContext = v; ExceptionWindow.ShowDialog(); } }
public IActionResult EditStudent(EditView student) { Student stu = _student.GetStudent(student.Id); if (ModelState.IsValid) { //stu.Name = student.Name; stu.FirstName = student.FirstName; stu.LastName = student.LastName; stu.Email = student.Email; stu.AddmissionType = student.AddmissionType; stu.Address = student.Address; stu.Gender = student.Gender; stu.Phone = student.Phone; stu.NextOfKinName = student.NextOfKinName; stu.NextOfKinEmail = student.NextOfKinEmail; stu.NextOfKinPhone = student.NextOfKinPhone; stu.Nationality = student.Nationality; stu.MaritalStatus = student.MaritalStatus; _student.UpdateStudent(stu); return(RedirectToAction("dashboard")); } return(View()); }
/// <summary>Attaches this presenter to a view.</summary> /// <param name="model"></param> /// <param name="viewBase"></param> /// <param name="parentPresenter"></param> public void Attach(object model, object viewBase, ExplorerPresenter parentPresenter) { presenter = parentPresenter; view = (ViewBase)viewBase; modelToRun = (IModel)model; nameOfJobEdit = view.GetControl <EditView>("nameOfJobEdit"); numberCPUCombobox = view.GetControl <DropDownView>("numberCPUCombobox"); apsimTypeToRunCombobox = view.GetControl <DropDownView>("apsimTypeToRunCombobox"); directoryLabel = view.GetControl <LabelView>("directoryLabel"); directoryEdit = view.GetControl <EditView>("directoryEdit"); browseButton = view.GetControl <ButtonView>("browseButton"); versionLabel = view.GetControl <LabelView>("versionLabel"); versionCombobox = view.GetControl <DropDownView>("versionCombobox"); submitButton = view.GetControl <ButtonView>("submitButton"); statusLabel = view.GetControl <LabelView>("statusLabel"); lowPriorityCheckBox = view.GetControl <CheckBoxView>("lowPriorityCheckBox"); nameOfJobEdit.Text = modelToRun.Name + DateTime.Now.ToString("yyyy-MM-dd HH.mm"); numberCPUCombobox.Values = new string[] { "16", "32", "48", "64", "80", "96", "112", "128", "256" }; numberCPUCombobox.SelectedValue = ApsimNG.Cloud.Azure.AzureSettings.Default.NumCPUCores; apsimTypeToRunCombobox.Values = new string[] { "A released version", "A directory", "A zip file" }; if (!string.IsNullOrEmpty(ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMVersion)) { apsimTypeToRunCombobox.SelectedValue = "A released version"; } else if (!string.IsNullOrEmpty(ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMDirectory)) { apsimTypeToRunCombobox.SelectedValue = "A directory"; } else if (!string.IsNullOrEmpty(ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMZipFile)) { apsimTypeToRunCombobox.SelectedValue = "A zip file"; } else { apsimTypeToRunCombobox.SelectedValue = "A released version"; } SetupWidgets(); if (!string.IsNullOrEmpty(ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMVersion)) { versionCombobox.SelectedValue = ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMVersion; } else if (!string.IsNullOrEmpty(ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMDirectory)) { directoryEdit.Text = ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMDirectory; } else if (!string.IsNullOrEmpty(ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMZipFile)) { directoryEdit.Text = ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMZipFile; } lowPriorityCheckBox.Checked = ApsimNG.Cloud.Azure.AzureSettings.Default.LowPriority; apsimTypeToRunCombobox.Changed += OnVersionComboboxChanged; browseButton.Clicked += OnBrowseButtonClicked; submitButton.Clicked += OnSubmitJobClicked; }
/// <summary> /// Processes the instance edit. /// </summary> /// <param name="runtime">The runtime.</param> /// <param name="result">The result.</param> /// <param name="view">The view.</param> /// <param name="editAction">The edit action.</param> /// <returns>ExecutionView.</returns> /// <exception cref="System.NotSupportedException">Error occured during edit: + lastError</exception> /// <exception cref="System.Collections.Generic.KeyNotFoundException">Specified edit hasn't been found</exception> private static ExecutionView processInstanceEdit(RuntimeAssembly runtime, AnalyzingResult result, ExecutionView view, EditAction editAction) { var editOwner = result.EntryContext.GetValue(editAction.Variable); string lastError = null; foreach (var edit in editOwner.Edits) { if (edit.Name != editAction.Name) { continue; } var editView = new EditView(view); var resultView = runtime.RunEdit(edit, editView); editView = (resultView as EditView); if (editView.HasError) { lastError = editView.Error; continue; } return(editView.CopyView()); } if (lastError != null) { throw new NotSupportedException("Error occured during edit: " + lastError); } throw new KeyNotFoundException("Specified edit hasn't been found"); }
/// <summary> /// Called when the user double clicks a cell in the room booking view. If the cell matches the HH:mm-regex, a new EditView is opened on the specified hour, with the logged in person and on the room on that row. Else the cell is marked as yellow until un-hovered /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void HandleCellDoubleClick(object sender, CellClickEventArgs e) { if (e.ColumnIndex > 4) { e.SubItem.BackColor = System.Drawing.Color.Yellow; if (e.ClickCount == 2 && this.LoggedInUser != null) { string itemText = e.SubItem.Text; if (Regex.IsMatch(itemText, "[0-9]{2}:[0-9]{2}")) { // Updating logged in user this.LoggedInUser = (Person) new DAL(this).Get(LoggedInUser).First(); Room targetRoom = (Room)e.Model; Booking b = new Booking(); b.RoomId = targetRoom.Id; b.PersonId = this.LoggedInUser.Id; DateTime parsedDate = DateTime.Parse(e.SubItem.Text); DateTime startDate = new DateTime(OnDateFilter.Year, OnDateFilter.Month, OnDateFilter.Day, parsedDate.Hour, parsedDate.Minute, 0); b.Start_time = startDate; b.End_time = b.Start_time.AddHours(1); EditView ev = new EditView(b, false); EditViewController editController = new EditViewController(ev, guiMainController: this, disableBookingTimePicker: true); ev.Show(); } } else if (this.LoggedInUser == null) { this.NotifyExceptionToView("Vänligen logga in för att boka rum"); } } }
public static IEditViewModel GetEditView(this IGeneralFacade _IGeneralFacade, AnketaViewModel _anketaViewModel) { IEditViewModel ievm = new EditViewModel(_anketaViewModel, _IGeneralFacade.Keeper); EditView editview = new EditView(ievm); return(ievm); }
/// <summary> /// 创建新的窗口 /// </summary> /// <param name="noteModel"></param> public void CreateNoteWindow(NoteModel noteModel) { EditView editView = new EditView(noteModel); NoteWindowsDic.Add(noteModel.GuidId, editView); editView.Show(); }
public void UpdateView(View view) { if (view is EditText EditView) { EditView.SetTextColor(_TextColor); EditView.Enabled = false; } }
private void OnEditCommand(object obj) { EditView edit = new EditView(Personne); edit.Name = "Modifier"; edit.ShowDialog(); NotifyPropertyChanged("ListeJoueur"); }
public void SetController(PackageController controller) { IndexView.SetController(controller); CreateView.SetController(controller); EditView.SetController(controller); DetailView.SetController(controller); DeleteView.SetController(controller); }
/// <summary> /// Show an EditView with the param IModel /// </summary> /// <param name="model">The model that sets the controls. Its attributes can be set or empty.</param> /// <param name="isExistingItemInDatabase">If the IModel is an existing item in the database, to know if the ID should be updated or inserted when Save is clicked.</param> private void ShowEditView(IModel model, bool isExistingItemInDatabase) { if (model != null) { EditView ev = new EditView(model, isExistingItemInDatabase); EditViewController editController = new EditViewController(ev, this); ev.Show(); } }
public ActionResult Edit(EditView editView) { if (ModelState.IsValid) { ((StudentService)(studentService)).Edit(Mapper.Map <EditView, StudentInfo>(editView)); return(RedirectToAction("login")); } return(View(editView)); }
private void Apply() { EditView view = _views[viewTabs.SelectedTab]; _data = view.GetRawData(); DialogResult = DialogResult.OK; Close(); }
/// <summary> /// Saves the values in the EditViews controls and returns them as a Dictionary with key = attributename, value = the value from the control /// </summary> /// <param name="controls">The list of controls in the EditView</param> /// <returns>Key = attributename, value = the value from the control</returns> private Dictionary <string, object> ViewControlsToDictionary(Control.ControlCollection controls) { Dictionary <string, object> controlValues = new Dictionary <string, object>(); foreach (Control c in controls) { if (c is NumberTextBox) { NumberTextBox numTextBox = (NumberTextBox)c; if (numTextBox.Text.Length > 0) { try { controlValues[c.Name] = Int32.Parse(numTextBox.Text); } catch (Exception e) { if (e is OverflowException || e is FormatException) { EditView.SetResponseLabel("Ett nummer är för stort, försök igen"); } return(null); } } else { controlValues[c.Name] = null; } } else if (c is TextBox) { TextBox txtBox = (TextBox)c; controlValues[c.Name] = String.IsNullOrEmpty(txtBox.Text) ? null : txtBox.Text; } else if (c is DateTimePicker) { controlValues[c.Name] = ((DateTimePicker)c).Value; } else if (c is ComboBox) { IModel selectedIModel = (IModel)((ComboBox)c).SelectedItem; if (selectedIModel != null) { controlValues[c.Name] = selectedIModel.GetIdentifyingAttributes().First().Value; } else { controlValues[c.Name] = null; } } else if (c is CheckedListBox) { // Skip, handled after the main-query is done } } return(controlValues); }
public ActionResult Edit(EditView editView) { if (ModelState.IsValid) { PostInfo postInfo = Mapper.Map <EditView, PostInfo>(editView); ((PostService)(postService)).Edit(postInfo); return(RedirectToAction("Index", "Post", postInfo)); } return(View(editView)); }
public EditViewModel(EditView modifier) { Intervention = " "; Nom = " "; IntervenantCommand = new DelegateCommand(OnIntervenantAction, CanExecuteIntervenant); InternauteCommand = new DelegateCommand(OnInternauteAction, CanExecuteInternaute); NormalCloseCommand = new DelegateCommand(OnNormalCloseAction, CanExecuteNormalClose); TestI = true; NormalEnd = false; }
/// <summary> /// コンストラクター /// </summary> public FooTextBox() { this.VScrollBar = new VScrollBar(); this.VScrollBar.Scroll += new ScrollEventHandler(VScrollBar_Scroll); this.VScrollBar.Dock = DockStyle.Right; this.VScrollBar.Visible = true; this.Controls.Add(this.VScrollBar); this.HScrollBar = new HScrollBar(); this.HScrollBar.Scroll += new ScrollEventHandler(HScrollBar_Scroll); this.HScrollBar.Dock = DockStyle.Bottom; this.HScrollBar.Visible = true; this.Controls.Add(this.HScrollBar); this.SetStyle(ControlStyles.ResizeRedraw, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.Opaque, true); this.render = new D2DTextRender(this); this.Document = new Document(); this.Document.LayoutLines.Render = this.render; this.Document.AutoComplete = new AutoCompleteBox(this); this.Document.AutoComplete.GetPostion = (tp, doc) => { var p = this.GetPostionFromTextPoint(tp); p.Y += (int)this.render.emSize.Height; return(p); }; this.View = new EditView(this.Document, this.render, new FooEditEngine.Padding(5, 5, 5, 5)); this.View.SrcChanged += View_SrcChanged; this.Controller = new Controller(this.Document, this.View); this.Document.SelectionChanged += new EventHandler(Controller_CaretMoved); this.Ime = new WinIME(this); this.Ime.ImeCompstion += new ImeCompstionEventHandeler(Ime_ImeCompstion); this.Ime.StartCompstion += new StartCompstionEventHandeler(Ime_StartCompstion); this.Ime.EndCompstion += new EndCompstionEventHandeler(Ime_EndCompstion); this.Ime.ImeDocumentFeed += new ImeDocumentFeedEventHandler(Ime_ImeDocumentFeed); this.Ime.ImeReconvert += new ImeReconvertStringEventHandler(Ime_ImeReconvert); this.Ime.ImeQueryReconvert += new ImeQueryReconvertStringEventHandler(Ime_ImeQueryReconvert); this.Timer = new System.Windows.Forms.Timer(); this.Timer.Tick += new EventHandler(this.Timer_Tick); this.Timer.Interval = Interval; this.SetSystemParamaters(); this.TabStopChange += new TabStopChangeEventHandler((s, e) => { }); this.InsetModeChange += new InsertModeChangeEventHandler((s, e) => { }); this.SelectionChanged += new EventHandler((s, e) => {}); this.RightToLeftChanged += FooTextBox_RightToLeftChanged; SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged); }
private static void OnEditClick(object sender, EventArgs e) { PageContain.Children.Clear(); EditView editview = new EditView(); editview.leftbutton.Clicked += OnSaveClick; editview.rightbutton.Clicked += (sender, args) => { RetrunListView(); }; editview.midbutton.Clicked += (sender, args) => { KeyGenEvent(false); }; PageContain.Children.Add(editview.viewcontain); }
public ActionResult Edit(EditView myModel) { USER uSER = myModel.User; //LOGIN LUser = myModel.LUser; //PAID_STAFF PUser = myModel.PUser; if (Request.IsAuthenticated) { if (ModelState.IsValid) { if (myModel.User.user_type != "Volunteer" && myModel.PUser == null) { ViewBag.location = new SelectList(db.LOCATIONs, "locationID", "name", uSER.location); ViewBag.userID = new SelectList(db.PAID_STAFF, "emplID", "pay_schedule", uSER.userID); ViewBag.userID = new SelectList(db.UNIT_DIRECTOR, "emplID", "emplID", uSER.userID); ViewBag.manager = new SelectList(db.USERs, "userID", "fname", uSER.manager); ViewBag.userID = new SelectList(db.VOLUNTEERs, "volID", "volID", uSER.userID); PAID_STAFF newPaid = new PAID_STAFF(); newPaid.emplID = myModel.User.userID; db.PAID_STAFF.Add(newPaid); myModel.PUser = newPaid; db.SaveChanges(); return(View(myModel)); } db.Entry(myModel.User).State = EntityState.Modified; db.Entry(myModel.LUser).State = EntityState.Modified; if (myModel.PUser != null) { db.Entry(myModel.PUser).State = EntityState.Modified; } if (myModel.User.user_type == "Volunteer" && myModel.PUser != null) { PAID_STAFF old = db.PAID_STAFF.Find(myModel.PUser.emplID); db.PAID_STAFF.Remove(old); } db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.location = new SelectList(db.LOCATIONs, "locationID", "name", uSER.location); ViewBag.userID = new SelectList(db.PAID_STAFF, "emplID", "pay_schedule", uSER.userID); ViewBag.userID = new SelectList(db.UNIT_DIRECTOR, "emplID", "emplID", uSER.userID); ViewBag.manager = new SelectList(db.USERs, "userID", "fname", uSER.manager); ViewBag.userID = new SelectList(db.VOLUNTEERs, "volID", "volID", uSER.userID); return(View(myModel)); } else { return(RedirectToAction("Index", "Home")); } }
/// <summary> /// Runs the edit on given view. /// </summary> /// <param name="edit">The edit.</param> /// <param name="view">The view.</param> /// <returns>Edited view.</returns> private EditViewBase runEdit(Edit edit, EditView view) { try { return(view.Apply(edit.Transformation)); } catch (Exception ex) { return(view.Abort(ex.Message)); } }
public static void Show(int p_viewIndex, object p_dataContext, bool p_isModal, Action <bool?> p_closeAction) { UserControl control = null; switch (p_viewIndex) { case 0: control = new EditView(); break; case 1: control = new ShowListView(); break; default: throw new ArgumentOutOfRangeException("p_viewIndex", "Такого индекса View не существует"); } if (control != null) { Window wnd = new Window(); wnd.SizeToContent = SizeToContent.WidthAndHeight; control.DataContext = p_dataContext; StackPanel sp = new StackPanel(); sp.Children.Add(control); Button applyButton = new Button(); applyButton.Content = "Принять"; applyButton.Click += (s, e) => { if (p_isModal) { wnd.DialogResult = true; } else { wnd.Close(); } }; StackPanel buttonPanel = new StackPanel(); buttonPanel.Orientation = Orientation.Horizontal; buttonPanel.Children.Add(applyButton); sp.Children.Add(buttonPanel); wnd.Content = sp; wnd.Closed += (s, e) => p_closeAction(wnd.DialogResult); if (p_isModal) { Button cancelButton = new Button(); cancelButton.Content = "Отмена"; cancelButton.Click += (s, e) => wnd.DialogResult = false; buttonPanel.Children.Add(cancelButton); wnd.ShowDialog(); } else { wnd.Show(); } } }
/// <summary> /// Called when the user clicks my profile in the MenuStrip /// </summary> public void HandleMyProfileMenuStripClick() { if (this.LoggedInUser != null) { DAL dal = new DAL(this); this.LoggedInUser = (Person)dal.Get(this.LoggedInUser).First(); EditView ev = new EditView(this.LoggedInUser, isExistingItemInDatabase: true, isMyProfileClick: true); EditViewController editController = new EditViewController(ev); ev.Show(); } }
/// <summary> /// Called when the user clicks Delete. The IModel is parsed from the controls in the EditView and is then attempted to be deleted from the database /// </summary> public void HandleDeleteButtonClick() { IModel model = null; var controlValues = this.ViewControlsToDictionary(EditView.GetControls()); model = Utils.ParseWinFormsToIModel(EditView.Model, controlValues, QueryType.REMOVE); if (model != null) { this.Delete(model); this.isExistingObjectInDatabase = false; } }
private void NewProjectBtn_Click(object sender, RoutedEventArgs e) { var page = new EditView(); if (page.ShowDialog() != true) { return; } ViewModel.Load(); Title = "Undefined Project - ZoDream Spider"; ViewModel.Instance !.Option = page.Option; ViewModel.Instance.RuleProvider.Add(page.Rules); }
public EditViewModel(FrameworkUIModel framework, string locale) { this.Framework = framework; this.Locale = locale; EditView editView = new EditView { DataContext = this }; BackToMain = new RelayCommand(x => { editView.Close(); }); editView.ShowDialog(); }
private void ExportRaw(string path) { try { using (FileStream fstr = File.Open(path, FileMode.Create, FileAccess.Write, FileShare.None)) { EditView view = _views[viewTabs.SelectedTab]; byte[] data = view.GetRawData(); fstr.Write(data, 0, data.Length); } } catch (Exception e) { MessageBox.Show("エクスポートに失敗しました。\"" + path + "\"\n\nException: " + e.Message); } }
public void SelectByWordTest() { DummyRender render = new DummyRender(); Document doc = new Document(); doc.LayoutLines.Render = render; EditView view = new EditView(doc, render); Controller ctrl = new Controller(doc, view); doc.Clear(); doc.Append("this is a pen"); doc.SelectWord(0); Assert.IsTrue(ctrl.SelectedText == "this"); }