zoukankan      html  css  js  c++  java
  • 试试Live Writer的代码插件

    插入代码VS2010

    http://my.oschina.net/nnhy/blog/11369

    修正从vs2010复制代码时中文乱码的问题。好消息:VS2010 SP1已经没有这个问题了。

    private void Application_UnhandledException(objectsender, ApplicationUnhandledExceptionEventArgse)
            {
               
    // 如果应用程序是在调试器外运行的,则使用浏览器的
                // 异常机制报告该异常。在 IE 上,将在状态栏中用一个
                // 黄色警报图标来显示该异常,而 Firefox 则会显示一个脚本错误。
               
    if(!System.Diagnostics.Debugger.IsAttached)
                {

                   
    // 注意: 这使应用程序可以在已引发异常但尚未处理该异常的情况下
                    // 继续运行。
                    // 对于生产应用程序,此错误处理应替换为向网站报告错误
                    // 并停止应用程序。
                   
    e.Handled= true;
                    Deployment.Current.Dispatcher.BeginInvoke(delegate{ ReportErrorToDOM(e); });
                }
            }


    插入代码块
    private void btnAbout_Click(object sender, RoutedEventArgs e)
            {
                //MessageBox.Show("欢迎进入SilverLight世界!");
                mSvClient.HelloWorldAsync();
                Type tp = Type.GetType("System.Nullable`1[System.DateTime]");
                //==================================================================            
                List<ClassHelper.CustPropertyInfo> lstCustPropertyInfo = new List<ClassHelper.CustPropertyInfo>();
                lstCustPropertyInfo.Add(new ClassHelper.CustPropertyInfo("System.Int32", "xx"));
                lstCustPropertyInfo.Add(new ClassHelper.CustPropertyInfo("System.String", "sname"));
                lstCustPropertyInfo.Add(new ClassHelper.CustPropertyInfo("System.Nullable`1[System.DateTime]", "intime"));            
                dataGrid1.ItemsSource = lp;
            }

    这里有一个小小的问题:如果不选择“折叠代码”,那么代码块就没有灰色的背景了。解决办法很简单,
    把展开视图代码模版改为:
    <div class="cnblogs_code"><pre><%hcode%></pre></div><br>
    其实就是在最外面那个div里加上css class,这样代码块有灰色的背景和自适应的滚动条。
    Insert Code(英文版)
       1:  private void btnAbout_Click(object sender, RoutedEventArgs e)
       2:          {
       3:              //MessageBox.Show("欢迎进入SilverLight世界!");
       4:   
       5:              mSvClient.HelloWorldAsync();
       6:              Type tp = Type.GetType("System.Nullable`1[System.DateTime]");
       7:              //==================================================================            
       8:              List<ClassHelper.CustPropertyInfo> lstCustPropertyInfo = new List<ClassHelper.CustPropertyInfo>();
       9:              lstCustPropertyInfo.Add(new ClassHelper.CustPropertyInfo("System.Int32", "xx"));
      10:              lstCustPropertyInfo.Add(new ClassHelper.CustPropertyInfo("System.String", "sname"));
      11:              lstCustPropertyInfo.Add(new ClassHelper.CustPropertyInfo("System.Nullable`1[System.DateTime]", "intime"));
      12:   
      13:              List<object> lp = new List<object>();
      14:              object obx = ClassHelper.CreateInstance(lstCustPropertyInfo);
      15:              ClassHelper.SetPropertyValue(obx, "xx", 789);
      16:              ClassHelper.SetPropertyValue(obx, "sname", "张三");
      17:              ClassHelper.SetPropertyValue(obx, "intime", DateTime.Now);
      18:              lp.Add(obx);
      19:              obx = ClassHelper.CreateInstance(lstCustPropertyInfo);
      20:              ClassHelper.SetPropertyValue(obx, "xx", 987);
      21:              ClassHelper.SetPropertyValue(obx, "sname", "李四");
      22:              ClassHelper.SetPropertyValue(obx, "intime", null);
      23:              lp.Add(obx);
      24:              
      25:              dataGrid1.ItemsSource = lp;
      26:          }
  • 相关阅读:
    Oracle数据库死锁和MySQL死锁构造和比较
    shell单引号中输出参数值
    视频流媒体服务器
    使用syncthing进行双机文件同步
    状态(State)模式--设计模式
    中介者(调停者)模式--设计模式
    链表的中间节点
    删除链表中的倒数第N个节点
    Logos讲解--逆向开发
    MonkeyDev安装--逆向开发
  • 原文地址:https://www.cnblogs.com/edong/p/2133772.html
Copyright © 2011-2022 走看看