Пример #1
0
 /// <summary>
 /// 执行命令
 /// </summary>
 /// <param name="cmd"></param>
 public void ExcuteCmd(CmdString cmd)
 {
     if (_isInitialized)
     {
         if (_curProcess.HasExited)
         {
             OnCallBack(string.Format("{0}|Background Application Has Stopped!", CmdStrings.StopMirror));
         }
         else
         {
             _curProcess.StandardInput.WriteLine(cmd.ToString());
         }
     }
 }
Пример #2
0
 /// <summary>
 /// 状态变化事件
 /// </summary>
 private void StateChanged(CmdString state)
 {
     if (state.IsType(CmdStrings.Progress))
     {
         CmdString progress    = state.GetChildCmd();
         long      finisedSize = 0;
         if (long.TryParse(progress.ToString(), out finisedSize))
         {
             ProgressChanged(finisedSize);
             _pauseInfo.SetPausePos(finisedSize);
         }
     }
     else if (state.Match(CmdStrings.StartMirror))
     {
         SourcePosition.IsMirroring = true;
     }
     else if (state.Match(CmdStrings.AllFinishState))
     {
         _msgBox.ShowDialogSuccessMsg("镜像完成");
         SourcePosition.IsMirroring    = false;
         ProgressPosition.FinishedSize = ProgressPosition.TotalSize;
         ProgressPosition.Stop();
     }
     else if (state.IsType(CmdStrings.Exception))
     {
         _msgBox.ShowErrorMsg("镜像失败" + state.GetChildCmd());
         SourcePosition.IsMirroring = false;
     }
     else if (state.Match(CmdStrings.StopMirror))
     {
         _msgBox.ShowDialogSuccessMsg("镜像停止");
         SourcePosition.IsMirroring = false;
     }
     else if (state.Match(CmdStrings.NoSelectedPartition))
     {
         _msgBox.ShowDialogSuccessMsg("请选择至少一个分区");
         SourcePosition.IsMirroring = false;
     }
     else if (state.Match(CmdStrings.PauseMirror) ||
              state.Match(CmdStrings.ContinueMirror))
     {
         _msgBox.ShowDialogSuccessMsg(state.ToString());
     }
 }