07 2016 档案

摘要:应用不只是包含textboxs和labels,还包含actions,如按钮和鼠标事件等。接下来我们加上一些像按钮这样的UI元素来看MVVM类怎么演变的。与之前的UI相比,这次我们加上一个"Cal Tax"按钮,当我们点击这个依赖于“sales amount”的按钮时,它会计算税费并显示在同窗口内。 阅读全文
posted @ 2016-07-28 23:24 AshLeakey 阅读(635) 评论(0) 推荐(0) 编辑
摘要:Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negative integers be palindromes? (ie, -1) If you are thi 阅读全文
posted @ 2016-07-28 01:19 AshLeakey 阅读(153) 评论(0) 推荐(0) 编辑
摘要:Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below 阅读全文
posted @ 2016-07-28 01:17 AshLeakey 阅读(156) 评论(0) 推荐(0) 编辑
摘要:Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 Difficulty: Easy My submission 1 rt:64ms My submission 2 rt 阅读全文
posted @ 2016-07-28 01:14 AshLeakey 阅读(115) 评论(0) 推荐(0) 编辑
摘要:之前的改进已经挺棒的,但是我们现在知道了后台代码的问题,那是否可能把后台代码全部去除呢?这时候就该WPF binding 和 commands 来做的事情了。 WPF就是以超吊的binding,commans和声明式编程而闻名的。声明式编程意思就是相比于全部用C#代码来写,我们也可以用XAML来表示 阅读全文
posted @ 2016-07-28 00:59 AshLeakey 阅读(462) 评论(0) 推荐(0) 编辑
摘要:我觉得大部分开发者应该已经知道怎么去解决这个问题。一般都是把后台代码(GLUE code)移动到一个类库。这个类库用来代表UI的属性和行为。任何代码当被移到一个类库中时都可以被编译成一个DLL,然后可以在任何类型的.net项目中去引用它。所以接下来我们来创建一个非常简单的MVVM的例子在之后我们会升 阅读全文
posted @ 2016-07-28 00:20 AshLeakey 阅读(485) 评论(0) 推荐(0) 编辑
摘要:首先要做的事情就是定义一个popup来显示我们需要展示的东西 这里使用的是用一个Listbox来做演示,也可以使用其他的控件或者改listbox的template。popup的staysopen代表失去焦点后还显不显示。listbox绑定到一个ObservableCollection来实时改变。 后 阅读全文
posted @ 2016-07-26 11:03 AshLeakey 阅读(873) 评论(0) 推荐(1) 编辑
摘要:很多时候我们都希望通过水印来告诉用户这里该填什么样格式的数据,那么我们就希望有这样的一个控件。 为了方便起见,先定义一个依赖属性专门来存放水印中显示的字符串。 在引用中引用当前的命名空间 引入转换器 现在的预想是当用户输入字符时水印消失,字串为空时水印出现,可以用事件来做,但是显然不太合适,因此我们 阅读全文
posted @ 2016-07-26 10:36 AshLeakey 阅读(1283) 评论(0) 推荐(0) 编辑
摘要:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font 阅读全文
posted @ 2016-07-25 18:02 AshLeakey 阅读(160) 评论(0) 推荐(0) 编辑
摘要:Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longes 阅读全文
posted @ 2016-07-25 16:12 AshLeakey 阅读(124) 评论(0) 推荐(0) 编辑
摘要:命名管道是一种从一个进程到另一个进程用内核对象来进行信息传输。和一般的管道不同,命名管道可以被不同进程以不同的方式方法调用(可以跨权限、跨语言、跨平台)。只要程序知道命名管道的名字,发送到命名管道里的信息可以被一切拥有指定授权的程序读取,但对不具有制定授权的。命名管道是一种FIFO(先进先出,Fir 阅读全文
posted @ 2016-07-01 17:00 AshLeakey 阅读(6079) 评论(0) 推荐(0) 编辑
摘要:利用匿名属性可以用很简洁的语法来自动声明不可变(immutable)的元组(tuple)类型。 属性:在字段用来表示类型和对象的状态的前提下,希望状态不被随意的更改,字段一般应该设置为private,这也符合面向对象编程的数据封装,而可以通过方法来更改字段的值,这时候属性的出现简化了这些语法。 编译 阅读全文
posted @ 2016-07-01 12:00 AshLeakey 阅读(683) 评论(0) 推荐(0) 编辑