Beispiel #1
0
        /// <summary>
        /// Stellt eine Revision wieder her
        /// </summary>
        /// <param name="revision">Die wiederherzustellende Revision.</param>
        internal void RestoreRevision(SheetRevision revision)
        {
            this.entrys.Clear();
            foreach (var entry in revision.Entrys)
            {
                this.entrys.Add(new SheetEntry(entry));
            }

            this.Entrys = new ObservableCollection <SheetEntry>(revision.Entrys.Select(o => new SheetEntry(o)));
        }
Beispiel #2
0
        /// <summary>
        /// Wird ausgeführt wenn eine Tabellenzeile Doppelt geklickt wird.
        /// </summary>
        /// <param name="sender">Der Sender.</param>
        /// <param name="e">Die Argumente.</param>
        private void Revisions_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            DataGridRow   row = ItemsControl.ContainerFromElement((DataGrid)sender, e.OriginalSource as DependencyObject) as DataGridRow;
            SheetRevision contextSheetRevision = (SheetRevision)row.DataContext;

            RevisionDetailsWindow window = new RevisionDetailsWindow();

            window.SheetRevision = contextSheetRevision;
            window.ShowDialog();
        }
Beispiel #3
0
        /// <summary>
        /// Wird ausgeführt wenn der Wiederhestellen Button geklickt wird.
        /// </summary>
        /// <param name="sender">Der Sender.</param>
        /// <param name="e">Die Argumente.</param>
        private void Wiederherstellen_Click(object sender, RoutedEventArgs e)
        {
            Sheet.Revisions.Add(Sheet.MakeRevision());

            SheetRevision revisionToRestore = (SheetRevision)this.RevisionsTable.SelectedItem;

            Sheet.Revisions.Remove(revisionToRestore);
            Sheet.RestoreRevision(revisionToRestore);

            this.Close();
        }
Beispiel #4
0
        /// <summary>
        /// Erstellt eine Revision aus dem Aktuellen zustand.
        /// </summary>
        /// <returns>Die erstellte Revision.</returns>
        public SheetRevision MakeRevision()
        {
            SheetRevision revision = new SheetRevision();

            revision.Date = DateTime.Now;

            revision.Entrys.Clear();
            foreach (var entry in this.entrys)
            {
                revision.Entrys.Add(new SheetRevisionEntry(entry));
            }

            return(revision);
        }
Beispiel #5
0
        /// <summary>
        /// Wird aufgerufen wenn die Haupt Tabelle Doppelt geklickt wird.
        /// </summary>
        /// <param name="sender">Der Sender.</param>
        /// <param name="e">Die Argumente.</param>
        private void MainTable_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            DataGridRow row          = ItemsControl.ContainerFromElement((DataGrid)sender, e.OriginalSource as DependencyObject) as DataGridRow;
            Sheet       contextSheet = (Sheet)row.DataContext;

            SheetRevision revision = contextSheet.MakeRevision();

            SheetWindow window = new SheetWindow();

            window.Sheet = contextSheet;

            if (window.ShowDialog() == true)
            {
                if (contextSheet.Revisions.Count > 0 || revision.Entrys.Count > 0)
                {
                    contextSheet.Revisions.Add(revision);
                }
            }
            else
            {
                contextSheet.RestoreRevision(revision);
            }
        }