示例#1
0
 static void Main(string[] args)
 {
     //MessageBox.Show(string.Join("|", args));
     //args = new string[] { "http://xssy.furongedu.com/AutoUpdate.ashx", "false" };
     if (args != null && args.Length > 0)
     {
         try
         {
             using (AutoUpdateClient client = new AutoUpdateClient(args[0]))
             {
                 if (client.CheckforUpdates())
                 {
                     Application.EnableVisualStyles();
                     Application.SetCompatibleTextRenderingDefault(false);
                     Application.Run(new MainForm(client));
                 }
                 bool show = false;
                 if (args.Length > 1 && bool.TryParse(args[1], out show))
                 {
                     if (show)
                     {
                         MessageBox.Show("已经是最新的啦~!", "自动更新", MessageBoxButtons.OK);
                     }
                 }
             }
         }
         catch (Exception x)
         {
             MessageBox.Show(x.Message, "自动更新程序发生致命异常:", MessageBoxButtons.OK);
         }
     }
 }
示例#2
0
 /// <summary>
 /// 构造函数。
 /// </summary>
 public MainForm(AutoUpdateClient client)
 {
     this.client = client;
     InitializeComponent();
 }