• 大小: 7.41MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-25
  • 语言: C#
  • 标签: WinForm    MVC  示例项目  

资源简介

VS 环境下 WinForm 的 MVC 示例项目,它和 Web 下的 MVC 用法基本一样

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace CommonLibrary.Exceptions
{
    public class LogException : Exception
    {
        private string GetStackTrack()
        {
            StackTrace st = new StackTrace(true);
            string stackIndent = string.Empty;
            for (int i = 0; i < st.frameCount; i++)
            {
                // Note that at this level there are four 
                // stack frames one for each method invocation.
                Stackframe sf = st.Getframe(i);

                stackIndent += String.Format(“ Method: {0}“ sf.GetMethod());

                stackIndent += String.Format(“ File: {0}“ sf.GetFileName());

                stackIndent += String.Format(“ Line Number: {0}“ sf.GetFileLineNumber());

                stackIndent += “\r\n“;
            }

            return stackIndent;
        }

        public LogException(string error)
            : base(error)
        {
            string fileDir = “C:\\SaleLog“;

            if (System.IO.Directory.Exists(fileDir) == false)
            {
                System.IO.Directory.CreateDirectory(fileDir);
            }

            fileDir += “\\LogException“;
            
            if (System.IO.Directory.Exists(fileDir) == false)
            {
                System.IO.Directory.CreateDirectory(fileDir);
            }

            DateTime now = DateTime.Now;

            string filePath = String.Format(“{0}-{1}-{2}_{3}-{4}-{5}-{6}.txt“ now.Year now.Month now.Day now.Hour now.Minute now.Second now.Millisecond);

            filePath = fileDir + “\\“ + filePath;

            string text = error;
            text += “\r\n“;
            text += “----------------------------------------------------------------------------------“;
            text += “\r\n“;
            text += this.GetStackTrack();

            System.IO.File.AppendAllText(filePath text);
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      52736  2017-10-14 08:20  WinformMvcDemo\CommonLibrary\bin\Debug\CommonLibrary.dll

     文件       1086  2015-04-08 09:37  WinformMvcDemo\CommonLibrary\bin\Debug\CommonLibrary.dll.config

     文件     153088  2017-10-14 08:20  WinformMvcDemo\CommonLibrary\bin\Debug\CommonLibrary.pdb

     文件    1748992  2014-04-10 13:31  WinformMvcDemo\CommonLibrary\bin\Debug\eBay.Service.dll

     文件      73728  2014-04-10 13:31  WinformMvcDemo\CommonLibrary\bin\Debug\eBay.Service.SDK.Attribute.dll

     文件      34816  2014-02-23 09:21  WinformMvcDemo\CommonLibrary\bin\Debug\EFCachingProvider.dll

     文件      26624  2014-02-23 09:21  WinformMvcDemo\CommonLibrary\bin\Debug\EFProviderWrapperToolkit.dll

     文件      15872  2014-02-23 09:21  WinformMvcDemo\CommonLibrary\bin\Debug\EFTracingProvider.dll

     文件      29696  2017-09-27 11:24  WinformMvcDemo\CommonLibrary\bin\Debug\HelperUDP.dll

     文件     101888  2017-09-27 11:24  WinformMvcDemo\CommonLibrary\bin\Debug\HelperUDP.pdb

     文件      49152  2014-04-10 13:33  WinformMvcDemo\CommonLibrary\bin\Debug\Samples.Helper.dll

     文件      47616  2017-10-15 10:31  WinformMvcDemo\CommonLibrary\bin\Release\CommonLibrary.dll

     文件       1086  2015-04-08 09:37  WinformMvcDemo\CommonLibrary\bin\Release\CommonLibrary.dll.config

     文件    1445376  2017-10-15 10:31  WinformMvcDemo\CommonLibrary\bin\Release\CommonLibrary.pdb

     文件    1748992  2014-04-10 13:31  WinformMvcDemo\CommonLibrary\bin\Release\eBay.Service.dll

     文件      73728  2014-04-10 13:31  WinformMvcDemo\CommonLibrary\bin\Release\eBay.Service.SDK.Attribute.dll

     文件      34816  2014-02-23 09:21  WinformMvcDemo\CommonLibrary\bin\Release\EFCachingProvider.dll

     文件      26624  2014-02-23 09:21  WinformMvcDemo\CommonLibrary\bin\Release\EFProviderWrapperToolkit.dll

     文件      15872  2014-02-23 09:21  WinformMvcDemo\CommonLibrary\bin\Release\EFTracingProvider.dll

     文件    1315840  2017-10-11 21:44  WinformMvcDemo\CommonLibrary\bin\Release\Geckofx-Core.dll

     文件    1598976  2017-10-11 21:44  WinformMvcDemo\CommonLibrary\bin\Release\Geckofx-Core.pdb

     文件     136704  2017-10-11 21:44  WinformMvcDemo\CommonLibrary\bin\Release\Geckofx-Winforms.dll

     文件     284160  2017-10-11 21:44  WinformMvcDemo\CommonLibrary\bin\Release\Geckofx-Winforms.pdb

     文件      27136  2017-09-27 10:27  WinformMvcDemo\CommonLibrary\bin\Release\HelperUDP.dll

     文件     103936  2017-09-27 10:27  WinformMvcDemo\CommonLibrary\bin\Release\HelperUDP.pdb

     文件      49152  2014-04-10 13:33  WinformMvcDemo\CommonLibrary\bin\Release\Samples.Helper.dll

     文件       6539  2017-10-13 16:30  WinformMvcDemo\CommonLibrary\CommonLibrary.csproj

     文件       2049  2014-04-28 17:32  WinformMvcDemo\CommonLibrary\Exceptions\LogException.cs

     文件        781  2015-08-31 14:14  WinformMvcDemo\CommonLibrary\Exceptions\MessageException.cs

     文件        194  2014-05-15 08:36  WinformMvcDemo\CommonLibrary\Exceptions\NonException.cs

............此处省略311个文件信息

评论

共有 条评论