예제 #1
0
 public static void OnCheckingResult(CadLoaderModel model)
 {
     CurrentLogin = model;
     if (CheckingResult != null)
     {
         CheckingResult(model);
     }
 }
예제 #2
0
 static void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.Result))
     {
         CadLoaderModel model = e.Result.ParseXml <CadLoaderModel>();
         OnCheckingResult(model);
     }
     else
     {
         CadLoaderModel model = new CadLoaderModel {
             Success = false
         };
         OnCheckingResult(model);
     }
 }
예제 #3
0
 void LoginManager_CheckingResult(CadLoaderModel model)
 {
     if (model.Success)
     {
         int    id    = model.ProductID;
         string file  = FileManager.Loader.Replace(".dll", "") + ".cfg";
         var    lines = System.IO.File.ReadAllLines(FileManager.CurrentFolder + file);
         lines[1] = "ID=" + id;
         System.IO.File.WriteAllLines(FileManager.CurrentFolder + file, lines);
         MessageBox.Show(string.Format("登录成功,有效期至 {0}。", model.Expire.ToShortDateString()), "提示");
         this.Close();
     }
     else
     {
         MessageBox.Show("登录失败。可能的原因:\n1. 用户不存在\n2. 密码错误\n3. 账号已过期", "提示");
     }
 }