private void Wc_UploadDataCompleted(object sender, UploadDataCompletedEventArgs e) { //Debug.WriteLine(e.Error?.ToString() ?? "NOERROR"); if (e.Error is WebException && ((WebException)e.Error).Status == WebExceptionStatus.RequestCanceled) { Title = titledef + "RETRY"; Debug.WriteLine(e.Error?.ToString() ?? "NON ERROR ABORT"); DownloadData(); return; } timer.Start(); if (e.Error != null) { /*lvLog.Items.Add(DateTime.Now.ToShortTimeString()+" "+(e.Cancelled?"사용자 취소":"통신 오류")+": "+e.Error.ToString()); * lvLog.SelectedIndex = lvLog.Items.Count - 1;*/ Debug.WriteLine(e.Error.ToString()); Title = titledef + "Comm Error!!"; return; } Title = titledef + "Finished"; Encoding en = new UTF8Encoding(); string res = en.GetString(e.Result); DataForming.SelectAll(res); FillCalendar(); if (wc != null) { wc.Dispose(); wc = null; } }
public MainWindow() { InitializeComponent(); Title = titledef + "Ready"; tboxFilter.Text = Settings.Default.filter; chkFilter.IsChecked = Settings.Default.invisible; filters = tboxFilter.Text.Split(',').ToList(); DataForming.OnChanged += DataForming_OnChanged; String lastfile = null; try { lastfile = System.IO.File.ReadAllText(@"lastlist.txt"); } catch { Debug.WriteLine("NO LAST FILE: First run?"); } if (lastfile != null) { DataForming.SelectAll(lastfile, true); } ni.BalloonTipClicked += Ni_DoubleClick; ni.DoubleClick += Ni_DoubleClick; ni.MouseClick += Ni_MouseClick; System.Windows.Forms.ContextMenu ct = new System.Windows.Forms.ContextMenu(); ct.MenuItems.Add("보기", (o, e) => { if (WindowState == WindowState.Minimized) { WindowState = WindowState.Normal; } Show(); Activate(); }); ct.MenuItems.Add("정보", (o, e) => { System.Windows.MessageBox.Show("Created by Jinbaek Lee", "SCITSchedule Hi 2018"); }); ct.MenuItems.Add("-"); ct.MenuItems.Add("종료", (o, e) => { Close(); }); ni.ContextMenu = ct; string[] args = Environment.GetCommandLineArgs(); if (args.Contains("-h")) { Hide(); } ni.Icon = System.Drawing.Icon.ExtractAssociatedIcon( System.Reflection.Assembly.GetEntryAssembly().ManifestModule.Name); ni.Visible = true; }