예제 #1
0
 /// <summary>
 /// 詳細変更イベントを実行する
 /// </summary>
 /// <param name="sender">イベント呼び出し元オブジェクト</param>
 /// <param name="e">e</param>
 private void Command_DetailChanged(object sender, ItemProgressedEventArgs e)
 {
     for (var i = 1; i < 4; i++)
     {
         ChangeProgress(i, e);
     }
 }
예제 #2
0
        /// <summary>
        /// 進捗表示の更新を実行する
        /// </summary>
        /// <param name="index">区分インデックスを表す数値</param>
        /// <param name="e">イベント引数</param>
        private void ChangeProgress(int index, ItemProgressedEventArgs e)
        {
            ProgressBar pb = index switch
            {
                1 => _fileProgressBar,
                2 => _viewProgressBar,
                3 => _itemProgressBar,
                _ => null
            };
            Label nameLabel = index switch
            {
                1 => _fileNameLabel,
                2 => _categoryNameLabel,
                3 => _itemNameLabel,
                _ => null
            };
            Label countLabel = index switch
            {
                1 => _fileCountLabel,
                2 => _categoryCountLabel,
                3 => _itemCountLabel,
                _ => null
            };
            CountItem item = index switch
            {
                1 => e.FileCount,
                2 => e.ViewCount,
                3 => e.DetailCount,
                _ => new CountItem()
            };

            //
            Application.DoEvents();
            pb.Maximum      = item.Items;
            pb.Value        = item.Counter;
            nameLabel.Text  = item.Name;
            countLabel.Text = $"{item.Counter}/{item.Items}";
            int rate = 0;

            if (e.DetailCount.Items > 1)
            {
                rate = 100 * e.DetailCount.Counter / e.DetailCount.Items;
            }
            Text = $"{GetFormText()}{rate.ToString()}%";
        }