bovender framework
C# framework that implements MVVM and more
UserSettingsExceptionViewModel.cs
1 /* UserSettingsExceptionViewModel.cs
2  * part of Bovender framework
3  *
4  * Copyright 2014-2018 Daniel Kraus
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 using System;
19 using System.Collections.Generic;
20 using System.Linq;
21 using System.Text;
22 using Bovender.Mvvm;
24 
25 namespace Bovender.UserSettings
26 {
31  {
32  #region Public properties
33 
34  public UserSettingsBase UserSettings { get; set; }
35 
36  public Exception Exception
37  {
38  get
39  {
40  if (UserSettings != null)
41  {
42  return UserSettings.Exception;
43  }
44  else
45  {
46  return null;
47  }
48  }
49  }
50 
51  public string Message
52  {
53  get
54  {
55  Exception e = Exception;
56  if (e != null)
57  {
58  return e.Message;
59  }
60  else
61  {
62  return String.Empty;
63  }
64  }
65  }
66 
67  public string InnerMessage
68  {
69  get
70  {
71  Exception e = Exception;
72  if (e != null && e.InnerException != null)
73  {
74  return e.InnerException.Message;
75  }
76  else
77  {
78  return String.Empty;
79  }
80  }
81  }
82 
83  #endregion
84 
85  #region Constructors
86 
88  : base()
89  { }
90 
92  : this()
93  {
94  UserSettings = userSettings;
95  }
96 
97  #endregion
98 
99  #region Commands
100 
101  #endregion
102 
103  #region Implementation of ViewModelBase
104 
108  public override object RevealModelObject()
109  {
110  return Exception;
111  }
112 
113  #endregion
114 
115  #region Private fields
116 
117  #endregion
118  }
119 }
override object RevealModelObject()
Returns the exception, if any.
Base class for persistent settings; a replacement for the UserSettings.UserSettingsBase system which ...
General view model for user settings-related exceptions.
Exception Exception
Gets the last IOException, if any occurred.