public void Launch() { if (LoginSession.Current == null) { this.Context.DesktopWindow.ShowMessageBox( SR.MessageFeatureRequiresWorkstationRestart, MessageBoxActions.Ok); return; } try { if (LoginSession.Current.Staff == null) { this.Context.DesktopWindow.ShowMessageBox( string.Format(SR.FormatUserHasNoStaffProfile, LoginSession.Current.UserName), MessageBoxActions.Ok); return; } var component = new StaffEditorComponent(LoginSession.Current.Staff.StaffRef); ApplicationComponent.LaunchAsDialog( this.Context.DesktopWindow, component, SR.TitleStaff); } catch (Exception e) { // could not launch component ExceptionHandler.Report(e, this.Context.DesktopWindow); } }
public void Launch() { if (LoginSession.Current == null) { this.Context.DesktopWindow.ShowMessageBox( "This feature will be available the next time you start the workstation.", MessageBoxActions.Ok); return; } try { if (LoginSession.Current.Staff == null) { this.Context.DesktopWindow.ShowMessageBox( string.Format("There is no staff profile associated with the user '{0}'", LoginSession.Current.UserName), MessageBoxActions.Ok); return; } var component = new StaffEditorComponent(LoginSession.Current.Staff.StaffRef); ApplicationComponent.LaunchAsDialog( this.Context.DesktopWindow, component, SR.TitleStaff); } catch (Exception e) { // could not launch component ExceptionHandler.Report(e, this.Context.DesktopWindow); } }
/// <summary> /// Called to handle the "add" action. /// </summary> /// <param name="addedItems"></param> /// <returns>True if items were added, false otherwise.</returns> protected override bool AddItems(out IList <StaffSummary> addedItems) { addedItems = new List <StaffSummary>(); StaffEditorComponent editor = new StaffEditorComponent(); ApplicationComponentExitCode exitCode = ApplicationComponent.LaunchAsDialog( this.Host.DesktopWindow, editor, SR.TitleAddStaff); if (exitCode == ApplicationComponentExitCode.Accepted) { addedItems.Add(editor.StaffSummary); return(true); } return(false); }
/// <summary> /// Called to handle the "edit" action. /// </summary> /// <param name="items">A list of items to edit.</param> /// <param name="editedItems">The list of items that were edited.</param> /// <returns>True if items were edited, false otherwise.</returns> protected override bool EditItems(IList <StaffSummary> items, out IList <StaffSummary> editedItems) { editedItems = new List <StaffSummary>(); StaffSummary item = CollectionUtils.FirstElement(items); StaffEditorComponent editor = new StaffEditorComponent(item.StaffRef); ApplicationComponentExitCode exitCode = ApplicationComponent.LaunchAsDialog( this.Host.DesktopWindow, editor, SR.TitleUpdateStaff + " - " + item.Name); if (exitCode == ApplicationComponentExitCode.Accepted) { editedItems.Add(editor.StaffSummary); return(true); } return(false); }
public EditorContext(StaffEditorComponent owner) { _owner = owner; }