comparison Chronosv2/source/Presentation/ViewModel/WorkspaceViewModel.cs @ 10:443821e55f06

Initial cleaned up add from Codeplex files
author stevenh7776 stevenhollidge@hotmail.com
date Tue, 21 Feb 2012 17:25:44 +0700
parents
children
comparison
equal deleted inserted replaced
9:904a9faadf8b 10:443821e55f06
1 /*
2 The MIT License
3
4 Copyright (c) 2009-2010. Carlos Guzmán Álvarez. http://chronoswpf.codeplex.com/
5
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 THE SOFTWARE.
23 */
24
25 using System;
26 using System.ComponentModel;
27 using System.Threading;
28 using System.Threading.Tasks;
29 using Chronos.Presentation.Core.ViewModel;
30 using Chronos.Presentation.Core.VirtualDesktops;
31 using Chronos.Presentation.Core.Windows;
32 using NLog;
33 using nRoute.Components;
34
35 namespace Chronos.Presentation.ViewModel
36 {
37 /// <summary>
38 /// Base application class for workspace windows
39 /// </summary>
40 /// <typeparam name="TEntity">The type of the data model.</typeparam>
41 public abstract class WorkspaceViewModel<TEntity> :
42 WindowViewModel<TEntity>, IWorkspaceViewModel<TEntity> where TEntity : class, INotifyPropertyChanged, IDataErrorInfo, new()
43 {
44 #region · Logger ·
45
46 private static Logger Logger = LogManager.GetCurrentClassLogger();
47
48 #endregion
49
50 #region · PropertyChangedEventArgs Cached Instances ·
51
52 private static readonly PropertyChangedEventArgs HasBookmarksChangedArgs = CreateArgs<WorkspaceViewModel<TEntity>>(x => x.HasBookMarks);
53 private static readonly PropertyChangedEventArgs HasRelationsChangedArgs = CreateArgs<WorkspaceViewModel<TEntity>>(x => x.HasRelations);
54 private static readonly PropertyChangedEventArgs ShowZoomWindowChangedArgs = CreateArgs<WorkspaceViewModel<TEntity>>(x => x.ShowZoomWindow);
55 private static readonly PropertyChangedEventArgs ZoomLevelChangedArgs = CreateArgs<WorkspaceViewModel<TEntity>>(x => x.ZoomLevel);
56
57 #endregion
58
59 #region · Fields ·
60
61 private bool hasBookMarks;
62 private bool showZoomWindow;
63 private double zoomLevel;
64
65 #region · Commands ·
66
67 private ActionCommand addNewCommand;
68 private ActionCommand editCommand;
69 private ActionCommand deleteCommand;
70 private ActionCommand saveCommand;
71 private ActionCommand discardCommand;
72 private ActionCommand printCommand;
73 private ActionCommand printPreviewCommand;
74 private ActionCommand createShortcutCommand;
75 private ActionCommand bookmarkCurrentCommand;
76 private ActionCommand clearBookmarksCommand;
77 private ActionCommand organizeBookmarksCommand;
78 private ActionCommand showFormHelpCommand;
79 private ActionCommand showZoomWindowCommand;
80
81 #endregion
82
83 #endregion
84
85 #region · IWorkspaceViewModel<TEntity> Commands ·
86
87 /// <summary>
88 /// Gets the add new command
89 public ActionCommand AddNewCommand
90 {
91 get
92 {
93 if (this.addNewCommand == null)
94 {
95 this.addNewCommand = new ActionCommand
96 (
97 () => OnAddNew(),
98 () => CanAddNew()
99 );
100 }
101
102 return this.addNewCommand;
103 }
104 }
105
106 /// <summary>
107 /// Gets the edit command
108 /// </summary>
109 public ActionCommand EditCommand
110 {
111 get
112 {
113 if (this.editCommand == null)
114 {
115 this.editCommand = new ActionCommand
116 (
117 () => OnEdit(),
118 () => CanEdit()
119 );
120 }
121
122 return this.editCommand;
123 }
124 }
125
126 /// <summary>
127 /// Gets the delete command
128 /// </summary>
129 public ActionCommand DeleteCommand
130 {
131 get
132 {
133 if (this.deleteCommand == null)
134 {
135 this.deleteCommand = new ActionCommand
136 (
137 () => OnDelete(),
138 () => CanDelete()
139 );
140 }
141
142 return this.deleteCommand;
143 }
144 }
145
146 /// <summary>
147 /// Gets the save command
148 /// </summary>
149 public ActionCommand SaveCommand
150 {
151 get
152 {
153 if (this.saveCommand == null)
154 {
155 this.saveCommand = new ActionCommand
156 (
157 () => OnSave(),
158 () => CanSave()
159 );
160 }
161
162 return this.saveCommand;
163 }
164 }
165
166 /// <summary>
167 /// Gets the discard command
168 /// </summary>
169 public ActionCommand DiscardCommand
170 {
171 get
172 {
173 if (this.discardCommand == null)
174 {
175 this.discardCommand = new ActionCommand
176 (
177 () => OnDiscard(),
178 () => CanDiscard()
179 );
180 }
181
182 return this.discardCommand;
183 }
184 }
185
186 /// <summary>
187 /// Gets the print command
188 /// </summary>
189 public ActionCommand PrintCommand
190 {
191 get
192 {
193 if (this.printCommand == null)
194 {
195 this.printCommand = new ActionCommand
196 (
197 () => OnPrint(),
198 () => CanPrint()
199 );
200 }
201
202 return this.printCommand;
203 }
204 }
205
206 /// <summary>
207 /// Gets the print preview command
208 /// </summary>
209 public ActionCommand PrintPreviewCommand
210 {
211 get
212 {
213 if (this.printPreviewCommand == null)
214 {
215 this.printPreviewCommand = new ActionCommand
216 (
217 () => OnPrintPreview(),
218 () => CanPrintPreview()
219 );
220 }
221
222 return this.printPreviewCommand;
223 }
224 }
225
226 /// <summary>
227 /// Gets the show form help command
228 /// </summary>
229 public ActionCommand ShowFormHelpCommand
230 {
231 get
232 {
233 if (this.showFormHelpCommand == null)
234 {
235 this.showFormHelpCommand = new ActionCommand
236 (
237 () => OnShowFormHelp(),
238 () => CanShowFormHelp()
239 );
240 }
241
242 return this.showFormHelpCommand;
243 }
244 }
245
246 /// <summary>
247 /// Gets the show zoom window command
248 /// </summary>
249 public ActionCommand ShowZoomWindowCommand
250 {
251 get
252 {
253 if (this.showZoomWindowCommand == null)
254 {
255 this.showZoomWindowCommand = new ActionCommand
256 (
257 () => OnShowZoomWindow(),
258 () => CanShowZoomWindow()
259 );
260 }
261
262 return this.showZoomWindowCommand;
263 }
264 }
265
266 #endregion
267
268 #region · IBookmarkViewModel Commands ·
269
270 /// <summary>
271 /// Gets the bookmark current command
272 /// </summary>
273 public ActionCommand BookmarkCurrentCommand
274 {
275 get
276 {
277 if (this.bookmarkCurrentCommand == null)
278 {
279 this.bookmarkCurrentCommand = new ActionCommand
280 (
281 () => OnBookmarkCurrent(),
282 () => CanBookmarkCurrent()
283 );
284 }
285
286 return this.bookmarkCurrentCommand;
287 }
288 }
289
290 /// <summary>
291 /// Gets the clear bookmarks command
292 /// </summary>
293 public ActionCommand ClearBookmarksCommand
294 {
295 get
296 {
297 if (this.clearBookmarksCommand == null)
298 {
299 this.clearBookmarksCommand = new ActionCommand
300 (
301 () => OnClearBookmarks(),
302 () => CanClearBookmarks()
303 );
304 }
305
306 return this.clearBookmarksCommand;
307 }
308 }
309
310 /// <summary>
311 /// Gets the organize bookmarks command
312 /// </summary>
313 public ActionCommand OrganizeBookmarksCommand
314 {
315 get
316 {
317 if (this.organizeBookmarksCommand == null)
318 {
319 this.organizeBookmarksCommand = new ActionCommand
320 (
321 () => OnOrganizeBookmarks(),
322 () => CanOrganizeBookmarks()
323 );
324 }
325
326 return this.organizeBookmarksCommand;
327 }
328 }
329
330 /// <summary>
331 /// Gets the create shortcut command
332 /// </summary>
333 public ActionCommand CreateShortcutCommand
334 {
335 get
336 {
337 if (this.createShortcutCommand == null)
338 {
339 this.createShortcutCommand = new ActionCommand
340 (
341 () => OnCreateShortcut(),
342 () => CanCreateShortcut()
343 );
344 }
345
346 return this.createShortcutCommand;
347 }
348 }
349
350 #endregion
351
352 #region · IBookmarkViewModel Properties ·
353
354 /// <summary>
355 /// Gets a value indicating if there are available bookmarks
356 /// </summary>
357 public bool HasBookMarks
358 {
359 get { return this.hasBookMarks; }
360 set
361 {
362 if (this.hasBookMarks != value)
363 {
364 this.hasBookMarks = value;
365 this.NotifyPropertyChanged(HasBookmarksChangedArgs);
366 }
367 }
368 }
369
370 #endregion
371
372 #region · IEntityViewModel<TEntity> Properties & Indexers ·
373
374 /// <summary>
375 /// Gets an error message indicating what is wrong with this object.
376 /// </summary>
377 /// <value>
378 /// An error message indicating what is wrong with this object. The default is
379 /// an empty string ("").
380 /// </value>
381 public virtual string Error
382 {
383 get
384 {
385 if (this.IsEditing &&
386 this.Entity != null)
387 {
388 return this.Entity.Error;
389 }
390
391 return null;
392 }
393 }
394
395 /// <summary>
396 /// Gets the error message for the property with the given name.
397 /// </summary>
398 /// <param name="columnName">The name of the property whose error message to get.</param>
399 /// <value>The error message for the property. The default is an empty string ("").</value>
400 public virtual string this[string columnName]
401 {
402 get
403 {
404 if (this.IsEditing &&
405 this.Entity != null)
406 {
407 return this.Entity[columnName];
408 }
409
410 return null;
411 }
412 }
413
414 /// <summary>
415 /// Gets a value indicating wheter this instance is valid
416 /// </summary>
417 public virtual bool IsValid
418 {
419 get { return String.IsNullOrEmpty(this.Error); }
420 }
421
422 /// <summary>
423 /// Gets a value indicating wheter this instance has changes
424 /// </summary>
425 public virtual bool HasChanges
426 {
427 get { return false; }
428 }
429
430 #endregion
431
432 #region · IWorkspaceViewModel<TEntity> Properties ·
433
434 /// <summary>
435 /// Gets or sets a value indicating whether the zoom window is shown
436 /// </summary>
437 public bool ShowZoomWindow
438 {
439 get { return this.showZoomWindow; }
440 set
441 {
442 if (this.showZoomWindow != value)
443 {
444 this.showZoomWindow = value;
445 this.NotifyPropertyChanged(ShowZoomWindowChangedArgs);
446 }
447 }
448 }
449
450 /// <summary>
451 /// Gets or sets the zoom level
452 /// </summary>
453 public double ZoomLevel
454 {
455 get { return this.zoomLevel; }
456 set
457 {
458 if (this.zoomLevel != value)
459 {
460 this.zoomLevel = value;
461 this.NotifyPropertyChanged(ZoomLevelChangedArgs);
462 }
463 }
464 }
465
466 #endregion
467
468 #region · Private Properties ·
469
470 private bool IsEditing
471 {
472 get
473 {
474 return this.ViewMode == ViewModeType.Add ||
475 this.ViewMode == ViewModeType.Edit;
476 }
477 }
478
479 #endregion
480
481 #region · Constructors ·
482
483 /// <summary>
484 /// Initializes a new instance of the <see cref="WorkspaceViewModel&lt;TEntity&gt;"/> class.
485 /// </summary>
486 protected WorkspaceViewModel()
487 : base()
488 {
489 this.ZoomLevel = 100;
490 }
491
492 #endregion
493
494 #region · Command Actions ·
495
496 #region · Add New ·
497
498 protected virtual bool CanAddNew()
499 {
500 return false;
501 }
502
503 protected virtual void OnAddNew()
504 {
505 Logger.Debug("Add new '{0}", typeof(TEntity));
506
507 this.ViewMode = ViewModeType.Add;
508
509 TEntity newEntity = new TEntity();
510
511 this.FillDefaultValues();
512
513 this.ResetDataModel(newEntity);
514 }
515
516 #endregion
517
518 #region · Edit ·
519
520 protected virtual bool CanEdit()
521 {
522 return (this.ViewMode == ViewModeType.ViewOnly &&
523 this.OriginalEntity == this.Entity);
524 }
525
526 protected virtual void OnEdit()
527 {
528 Logger.Debug("Edit '{0}", this.Entity.ToString());
529
530 this.ViewMode = ViewModeType.Edit;
531 }
532
533 #endregion
534
535 #region · Delete ·
536
537 protected virtual bool CanDelete()
538 {
539 return (this.ViewMode == ViewModeType.ViewOnly &&
540 this.OriginalEntity == this.Entity);
541 }
542
543 protected void OnDelete()
544 {
545 this.ViewMode = ViewModeType.Busy;
546
547 Task task = Task.Factory.StartNew
548 (
549 () =>
550 {
551 Logger.Debug("Delete '{0}", this.Entity.ToString());
552
553 this.OnDeleteAction();
554 }
555 );
556
557 task.ContinueWith
558 (
559 _ =>
560 {
561 Logger.Debug("Delete successful '{0}'", this.Entity.ToString());
562
563 this.OnDeleteActionComplete();
564 },
565 CancellationToken.None,
566 TaskContinuationOptions.OnlyOnRanToCompletion | TaskContinuationOptions.AttachedToParent,
567 TaskScheduler.FromCurrentSynchronizationContext()
568 );
569
570 task.ContinueWith
571 (
572 (t) =>
573 {
574 Logger.Debug("Error at delete '{0}'", t.Exception.ToString());
575
576 this.OnDeleteActionFailed(ViewModeType.ViewOnly);
577
578 Exception exception = null;
579
580 if (t.Exception.InnerException != null)
581 {
582 exception = t.Exception.InnerException;
583 }
584 else
585 {
586 exception = t.Exception;
587 }
588
589 this.NotificationMessage = exception.Message;
590 },
591 CancellationToken.None,
592 TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.AttachedToParent,
593 TaskScheduler.FromCurrentSynchronizationContext()
594 );
595 }
596
597 protected virtual void OnDeleteAction()
598 {
599 }
600
601 protected virtual void OnDeleteActionComplete()
602 {
603 this.ResetDataModel();
604
605 this.ViewMode = ViewModeType.ViewOnly;
606 }
607
608 protected virtual void OnDeleteActionFailed(ViewModeType previousViewMode)
609 {
610 this.ViewMode = previousViewMode;
611 }
612
613 #endregion
614
615 #region · Save ·
616
617 protected virtual bool CanSave()
618 {
619 return ((this.ViewMode == ViewModeType.Add ||
620 this.ViewMode == ViewModeType.Edit) &&
621 this.IsValid && this.HasChanges);
622 }
623
624 protected void OnSave()
625 {
626 ViewModeType previousViewMode = this.ViewMode;
627
628 this.ViewMode = ViewModeType.Busy;
629 this.StatusMessage = "Saving changes, please wait ...";
630
631 Task task = Task.Factory.StartNew
632 (
633 () =>
634 {
635 Logger.Debug("Save changes '{0}'", this.Entity);
636
637 if (this.Entity != null && this.HasChanges)
638 {
639 this.OnSaveAction();
640 }
641 }
642 );
643
644 task.ContinueWith
645 (
646 _ =>
647 {
648 Logger.Debug("Save changes successful '{0}'", this.Entity);
649
650 this.OnSaveActionComplete();
651 },
652 CancellationToken.None,
653 TaskContinuationOptions.OnlyOnRanToCompletion | TaskContinuationOptions.AttachedToParent,
654 TaskScheduler.FromCurrentSynchronizationContext()
655 );
656
657 task.ContinueWith
658 (
659 (t) =>
660 {
661 Logger.Debug("Error at save changes '{0}'", t.Exception.ToString());
662
663 this.OnSaveActionFailed(previousViewMode);
664
665 Exception exception = null;
666
667 if (t.Exception.InnerException != null)
668 {
669 exception = t.Exception.InnerException;
670 }
671 else
672 {
673 exception = t.Exception;
674 }
675
676 this.NotificationMessage = exception.Message;
677 },
678 CancellationToken.None,
679 TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.AttachedToParent,
680 TaskScheduler.FromCurrentSynchronizationContext()
681 );
682 }
683
684 protected virtual void OnSaveAction()
685 {
686 }
687
688 protected virtual void OnSaveActionComplete()
689 {
690 this.ResetDataModel();
691
692 this.ViewMode = ViewModeType.ViewOnly;
693 }
694
695 protected virtual void OnSaveActionFailed(ViewModeType previousViewMode)
696 {
697 this.ViewMode = previousViewMode;
698 }
699
700 #endregion
701
702 #region · Discard ·
703
704 protected virtual bool CanDiscard()
705 {
706 return (this.ViewMode == ViewModeType.Add ||
707 this.ViewMode == ViewModeType.Edit);
708 }
709
710 protected virtual void OnDiscard()
711 {
712 this.ViewMode = ViewModeType.Busy;
713
714 this.ResetDataModel();
715
716 this.ViewMode = ViewModeType.ViewOnly;
717 }
718
719 #endregion
720
721 #region · Inquiry ·
722
723 protected override void OnInquiryActionComplete(InquiryActionResult<TEntity> result)
724 {
725 switch (result.Result)
726 {
727 case InquiryActionResultType.RequestedNew:
728 this.OnAddNew();
729 break;
730
731 default:
732 base.OnInquiryActionComplete(result);
733 break;
734 }
735 }
736
737 #endregion
738
739 #region · Print ·
740
741 protected virtual bool CanPrint()
742 {
743 return false;
744 }
745
746 protected void OnPrint()
747 {
748 this.ViewMode = ViewModeType.Busy;
749
750 Task.Factory.StartNew(
751 () =>
752 {
753 Task task = Task.Factory.StartNew
754 (
755 () =>
756 {
757 this.OnPrintAction();
758 }
759 );
760
761 task.ContinueWith(
762 (t) =>
763 {
764 Logger.Debug("Error al imprimir '{0}'", this.NavigationRoute);
765
766 this.Invoke(
767 () =>
768 {
769 this.OnPrintActionFailed();
770
771 Exception exception = null;
772
773 if (t.Exception.InnerException != null)
774 {
775 exception = t.Exception.InnerException;
776 }
777 else
778 {
779 exception = t.Exception;
780 }
781
782 this.NotificationMessage = exception.Message;
783 });
784 }, TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.AttachedToParent);
785
786 task.ContinueWith(
787 _ =>
788 {
789 Logger.Debug("Impresion finalizada correctamente '{0}'", this.NavigationRoute);
790
791 this.Invoke(
792 () =>
793 {
794 this.StatusMessage = null;
795 this.OnPrintActionComplete();
796 });
797 }, TaskContinuationOptions.OnlyOnRanToCompletion | TaskContinuationOptions.AttachedToParent);
798 });
799 }
800
801 protected virtual void OnPrintAction()
802 {
803 }
804
805 protected virtual void OnPrintActionComplete()
806 {
807 this.ViewMode = ViewModeType.ViewOnly;
808 }
809
810 protected virtual void OnPrintActionFailed()
811 {
812 this.ViewMode = ViewModeType.ViewOnly;
813 }
814
815 #endregion
816
817 #region · Print Preview ·
818
819 protected virtual bool CanPrintPreview()
820 {
821 return false;
822 }
823
824 protected void OnPrintPreview()
825 {
826 this.ViewMode = ViewModeType.Busy;
827
828 Task.Factory.StartNew(
829 () =>
830 {
831 Task task = Task.Factory.StartNew
832 (
833 () =>
834 {
835 this.OnPrintPreviewAction();
836 }
837 );
838
839 task.ContinueWith(
840 (t) =>
841 {
842 Logger.Debug("Error al mostrar la vista previa '{0}'", this.NavigationRoute);
843
844 this.Invoke(
845 () =>
846 {
847 this.OnPrintPreviewActionFailed();
848
849 Exception exception = null;
850
851 if (t.Exception.InnerException != null)
852 {
853 exception = t.Exception.InnerException;
854 }
855 else
856 {
857 exception = t.Exception;
858 }
859
860 this.NotificationMessage = exception.Message;
861 });
862 }, TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.AttachedToParent);
863
864 task.ContinueWith(
865 _ =>
866 {
867 Logger.Debug("Impresion finalizada correctamente '{0}'", this.NavigationRoute);
868
869 this.Invoke(
870 () =>
871 {
872 this.StatusMessage = null;
873 this.OnPrintPreviewActionComplete();
874 });
875 }, TaskContinuationOptions.OnlyOnRanToCompletion | TaskContinuationOptions.AttachedToParent);
876 });
877 }
878
879 protected virtual void OnPrintPreviewAction()
880 {
881 }
882
883 protected virtual void OnPrintPreviewActionComplete()
884 {
885 this.ViewMode = ViewModeType.ViewOnly;
886 }
887
888 protected virtual void OnPrintPreviewActionFailed()
889 {
890 this.ViewMode = ViewModeType.ViewOnly;
891 }
892
893 #endregion
894
895 #region · Bookmark Current Command ·
896
897 protected virtual bool CanBookmarkCurrent()
898 {
899 return this.ViewMode == ViewModeType.ViewOnly &&
900 (this.OriginalEntity != null && this.OriginalEntity == this.Entity);
901 }
902
903 protected virtual void OnBookmarkCurrent()
904 {
905 }
906
907 #endregion
908
909 #region · Clear Bookmarks Command ·
910
911 protected virtual bool CanClearBookmarks()
912 {
913 return this.ViewMode == ViewModeType.ViewOnly;
914 }
915
916 protected virtual void OnClearBookmarks()
917 {
918 }
919
920 #endregion
921
922 #region · Organize Bookmarks Command ·
923
924 protected virtual bool CanOrganizeBookmarks()
925 {
926 return this.ViewMode == ViewModeType.ViewOnly;
927 }
928
929 protected virtual void OnOrganizeBookmarks()
930 {
931 }
932
933 #endregion
934
935 #region · Create Shortcut Command ·
936
937 protected virtual bool CanCreateShortcut()
938 {
939 return !String.IsNullOrEmpty(this.NavigationRoute);
940 }
941
942 protected virtual void OnCreateShortcut()
943 {
944 this.GetService<IVirtualDesktopManager>().CreateShortcut<InternalShortcutViewModel>(this.Title, this.NavigationRoute);
945 }
946
947 #endregion
948
949 #region · Show Form Help Command ·
950
951 private bool CanShowFormHelp()
952 {
953 return false;
954 }
955
956 private void OnShowFormHelp()
957 {
958 }
959
960 #endregion
961
962 #region · Show Zoom Window Command ·
963
964 private bool CanShowZoomWindow()
965 {
966 return true;
967 }
968
969 private void OnShowZoomWindow()
970 {
971 this.ShowZoomWindow = !this.ShowZoomWindow;
972 }
973
974 #endregion
975
976 #endregion
977
978 #region · Overriden Methods ·
979
980 /// <summary>
981 /// Called when the related view is being closed.
982 /// </summary>
983 public override void Close()
984 {
985 Logger.Debug("Cerrar ventana '{0}'", this.GetType());
986
987 this.addNewCommand = null;
988 this.editCommand = null;
989 this.deleteCommand = null;
990 this.saveCommand = null;
991 this.discardCommand = null;
992 this.printCommand = null;
993 this.printPreviewCommand = null;
994 this.createShortcutCommand = null;
995 this.bookmarkCurrentCommand = null;
996 this.clearBookmarksCommand = null;
997 this.organizeBookmarksCommand = null;
998 this.showFormHelpCommand = null;
999 this.showZoomWindowCommand = null;
1000 this.hasBookMarks = false;
1001 this.showZoomWindow = false;
1002 this.zoomLevel = 0;
1003
1004 base.Close();
1005 }
1006
1007 #endregion
1008
1009 #region · Protected Methods ·
1010
1011 protected virtual void FillDefaultValues()
1012 {
1013 }
1014
1015 protected override void UpdateAllowedUserActions()
1016 {
1017 this.Invoke
1018 (
1019 () =>
1020 {
1021 this.AddNewCommand.RequeryCanExecute();
1022 this.EditCommand.RequeryCanExecute();
1023 this.DeleteCommand.RequeryCanExecute();
1024 this.SaveCommand.RequeryCanExecute();
1025 this.DiscardCommand.RequeryCanExecute();
1026 this.InquiryCommand.RequeryCanExecute();
1027 this.NewWindowCommand.RequeryCanExecute();
1028 this.CreateShortcutCommand.RequeryCanExecute();
1029 this.BookmarkCurrentCommand.RequeryCanExecute();
1030 this.ClearBookmarksCommand.RequeryCanExecute();
1031 this.OrganizeBookmarksCommand.RequeryCanExecute();
1032 this.PrintCommand.RequeryCanExecute();
1033 this.PrintPreviewCommand.RequeryCanExecute();
1034 this.ShowFormHelpCommand.RequeryCanExecute();
1035 this.ShowZoomWindowCommand.RequeryCanExecute();
1036 }
1037 );
1038 }
1039
1040 #endregion
1041 }
1042 }