/// <summary> /// 关闭时保存Key /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Window_Closed(object sender, EventArgs e) { string temp = _currentKey; try { DataSaver.SaveSettingData <string>(temp); } catch { System.Windows.MessageBox.Show("Key保存失败。"); } }
/// <summary> /// 加载时读取Key /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Window_Initialized(object sender, EventArgs e) { try { DataSaver.LoadSettingData <string>(out _currentKey); tbKey.Text = _currentKey; } catch { System.Windows.MessageBox.Show("Key读取失败,可能没有保存的Key"); } targetFiles = new Queue <string>(); failedList = new List <string>(); //定义跨线程委托 progressBarDelegate = () => { pbProgress.Value++; }; progressMsgDelegate = () => { msgProgress.Content = "正在压缩/下载图片...(" + pbProgress.Value.ToString() + "/" + _totalImage.ToString() + ")"; }; }