private double EstimateSearchProgress() { double progress = 0; int total = 0, currentFirst = 0, currentSecond = 0; string path = ""; CoreStatus mainThreadStatus = m_core.StatusGet(CoreDll.ThreadType.Main, 0); if (mainThreadStatus != null) { total = mainThreadStatus.total; if(mainThreadStatus.current > 0) { if(m_coreOptions.compareOptions.checkOnEquality) { for(int i = 0; ; i++) { CoreStatus compareThreadStatus = m_core.StatusGet(CoreDll.ThreadType.Compare, i); if (compareThreadStatus == null) break; if(i == 0) { path = compareThreadStatus.path; } currentFirst += compareThreadStatus.current; currentSecond += compareThreadStatus.total; } } else { currentFirst = mainThreadStatus.current; for (int i = 0; ; i++) { CoreStatus collectThreadStatus = m_core.StatusGet(CoreDll.ThreadType.Collect, i); if(collectThreadStatus == null) break; if (i == 0) { path = collectThreadStatus.path; } currentFirst += collectThreadStatus.current; currentFirst -= collectThreadStatus.total; } } } else { path = mainThreadStatus.path; } } m_progressPanel.UpdateStatus(total, currentFirst, currentSecond, path); if(total > 0) { progress = (double)currentFirst/(double)total; } return progress; }
private void EstimateOtherProgress() { CoreStatus status = m_core.StatusGet(CoreDll.ThreadType.Main, 0); if (status != null) m_progressPanel.UpdateStatus(status.total, status.current, status.current, ""); else m_progressPanel.UpdateStatus(0, 0, 0, ""); }
public bool IsWork() { CoreStatus status = StatusGet(CoreDll.ThreadType.Main, 0); if (status != null) { return(status.state != CoreDll.StateType.None); } else { return(false); } }
void TimerCallback(Object obj, EventArgs eventArgs) { if (m_state == State.Finish) { Close(); } else { StringBuilder builder = new StringBuilder(); Strings s = Resources.Strings.Current; switch (m_state) { case State.Start: case State.Work: { switch (m_type) { case Type.ApplyAction: switch (m_action) { case CoreDll.LocalActionType.DeleteDefect: builder.Append(s.ProgressForm_DeleteDefect); break; case CoreDll.LocalActionType.DeleteFirst: builder.Append(s.ProgressForm_DeleteFirst); break; case CoreDll.LocalActionType.DeleteSecond: builder.Append(s.ProgressForm_DeleteSecond); break; case CoreDll.LocalActionType.DeleteBoth: builder.Append(s.ProgressForm_DeleteBoth); break; case CoreDll.LocalActionType.PerformHint: builder.Append(s.ProgressForm_PerformHint); break; case CoreDll.LocalActionType.Mistake: builder.Append(s.ProgressForm_Mistake); break; case CoreDll.LocalActionType.RenameFirstToSecond: case CoreDll.LocalActionType.RenameSecondToFirst: builder.Append(s.ProgressForm_RenameCurrent); break; } m_cancelButton.Enabled = true; break; case Type.RenameCurrent: builder.Append(s.ProgressForm_RenameCurrent); m_cancelButton.Enabled = false; break; case Type.RefreshResults: builder.Append(s.ProgressForm_RefreshResults); m_cancelButton.Enabled = true; break; case Type.Undo: builder.Append(s.ProgressForm_Undo); m_cancelButton.Enabled = false; break; case Type.Redo: builder.Append(s.ProgressForm_Redo); m_cancelButton.Enabled = false; break; case Type.LoadResults: builder.Append(s.StartFinishForm_LoadResults_Text); m_cancelButton.Enabled = true; break; case Type.SaveResults: builder.Append(s.StartFinishForm_SaveResults_Text); m_cancelButton.Enabled = true; break; case Type.ClearResults: builder.Append(s.StartFinishForm_ClearTemporary_Text); m_cancelButton.Enabled = false; break; case Type.ClearTemporary: builder.Append(s.StartFinishForm_ClearTemporary_Text); m_cancelButton.Enabled = true; break; case Type.ClearDatabase: builder.Append(s.StartFinishForm_LoadImages_Text); m_cancelButton.Enabled = false; break; case Type.LoadImages: builder.Append(s.StartFinishForm_LoadImages_Text); m_cancelButton.Enabled = true; break; case Type.SaveImages: builder.Append(s.StartFinishForm_SaveImages_Text); m_cancelButton.Enabled = false; break; } CoreStatus status = m_core.StatusGet(CoreDll.ThreadType.Main, 0); if (status != null) { double progress = status.total > 0 ? ((double)status.current) / status.total : 0; builder.AppendFormat(" ({0})...", ProgressUtils.GetProgressString(progress, m_startDateTime)); m_progressPanel.UpdateStatus(status.total, status.current, status.current, status.path); } else { m_progressPanel.UpdateStatus(0, 0, 0, ""); } } break; case State.Stopped: { builder.Append(s.CancelButton_Text); builder.Append("..."); } break; } Text = builder.ToString(); } }
void TimerCallback(Object obj, EventArgs eventArgs) { if (m_state == State.Finish) { Close(); } else if (m_state == State.ViewStart) { m_progressBar.Visible = false; Text = Application.ProductName; } else { StringBuilder builder = new StringBuilder(); builder.Append(Application.ProductName); builder.Append(" - "); Strings s = Resources.Strings.Current; switch (m_state) { case State.Start: case State.LoadImages: builder.Append(s.StartFinishForm_LoadImages_Text); break; case State.LoadMistakes: builder.Append(s.StartFinishForm_LoadMistakes_Text); break; case State.LoadResults: builder.Append(s.StartFinishForm_LoadResults_Text); break; case State.SaveImages: builder.Append(s.StartFinishForm_SaveImages_Text); break; case State.SaveMistakes: builder.Append(s.StartFinishForm_SaveMistakes_Text); break; case State.SaveResults: builder.Append(s.StartFinishForm_SaveResults_Text); break; case State.ClearResults: case State.ClearTemporary: builder.Append(s.StartFinishForm_ClearTemporary_Text); break; } Text = builder.ToString(); CoreStatus status = m_core.StatusGet(CoreDll.ThreadType.Main, 0); if (status != null) { if (status.total > 0) { m_progressBar.Value = status.current * m_progressBar.Maximum / status.total; } else { m_progressBar.Value = 0; } } } }