コード例 #1
0
        public MainForm()
        {
            InitializeComponent();
            rootUpdatePath = Application.StartupPath + "\\UpdateData\\";
            if (!Directory.Exists(rootUpdatePath))
            {
                Directory.CreateDirectory(rootUpdatePath);
            }
            ConfigClass config = new ConfigClass();

            config.SetConfigName(@"\Alading.exe.config");
            string currentVersionCode = config.ReadConfig("CurrentVersion");
            string versionType        = config.ReadConfig("VersionType");

            Alading.WebService.Version version = ServiceHelper.GetNewVersion(versionType);
            if (version != null && version.VersionCode != currentVersionCode)
            {
                List <FileUpdate> list = ServiceHelper.GetFileUpdateList(version.VersionCode);
                this.fileUpdateList = list;
                this.version        = version;
            }
            else
            {
                this.fileUpdateList = new List <FileUpdate>();
                this.version        = new Alading.WebService.Version();
            }
        }
コード例 #2
0
ファイル: LoginWait.cs プロジェクト: treesan/taobao-alading
        public LoginWait()
        {
            InitializeComponent();
            //取最新的版本,与当前的版本号
            ConfigHelper config = new ConfigHelper();

            config.SetConfigName(@"\Alading.exe.config");
            string currentVersionCode = config.ReadConfig("CurrentVersion");
            string versionType        = config.ReadConfig("VersionType");

            Alading.WebService.Version version = ServiceHelper.GetNewVersion(versionType);
            if (version != null && version.VersionCode != null && version.VersionCode != currentVersionCode)
            {
                DialogResult result = XtraMessageBox.Show("检测到阿拉丁有最新版本,是否现在更新?", Constants.SYSTEM_PROMPT, MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                if (result == DialogResult.OK)
                {
                    string updatePath = Application.StartupPath + "\\Alading.Updater.exe";
                    if (File.Exists(updatePath))
                    {
                        Process.Start(updatePath);
                    }
                }
            }
            waitTimer          = new Timer();
            waitTimer.Interval = 600000;
            waitTimer.Tick    += new EventHandler(waitTimer_Tick);

            backWorker = new BackgroundWorker {
                WorkerReportsProgress = true, WorkerSupportsCancellation = false
            };
            backWorker.DoWork             += new DoWorkEventHandler(backWorker_DoWork);
            backWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backWorker_RunWorkerCompleted);
            backWorker.ProgressChanged    += new ProgressChangedEventHandler(backWorker_ProgressChanged);

            LocalUserList = new List <Alading.Entity.User>();
            LocalShopList = new List <Alading.Entity.Shop>();
            NetShopList   = new List <Shop>();
            NetUserList   = new List <User>();
            mainUser      = new Alading.Entity.User();
        }