public void ModifyProgress(OperateKind operateKind, object Value) { //if (Value == null) // Value = ""; //switch (operateKind) //{ // case OperateKind.SetMainTitle: // mainTitle = Value.ToString(); // break; // case OperateKind.SetSecondTitle: // secondTitle = Value.ToString(); // break; // case OperateKind.SetMainCurValue: // mainCurValue = Value.ToInt(); // break; // case OperateKind.SetSecondCurValue: // secondCurValue = Value.ToInt(); // break; // case OperateKind.SetMainMaxValue: // mainMaxValue = Value.ToInt(); // break; // case OperateKind.SetSecondMaxValue: // secondMaxValue = Value.ToInt(); // break; // default: // break; //} this.Invoke(myInvoke, new object[] { operateKind, Value }); }
private void MyInvokeMethod(OperateKind operateKind, object Value) { if (Value == null) { Value = ""; } switch (operateKind) { case OperateKind.SetMainTitle: lblTitleMain.Text = Value.ToString(); break; case OperateKind.SetSecondTitle: lblTitleSecond.Text = Value.ToString(); break; case OperateKind.SetMainCurValue: int mainCurValue = Value.ToInt(); progressBarParent.Value = mainCurValue; lblMainCurValue.Text = mainCurValue + "/" + progressBarParent.Maximum; break; case OperateKind.SetSecondCurValue: int secondCurValue = Value.ToInt(); progressBarChild.Value = secondCurValue; lblSecondCurValue.Text = secondCurValue + "/" + progressBarChild.Maximum; break; case OperateKind.SetMainMaxValue: int mainMaxValue = Value.ToInt(); if (progressBarParent.Minimum != 0) { progressBarParent.Minimum = 0; } if (progressBarParent.Maximum != mainMaxValue) { progressBarParent.Maximum = mainMaxValue; } break; case OperateKind.SetSecondMaxValue: int secondMaxValue = Value.ToInt(); if (progressBarChild.Minimum != 0) { progressBarChild.Minimum = 0; } if (progressBarChild.Maximum != secondMaxValue) { progressBarChild.Maximum = secondMaxValue; } break; default: break; } }