コード例 #1
0
        private string GetAvatorFromServer(string fileName)
        {
            try
            {
                string requestUri   = string.Format(@"{0}?name={1}", serverUrl, fileName);
                string fileFullPath = string.Format(@"{0}\{1}", ApplicationEnvironment.LocalImageCachePath, fileName);

                WebClient webClient = new WebClient();
                webClient.DownloadFile(requestUri, fileFullPath);

                return(fileFullPath);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                return(FilePathHelper.BuildPath(string.Format(@".\{0}", DefaultAvatorFileName)));;
            }
        }
コード例 #2
0
ファイル: LoginForm.cs プロジェクト: bigbigwood/daan
        private void ShowAutoUpdateForm(string url)
        {
            string fileName = url.Substring(url.LastIndexOf('/') + 1);

            var result = MessageBox.Show(ConstString.IsUpgradeNewVersion, ConstString.IsUpgradeNewVersion, MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                string appPath = FilePathHelper.BuildPath(@".\daan.ui.PrintingApplication.Update.exe");
                var    process = new ProcessStartInfo();
                process.FileName  = appPath;
                process.Arguments = string.Format(@"-n {0} -u {1}", fileName, url);
                Process.Start(process);

                Application.Exit();
            }
            else
            {
                ShowMessage(ConstString.DetectNewVersionNotification, MessageType.Warning);
                ControlButtons(true);
            }
        }