예제 #1
0
        public MainFormLogic(MainForm targetForm)
        {
            Constrain.NotNull(targetForm);
            this.targetForm = targetForm;

            // 订阅整个窗体的 Shown 事件和 searchBT 点击事件
            targetForm.Shown += new EventHandler(targetForm_Shown);
            targetForm.searchBT.Click += new EventHandler(searchBT_Click);

            // 订阅窗体中 clearCacheLL 的点击事件
            targetForm.clearCacheLL.Click += new EventHandler(clearCacheLL_Click);

            // 将 BuildCacheFormLogic 类的对象附加到缓存生成窗体上
            BuildCacheFormLogic buildCacheFormLogic = new BuildCacheFormLogic(targetForm.BuildCacheForm);

            // 订阅 BuildCacheForm 窗体的 Shown 和 FormClosed 事件
            // 用于判断用户是否又重新构建了缓存,以便重新加载
            targetForm.BuildCacheForm.Shown += new EventHandler(BuildCacheForm_Shown);
            targetForm.BuildCacheForm.FormClosed += new FormClosedEventHandler(BuildCacheForm_FormClosed);
        }
예제 #2
0
 static void Main()
 {
     try
     {
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         MainForm mf = new MainForm();
         MainFormLogic cl = new MainFormLogic(mf);
         Application.Run(mf);
     }
     catch (System.Exception ex)
     {
         System.Diagnostics.Trace.WriteLine(ex);
         try
         {
             DebugHelper.LogDebugInfo(ex.ToString());
         }
         catch (System.Exception ex2)
         {
             System.Diagnostics.Trace.WriteLine(ex2);
         }
     }
 }