/// <summary>
 /// Updates the data entry mode for all control view models.
 /// </summary>
 /// <param name="dataEntryMode">New DataEntryMode.</param>
 public void UpdateDataEntryMode(DataEntryMode dataEntryMode)
 {
     foreach (ControlViewModel cvm in Controls)
     {
         cvm.DataEntryMode = dataEntryMode;
     }
 }
        public JournalDialog(WorkItem workItem, JournalEntry entry, DataEntryMode mode)
        {
            _workItem = workItem;

            if (entry != null)
            {
                Entry = entry;
            }

            DialogMode = mode;
            InitializeComponent();
            DataContext = this;

            // Dodgy implementation; should be binding
            if ((mode == DataEntryMode.EDIT) || (mode == DataEntryMode.DELETE))
            {
                JournalHeaderTextBox.Text = entry.Title;
                JournalEntryTextBox.Text  = entry.Entry;
            }

            if (mode == DataEntryMode.ADD)
            {
                JournalHeaderTextBox.Focus();
            }
            else if (mode == DataEntryMode.EDIT)
            {
                JournalEntryTextBox.Focus();
            }
        }
Example #3
0
        /// <summary>
        /// Initializes a new MainViewModel instance.
        /// </summary>
        public MainViewModel()
        {
            _exampleStrategyProvider = new ExampleStrategyProvider();

            // Set Create mode as the default
            _dataEntryMode = DataEntryMode.Create;
        }
Example #4
0
        public UserViewModel(DataEntryMode mode, User user,
                             Window activeWindow, Action exitAction)
        {
            _Mode         = mode;
            _User         = user;
            _ActiveWindow = activeWindow;
            _ExitAction   = exitAction;

            FetchExisting();
        }
Example #5
0
        /// <summary>
        /// Set the mode the Application is in.
        /// </summary>
        /// <param name="newMode"></param>
        public void SetApplicationMode(DataEntryMode newMode)
        {
            DataEntryMode oldMode = _appMode;

            _appMode = newMode;
            OnPropertyChanged("");
            var eventArgs = new AppEventArgs(AppAction.SET_APPLICATION_MODE, oldMode, newMode);

            appEvent?.Invoke(this, eventArgs);
        }
Example #6
0
 public virtual void SetMode(DataEntryMode mode)
 {
     _Mode = mode;
 }