/// <summary>
        /// React on new version button click.
        /// </summary>
        /// <param name="sender">Ignored.</param>
        /// <param name="e">Ignored.</param>
        private void _NewVersionButtonClick(object sender, RoutedEventArgs e)
        {
            try
            {
                XceedGrid.EndEdit();
                WorkingStatusHelper.SetBusy((string)App.Current.FindResource("CreatingScheduleVersionStatus"));

                _UnsubscribeFromGridSelection();

                // Make version, add to project and save.
                Debug.Assert(_SelectedSchedule != null);
                Schedule newSchedule = _MakeScheduleVersion(_SelectedSchedule, _ScheduleVersions);
                App.Current.Project.Schedules.Add(newSchedule);
                App.Current.Project.Save();

                _SubscribeToGridSelection();

                // Select new schedule.
                XceedGrid.SelectedItem = newSchedule;
            }
            finally
            {
                WorkingStatusHelper.SetReleased();
            }
        }
        /// <summary>
        /// Changed selection in RadioButtons and reloads project
        /// </summary>
        /// <param name="e"></param>
        private void _ChangeSelectedProject(RoutedEventArgs e)
        {
            if (XceedGrid.SelectedIndex != -1)
            {
                Row row = XceedVisualTreeHelper.GetRowByEventArgs(e);

                Debug.Assert(row != null);

                // NOTE : when user clicks so fast on radio buttons sometimes row's content can't be updated in time.
                // In that case we should do nothing
                if (row.Cells[NAME_COLUMN_CAPTION].Content == null)
                {
                    return;
                }

                string checkedProjectName = row.Cells[NAME_COLUMN_CAPTION].Content.ToString();

                _LoadProject(checkedProjectName);
                try
                {
                    XceedGrid.EndEdit();
                }
                catch
                {
                    XceedGrid.CancelEdit();
                }
            }
        }
        private void DriversPage_NavigationCalled(object sender, EventArgs e)
        {
            try
            {
                XceedGrid.EndEdit();
                CanBeLeft = true;
            }
            catch
            {
                CanBeLeft = false;
            }

            // If there are validation errors - show them.
            CanBeLeftValidator <Driver> .ShowErrorMessagesInMessageWindow(App.Current.Project.Drivers);
        }
Beispiel #4
0
        /// <summary>
        /// Occurs when navigation called - stops editing in datagrid control.
        /// </summary>
        /// <param name="sender">Ignored.</param>
        /// <param name="e">Ignored.</param>
        private void _BarriersPageNavigationCalled(object sender, EventArgs e)
        {
            try
            {
                XceedGrid.EndEdit();
                CanBeLeft = true;
            }
            catch
            {
                CanBeLeft = false;
            }

            // If there are validation errors - show them.
            var barriers = (IDataObjectCollection <Barrier>)_collectionSource.Source;

            CanBeLeftValidator <Barrier> .ShowErrorMessagesInMessageWindow(barriers);
        }
Beispiel #5
0
        /// <summary>
        /// Occurs when user try navigate to other page.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LocationsPage_NavigationCalled(object sender, EventArgs e)
        {
            if (_geocodablePage.IsGeocodingInProcess)
            {
                CanBeLeft = false;
            }
            else
            {
                CanBeLeft = true;
                try
                {
                    XceedGrid.EndEdit();
                    CanBeLeft = true;
                }
                catch
                {
                    CanBeLeft = false;
                }
            }

            // If there are validation errors - show them.
            CanBeLeftValidator <Location> .ShowErrorMessagesInMessageWindow(App.Current.Project.Locations);
        }
Beispiel #6
0
        /// <summary>
        /// Occurs when navigation called - stops xceed edit.
        /// </summary>
        /// <param name="sender">Ignored.</param>
        /// <param name="e">Ignored.</param>
        private void DefaultRoutesPage_NavigationCalled(object sender, EventArgs e)
        {
            try
            {
                XceedGrid.EndEdit();
                CanBeLeft = true;
            }
            catch
            {
                CanBeLeft = false;
            }

            // If we will navigate to other page - check routes for updates.
            if (CanBeLeft)
            {
                _defaultRoutesController.CheckDefaultRoutesForUpdates();
            }
            // Else - show validation errors.
            else
            {
                CanBeLeftValidator <Route> .ShowErrorMessagesInMessageWindow
                    (App.Current.Project.DefaultRoutes);
            }
        }