1 //----------------------------------------------------------------
2 // <copyright company="Microsoft Corporation">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 //----------------------------------------------------------------
7 namespace System.Activities.Presentation.View
11 internal class VersionEditorViewModel : ViewModel
13 private IVersionEditor editor;
14 private Version version;
16 public VersionEditorViewModel(IVersionEditor editor)
18 Fx.Assert(editor != null, "editor should not be null");
22 public string VersionText
26 if (this.version == null)
31 return this.version.ToString();
36 if (this.VersionText != value)
38 if (string.IsNullOrEmpty(value))
44 Exception exception = null;
48 this.Version = Version.Parse(value);
50 catch (ArgumentOutOfRangeException ex)
54 catch (ArgumentException ex)
58 catch (FormatException ex)
62 catch (OverflowException ex)
67 if (exception != null)
69 this.editor.ShowErrorMessage(exception.Message);
71 // update UI to its old value
72 this.NotifyPropertyChanged("VersionText");
78 public Version Version
87 if (this.version != value)
90 this.NotifyPropertyChanged("Version");
91 this.NotifyPropertyChanged("VersionText");