2015年2月12日——不懂点
- CNBLOG项目不懂知识点:
1. local:[...]的写法 + 这样声明可使用。
1 xmlns:local="using:CNBlogs" 2 xmlns:ControlHelper="using:CNBlogs.ControlHelper"
2. 书写格式上 - 把所有的繁杂的 style + template 等等都放到了具体类似于 .css 这样的文件中。[在这里是 xaml文件]
3. 日志的编写也提供了工具类,并非工具类,而是 dll 类库 - LogAgent - [Logger.LogAgent.GetInstance().WriteLog(this.GetType().ToString());]
4. 日志 dll 类库的编写 - 反编译看了,还是有点迷糊。
5. 具有 NavigationHelper - 负责每个页面的主题、返回键的重写、
6. 具有 SuspensionManager 类 - 这个类负责当前页面是否已访问过,若访问过则不重新加载[每次加载都需要访问WEBAPI来获取信息并加载] ,在这个类里面涉及到了哪些?
7. - 接上 - 1. 涉及到弱类型。 2. 依赖属性、依赖项。[这个是什么?INotifyPropertyChanged的另一个版本。] .RegisterAttached() 方法参数的意思:变量名 + 变量类型 + 该变量所在类名称
1 private static DependencyProperty FrameSessionStateKeyProperty = 2 DependencyProperty.RegisterAttached("_FrameSessionStateKey", typeof(String), typeof(SuspensionManager), null); 3 private static DependencyProperty FrameSessionBaseKeyProperty = 4 DependencyProperty.RegisterAttached("_FrameSessionBaseKeyParams", typeof(String), typeof(SuspensionManager), null); 5 private static DependencyProperty FrameSessionStateProperty = 6 DependencyProperty.RegisterAttached("_FrameSessionState", typeof(Dictionary<String, Object>), typeof(SuspensionManager), null); 7 private static List<WeakReference<Frame>> _registeredFrames = new List<WeakReference<Frame>>();
8. 关于 Binding 的介绍 - 我现在在WPF中对 TextBox 进行Binding 根本不好使。 - Text = "{Binding [PropertyName]}" - 这个根本不好使。
9. 关于Binding的介绍网址 - http://blog.csdn.net/fwj380891124/article/details/8107646
10. 关于 DependencyProperty 的介绍 - http://www.cnblogs.com/HelloMyWorld/archive/2013/02/21/2920149.html 介绍2
11. DependencyProperty 的用法 - 声明 + 赋值 + 获取值。
12. Frame 页面的跳转记录等,都记录了下来。在 SuspensionManager 类中。每个页面[Frame]都记录当前必须的记录属性,来记录该页面是否访问过,而这个都是存在页面本身的依赖属性中。获取 + 创建都是在本类中进行的。判断结果的返回值也是本类中进行输出。[好好看下当前工具类所提供的方法,有恢复访问页面方法 - 我之前都是重新实例化页面,除非记录到缓存中。Frame实体对象具有 SetNacigationState 方法来实现]
13. - 上述 - 如何实现? - 1. 每个页面都保存到缓存中吗? - [是根据Frame实体对象所提供的还原方法来实现] 推荐书籍 - 《你必须知道的.NET之特性和属性》 2. 所有ViewModel类的基础 - DataModelBase 类 [继承INotifyPropertyChanged接口] 3. 当前应用程序的各种参数都保存在 Settings 类中 [比如背景等,这些数据如何存储呢? - 通过 ApplicationDataContainer 来存储] 4.
14. 单例模式 - 单例模式有很多,饿汉式 + 懒汉式 + 饱汉式 - 也有一下这种:
1 private static volatile CNBlogSettings _instance; 2 private static object _locker = new object(); 3 4 private CNBlogSettings() { } 5 6 public static CNBlogSettings Instance 7 { 8 get 9 { 10 if (_instance == null) 11 { 12 lock (_locker) 13 { 14 if (_instance == null) 15 { 16 _instance = new CNBlogSettings(); 17 } 18 } 19 } 20 return _instance; 21 } 22 }
15. 又一个新问题 - volatile关键词,到底是什么时候用的。
16. 创建了 ApplicationSettings类、NavigationHelper类,
17. 这些文件夹以及代码的分门别类是怎么定义的? -