예제 #1
0
        /// <summary>
        /// 設定UI所顯示的資訊
        /// </summary>
        public bool SetInformation()
        {
            if (currentSoftwareID == -1 || http_url == "")
            {
                return(false);
            }

            OrderManagerFunctions omFunc = new OrderManagerFunctions();

            string[] SoftwareNameArray = new string[6] {
                omFunc.GetSoftwareName(_softwareID.EZCAD),
                omFunc.GetSoftwareName(_softwareID.Implant), omFunc.GetSoftwareName(_softwareID.Ortho),
                omFunc.GetSoftwareName(_softwareID.Tray), omFunc.GetSoftwareName(_softwareID.Splint), omFunc.GetSoftwareName(_softwareID.Guide)
            };
            label_TitleBar.Content = TranslationSource.Instance["Install"] + "-" + SoftwareNameArray[currentSoftwareID];
            label_Header.Content   = TranslationSource.Instance["AboutToInstall"] + " " + SoftwareNameArray[currentSoftwareID];
            if (Properties.OrderManagerProps.Default.mostsoftwareDisk != "")
            {
                textbox_InstallPath.Text = Properties.OrderManagerProps.Default.mostsoftwareDisk + @"IntewareInc\" + SoftwareNameArray[currentSoftwareID].Replace(".", " ") + @"\";
            }
            else
            {
                textbox_InstallPath.Text = @"C:\IntewareInc\" + SoftwareNameArray[currentSoftwareID].Replace(".", " ") + @"\";
            }
            jlabel_RequireSpace.Content   += ":";
            jlabel_AvailableSpace.Content += ":";
            try
            {
                if (((HttpWebResponse)httpResponse).StatusDescription == "OK" && httpResponse.ContentLength > 1)
                {
                    // 取得下載的檔名
                    Uri    uri = new Uri(http_url);
                    string downloadfileRealName = Path.GetFileName(uri.LocalPath);
                    label_DownloadFileName.Content = "(" + downloadfileRealName + ")";

                    if (RemainingSpace(textbox_InstallPath.Text) == true)  //客戶電腦剩餘空間
                    {
                        label_RequireSpace.Tag     = Convert.ToUInt64(httpResponse.ContentLength);
                        label_RequireSpace.Content = ConvertDiskUnit(Convert.ToUInt64(httpResponse.ContentLength), (int)_diskUnit.MB);

                        if ((ulong)label_AvailableSpace.Tag < (ulong)label_RequireSpace.Tag)
                        {
                            label_AvailableSpace.Foreground = Brushes.Orange;
                            label_AvailableSpace.ToolTip    = TranslationSource.Instance["NoEnoughSpaceToInstall"];//磁碟空間不足以安裝軟體
                        }
                        else if ((ulong)label_AvailableSpace.Tag < (ulong)label_RequireSpace.Tag * 3)
                        {
                            label_AvailableSpace.Foreground = Brushes.Orange;
                            label_AvailableSpace.ToolTip    = TranslationSource.Instance["SpaceMaynotBeEnough"];//磁碟空間可能不足以安裝軟體
                        }
                        else
                        {
                            label_AvailableSpace.Foreground = Brushes.White;
                            label_AvailableSpace.ToolTip    = TranslationSource.Instance["SpaceAvailable"];
                        }
                    }
                    else
                    {
                        Inteware_Messagebox Msg = new Inteware_Messagebox();
                        Msg.ShowMessage(TranslationSource.Instance["CannnotGetRemainingSpace"]);
                        if (httpResponse != null)
                        {
                            httpResponse.Close();
                        }
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                Inteware_Messagebox Msg = new Inteware_Messagebox();
                Msg.ShowMessage(ex.Message, TranslationSource.Instance["NetworkError"]);    //網路連線異常or載點掛掉
                if (httpResponse != null)
                {
                    httpResponse.Close();
                }
                return(false);
            }
            if (httpResponse != null)
            {
                httpResponse.Close();
            }
            return(true);
        }
예제 #2
0
        public void SetCurrentSoftware(_softwareID SoftwareID)
        {
            DocUrl = "";
            string UrlCADLog    = "https://www.dropbox.com/s/ra9luek6imfh8po/EZCAD%20Release%20Notes.txt?dl=1";
            string UrlImplant   = "https://www.dropbox.com/s/qhw1jcsuzeofkrb/ImplantPlanning%20Release%20Notes.txt?dl=1";
            string UrlGuide     = "https://www.dropbox.com/s/hiaol85rxp7u1ns/EZCAD%20guide%20Release%20Notes.txt?dl=1";
            string UrlOrthoLog  = "https://www.dropbox.com/s/gx9rec4tw4n9fr8/OrthoAnalysis%20Release%20Notes.txt?dl=1";
            string UrlTrayLog   = "https://www.dropbox.com/s/bs7vohkc9nddcj6/EZCAD%20tray%20Release%20Notes.txt?dl=1";
            string UrlSplintLog = "https://www.dropbox.com/s/fmk1h08ov3b9xpt/EZCAD%20splint%20Release%20Notes.txt?dl=1";

            label_loading.Visibility       = Visibility.Visible;
            progressbar_loading.Visibility = Visibility.Visible;

            switch (SoftwareID)
            {
            case _softwareID.EZCAD:
            {
                label_title.Content = omFunc.GetSoftwareName(_softwareID.EZCAD) + " " + TranslationSource.Instance["ReleaseNote"];
                DocUrl = UrlCADLog;
                break;
            }

            case _softwareID.Implant:
            {
                label_title.Content = omFunc.GetSoftwareName(_softwareID.Implant) + " " + TranslationSource.Instance["ReleaseNote"];
                DocUrl = UrlImplant;
                break;
            }

            case _softwareID.Ortho:
            {
                label_title.Content = omFunc.GetSoftwareName(_softwareID.Ortho) + " " + TranslationSource.Instance["ReleaseNote"];
                DocUrl = UrlOrthoLog;
                break;
            }

            case _softwareID.Tray:
            {
                label_title.Content = omFunc.GetSoftwareName(_softwareID.Tray) + " " + TranslationSource.Instance["ReleaseNote"];
                DocUrl = UrlTrayLog;
                break;
            }

            case _softwareID.Splint:
            {
                label_title.Content = omFunc.GetSoftwareName(_softwareID.Splint) + " " + TranslationSource.Instance["ReleaseNote"];
                DocUrl = UrlSplintLog;
                break;
            }

            case _softwareID.Guide:
            {
                label_title.Content = omFunc.GetSoftwareName(_softwareID.Guide) + " " + TranslationSource.Instance["ReleaseNote"];
                DocUrl = UrlGuide;
                break;
            }
            }

            if (DocUrl != "")
            {
                Bgworker                            = new BackgroundWorker();
                Bgworker.DoWork                    += new DoWorkEventHandler(DoWork_Download);
                Bgworker.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(CompletedWork_Download);
                Bgworker.WorkerReportsProgress      = false;
                Bgworker.WorkerSupportsCancellation = false;
                Bgworker.RunWorkerAsync();
            }
        }