프로젝트

일반

사용자정보

개정판 97cde7e3

ID97cde7e365f9169a447e9d9e43fd22f308bf0b8f
상위 3d4d6da9
하위 4e24ca5f

이지연이(가) 5년 이상 전에 추가함

issue #660: SmartUpdate 수정

Change-Id: Ie4469cf5493423fe0bd367623860cd96e92b9574

차이점 보기:

SmartUpdate/MainWindow.xaml.cs
35 35
        private string msgFileName = SmartUpdate.Properties.Settings.Default.msgFileName; //메시지창에 띄워줄 프로그램명        
36 36
        private string FileName = SmartUpdate.Properties.Settings.Default.FileName; //실행파일명
37 37

  
38
        private string[] url; // msi 파일 url
39
        string destfilepath = string.Empty;
40
        public static string TempFolder
41
        {
42
            get
43
            {
44
                return Path.Combine(Path.GetTempPath(), "MARKUS");
45
            }
46
        }
47

  
38 48
        public MainWindow()
39 49
        {
40 50
            InitializeComponent();            
......
46 56

  
47 57
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
48 58
        {           
49
            m_bLoop = true;
50
            lastIndex = index = 0;
51
            theProgBarThread = new Thread(new ThreadStart(Step));
52
            theProgBarThread.Start();
53
            Thread.Sleep(100);
54
            PartialDownloadProgressBar.Maximum = 100;            
55
            strArg = Environment.GetCommandLineArgs(); //KCOM 접속 파라미터 값 받기 위해            
56
            ConnectUpgradeServer(); //여기서부터 XML 파싱 및 파일 다운로드
59
            //m_bLoop = true;
60
            //lastIndex = index = 0;
61
            //theProgBarThread = new Thread(new ThreadStart(Step));
62
            //theProgBarThread.Start();
63
            //Thread.Sleep(100);
64
            //PartialDownloadProgressBar.Maximum = 100;
65
            url = Environment.GetCommandLineArgs(); //file url                  
66
            destfilepath = System.IO.Path.Combine(TempFolder, System.IO.Path.GetFileName(url[1]));
67
            splashText.Text = "Update Download Start...";
68
            WebClient client = new WebClient();
69
            client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
70
            client.DownloadFileCompleted += new AsyncCompletedEventHandler(Client_DownloadFileCompleted);
71
            client.DownloadFileAsync(new Uri(url[1]), destfilepath);
72
            //ConnectUpgradeServer(); //여기서부터 XML 파싱 및 파일 다운로드
73
        }
74

  
75
        private void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
76
        {
77
            Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate
78
            {
79
                double bytesIn = double.Parse(e.BytesReceived.ToString());
80
                double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
81
                double percentage = bytesIn / totalBytes * 100;
82
                splashText.Text = "Download : " + Math.Truncate(percentage).ToString() + " %";
83
                progressBar.Value = int.Parse(Math.Truncate(percentage).ToString());
84
            }));
85
        }
86

  
87

  
88
        private void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
89
        {
90
            try
91
            {
92
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate
93
                {
94
                    splashText.Text = "Download Completed";
95
                }));
96

  
97
                if (File.Exists(destfilepath))
98
                {
99
                    ProcessStartInfo update_msi = new ProcessStartInfo();
100
                    update_msi.FileName = destfilepath;
101
                    Process.Start(update_msi);
102
                }
103
                this.Close();
104
            }
105
            catch (Exception)
106
            {
107
                throw;
108
            }
109

  
57 110
        }
58 111

  
112
        /*
113

  
59 114
        public class ItemInfo
60 115
        {
61 116
            public string FileName { get; set; }
......
135 190
                SmartUpdateExit("File Loading Error SmartUpdate를 종료합니다."); //스마트 업데이트 종료
136 191
            }                 
137 192
        }
138

  
193
        string destfilepath = string.Empty;
194
        public static string TempFolder
195
        {
196
            get
197
            {
198
                return Path.Combine(Path.GetTempPath(), "MARKUS");
199
            }
200
        }
139 201
        private void SetDown()
140 202
        {
141 203
            try
142
            {                
204
            {
143 205
                for (int i = 0; i < itemInfoList.Count; i++)
144 206
                {
145 207
                    WebClient theDownloadThread = new WebClient();
......
355 417
                ErrorLogFileWrite("업데이트 파일 작성에 실패했습니다.  \r\n 상세로그 : " + strError);
356 418
            }
357 419
        }
420
        */
358 421

  
359 422
        private void WinState(object sender, MouseButtonEventArgs e)
360 423
        {

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)