Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16317


Ignore:
Timestamp:
11/22/18 12:37:04 (6 years ago)
Author:
pfleck
Message:

#2845 Combined separate Show methods into single one with enum parameter specifying the ProgressMode. Renamed Continuous and Marquee to Determinate and Indeterminate.

Location:
branches/2845_EnhancedProgress
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • branches/2845_EnhancedProgress/HeuristicLab.Analysis.Statistics.Views/3.3/ChartAnalysisView.cs

    r16311 r16317  
    173173
    174174    private void addLineToChart_Click(object sender, EventArgs e) {
    175       Progress.ShowMarquee(this, "Adding fitted lines to charts...");
     175      Progress.Show(this, "Adding fitted lines to charts...", ProgressMode.Indeterminate);
    176176
    177177      string resultName = (string)dataTableComboBox.SelectedItem;
  • branches/2845_EnhancedProgress/HeuristicLab.Analysis.Statistics.Views/3.3/StatisticalTestsView.cs

    r16311 r16317  
    356356
    357357      if (data != null && data.All(x => x != null)) {
    358         Progress.ShowMarquee(this, "Calculating...");
     358        Progress.Show(this, "Calculating...", ProgressMode.Indeterminate);
    359359
    360360        string curItem = (string)groupCompComboBox.SelectedItem;
     
    376376        return;
    377377
    378       Progress.ShowMarquee(pairwiseTestGroupBox, "Calculating...");
     378      Progress.ShowOnControl(pairwiseTestGroupBox, "Calculating...", ProgressMode.Indeterminate);
    379379      Task.Factory.StartNew(() => CalculatePairwiseAsync(groupName));
    380380    }
     
    383383      CalculatePairwiseTest(groupName);
    384384
    385       Progress.Hide(pairwiseTestGroupBox);
     385      Progress.HideFromControl(pairwiseTestGroupBox);
    386386    }
    387387
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Access.Views/3.3/ClientViews/ClientView.cs

    r16311 r16317  
    7777    public void StartProgressView() {
    7878      var message = "Downloading client information. Please be patient.";
    79       Progress.ShowMarquee(this, message);
     79      Progress.Show(this, message, ProgressMode.Indeterminate);
    8080    }
    8181
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectJobsView.cs

    r16314 r16317  
    139139
    140140    private void refreshButton_Click(object sender, EventArgs e) {
    141       progress.StartMarquee("Refreshing jobs...");
     141      progress.Start("Refreshing jobs...", ProgressMode.Indeterminate);
    142142      SetEnabledStateOfControls();
    143143      var task = System.Threading.Tasks.Task.Factory.StartNew(RefreshJobsAsync);
     
    160160
    161161        if (result == DialogResult.Yes) {
    162           progress.StartMarquee("Removing job(s)...");
     162          progress.Start("Removing job(s)...", ProgressMode.Indeterminate);
    163163          SetEnabledStateOfControls();
    164164          var task = System.Threading.Tasks.Task.Factory.StartNew(RemoveJobsAsync, jobs);
     
    191191
    192192        if (result == DialogResult.Yes) {
    193           progress.StartMarquee("Resuming job(s)...");
     193          progress.Start("Resuming job(s)...", ProgressMode.Indeterminate);
    194194          SetEnabledStateOfControls();
    195195          var task = System.Threading.Tasks.Task.Factory.StartNew(ResumeJobsAsync, jobs);
     
    253253
    254254        if (result == DialogResult.Yes) {
    255           progress.StartMarquee("Stopping job(s)...");
     255          progress.Start("Stopping job(s)...", ProgressMode.Indeterminate);
    256256          SetEnabledStateOfControls();
    257257          var task = System.Threading.Tasks.Task.Factory.StartNew(StopJobsAsync, jobs);
     
    390390    private void RemoveJobsAsync(object jobs) {
    391391      var jobList = (IEnumerable<RefreshableJob>)jobs;
    392       progress.StartMarquee("");
     392      progress.Start("", ProgressMode.Indeterminate);
    393393      foreach (var job in jobList) {
    394394        progress.Message = "Removing job \"" + job.Job.Name + "\"...";
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.cs

    r16312 r16317  
    161161      if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshing, sender, e);
    162162      else {
    163         Progress.ShowMarquee(this, "Refreshing ...");
     163        Progress.Show(this, "Refreshing ...", ProgressMode.Indeterminate);
    164164        SetEnabledStateOfControls();
    165165      }
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs

    r16312 r16317  
    183183      if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshing, sender, e);
    184184      else {
    185         Progress.ShowMarquee(this, "Refreshing ...");
     185        Progress.Show(this, "Refreshing ...", ProgressMode.Indeterminate);
    186186        SetEnabledStateOfControls();
    187187      }
     
    199199      if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshing, sender, e);
    200200      else {
    201         Progress.ShowMarquee(this, "Refreshing ...");
     201        Progress.Show(this, "Refreshing ...", ProgressMode.Indeterminate);
    202202        SetEnabledStateOfControls();
    203203      }
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs

    r16312 r16317  
    185185      if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshing, sender, e);
    186186      else {
    187         Progress.ShowMarquee(this, "Refreshing ...");
     187        Progress.Show(this, "Refreshing ...", ProgressMode.Indeterminate);
    188188        SetEnabledStateOfControls();
    189189      }
     
    201201      if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshing, sender, e);
    202202      else {
    203         Progress.ShowMarquee(this, "Refreshing ...");
     203        Progress.Show(this, "Refreshing ...", ProgressMode.Indeterminate);
    204204        SetEnabledStateOfControls();
    205205      }
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.JobManager/3.3/MenuItems/RunInHiveMenuItem.cs

    r16311 r16317  
    9999          rJob.Job.ResourceIds = hiveResourceSelectorDialog.SelectedResources.Select(x => x.Id).ToList();
    100100
    101           progress = Progress.ShowMarquee(this.content, "Uploading to Hive...");
     101          progress = Progress.Show(this.content, "Uploading to Hive...", ProgressMode.Indeterminate);
    102102          rJob.Progress = progress;
    103103          progress.ProgressStateChanged += progress_ProgressStateChanged;
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.cs

    r16312 r16317  
    9696      if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveClient_Instance_Refreshing, sender, e);
    9797      else {
    98         Progress.ShowMarquee(this, "Refreshing");
     98        Progress.ShowOnControl(this, "Refreshing", ProgressMode.Indeterminate);
    9999        refreshButton.Enabled = false;
    100100      }
     
    104104      if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveClient_Instance_Refreshed, sender, e);
    105105      else {
    106         Progress.Hide(this);
     106        Progress.HideFromControl(this);
    107107        refreshButton.Enabled = true;
    108108      }
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobListView.cs

    r16312 r16317  
    131131
    132132    private void DeleteHiveJobsAsync(object items) {
    133       Progress.ShowMarquee(this, "Deleting job...");
     133      Progress.Show(this, "Deleting job...", ProgressMode.Indeterminate);
    134134      foreach (RefreshableJob item in (List<RefreshableJob>)items) {
    135135        Content.Remove(item);
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs

    r16314 r16317  
    493493
    494494    private void PauseJobAsync(object job) {
    495       Content.Progress.StartMarquee("Pausing job...");
     495      Content.Progress.Start("Pausing job...", ProgressMode.Indeterminate);
    496496      HiveClient.PauseJob((RefreshableJob)job);
    497497      Content.Progress.Finish();
     
    499499
    500500    private void StopJobAsync(object job) {
    501       Content.Progress.StartMarquee("Stopping job...");
     501      Content.Progress.Start("Stopping job...", ProgressMode.Indeterminate);
    502502      HiveClient.StopJob((RefreshableJob)job);
    503503      Content.Progress.Finish();
     
    505505
    506506    private void ResumeJobAsync(object job) {
    507       Content.Progress.StartMarquee("Resuming job...");
     507      Content.Progress.Start("Resuming job...", ProgressMode.Indeterminate);
    508508      HiveClient.ResumeJob((RefreshableJob)job);
    509509      Content.Progress.Finish();
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.Views/3.3/HiveTasks/OptimizerHiveTaskView.cs

    r16314 r16317  
    9999
    100100    private void PauseTaskAsync() {
    101       Content.Progress.StartMarquee("Pausing task. Please be patient for the command to take effect.");
     101      Content.Progress.Start("Pausing task. Please be patient for the command to take effect.", ProgressMode.Indeterminate);
    102102      Content.Pause();
    103103      Content.Progress.Finish();
     
    105105
    106106    private void StopTaskAsync() {
    107       Content.Progress.StartMarquee("Stopping task. Please be patient for the command to take effect.");
     107      Content.Progress.Start("Stopping task. Please be patient for the command to take effect.", ProgressMode.Indeterminate);
    108108      Content.Stop();
    109109      Content.Progress.Finish();
     
    111111
    112112    private void ResumeTaskAsync() {
    113       Content.Progress.StartMarquee("Resuming task. Please be patient for the command to take effect.");
     113      Content.Progress.Start("Resuming task. Please be patient for the command to take effect.", ProgressMode.Indeterminate);
    114114      Content.Restart();
    115115      Content.Progress.Finish();
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive/3.3/HiveClient.cs

    r16312 r16317  
    469469
    470470      try {
    471         refreshableJob.Progress.StartMarquee("Saving Job...");
     471        refreshableJob.Progress.Start("Saving Job...", ProgressMode.Indeterminate);
    472472        HiveClient.StoreAsync(new Action<Exception>((Exception ex) => {
    473473          throw new Exception("Update failed.", ex);
     
    488488      try {
    489489        refreshableJob.IsProgressing = true;
    490         refreshableJob.Progress.StartMarquee("Connecting to server...");
     490        refreshableJob.Progress.Start("Connecting to server...", ProgressMode.Indeterminate);
    491491
    492492        foreach (OptimizerHiveTask hiveJob in refreshableJob.HiveTasks.OfType<OptimizerHiveTask>()) {
     
    514514        // upload tasks
    515515        refreshableJob.Progress.Message = "Uploading tasks...";
    516         refreshableJob.Progress.ProgressBarMode = ProgressBarMode.Continuous;
     516        refreshableJob.Progress.ProgressMode = ProgressMode.Determinate;
    517517        refreshableJob.Progress.ProgressValue = 0;
    518518
     
    643643
    644644        // fetch all task objects to create the full tree of tree of HiveTask objects
    645         refreshableJob.Progress.StartMarquee("Downloading list of tasks...");
     645        refreshableJob.Progress.Start("Downloading list of tasks...", ProgressMode.Indeterminate);
    646646        allTasks = HiveServiceLocator.Instance.CallHiveService(s => s.GetLightweightJobTasksWithoutStateLog(hiveExperiment.Id));
    647647        totalJobCount = allTasks.Count();
    648648
    649649        refreshableJob.Progress.Message = "Downloading tasks...";
    650         refreshableJob.Progress.ProgressBarMode = ProgressBarMode.Continuous;
     650        refreshableJob.Progress.ProgressMode = ProgressMode.Determinate;
    651651        refreshableJob.Progress.ProgressValue = 0.0;
    652652        downloader = new TaskDownloader(allTasks.Select(x => x.Id));
     
    666666
    667667        refreshableJob.Progress.Message = "Downloading/deserializing complete. Displaying tasks...";
    668         refreshableJob.Progress.ProgressBarMode = ProgressBarMode.Marquee;
     668        refreshableJob.Progress.ProgressMode = ProgressMode.Indeterminate;
    669669
    670670        // build child-task tree
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBExperimentUploadView.cs

    r16311 r16317  
    188188      if (InvokeRequired) { Invoke((Action<object, EventArgs>)RunCreationClient_Refreshing, sender, e); return; }
    189189      var message = "Refreshing algorithms and problems...";
    190       Progress.ShowMarquee(this, message);
     190      Progress.Show(this, message, ProgressMode.Indeterminate);
    191191      refreshing = true;
    192192      SetEnabledStateOfControls();
  • branches/2845_EnhancedProgress/HeuristicLab.DataPreprocessing.Views/3.4/DataPreprocessingView.cs

    r16311 r16317  
    220220          if (storable != null) {
    221221            try {
    222               Progress.ShowMarquee(Content, "Exporting data.");
     222              Progress.Show(Content, "Exporting data.", ProgressMode.Indeterminate);
    223223              ContentManager.Save(storable, saveFileDialog.FileName, compressed);
    224224            } finally {
     
    241241          try {
    242242            var problemData = Content.CreateNewProblemData();
    243             Progress.ShowMarquee(Content, "Exporting data.");
     243            Progress.Show(Content, "Exporting data.", ProgressMode.Indeterminate);
    244244            if (problemData is TimeSeriesPrognosisProblemData)
    245245              Export(new TimeSeriesPrognosisCSVInstanceProvider(), problemData, saveFileDialog.FileName);
  • branches/2845_EnhancedProgress/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ProgressView.cs

    r16311 r16317  
    163163      }
    164164
    165       if (content.ProgressBarMode == ProgressBarMode.Continuous) {
    166         progressBar.Style = ProgressBarStyle.Continuous;
    167         progressBar.Value = (int)Math.Round(progressBar.Minimum + content.ProgressValue * (progressBar.Maximum - progressBar.Minimum));
    168       } else {
    169         progressBar.Style = ProgressBarStyle.Marquee;
    170         progressBar.Value = 0;
     165      switch (content.ProgressMode) {
     166        case ProgressMode.Determinate:
     167          progressBar.Style = ProgressBarStyle.Continuous;
     168          progressBar.Value = (int)Math.Round(progressBar.Minimum + content.ProgressValue * (progressBar.Maximum - progressBar.Minimum));
     169          break;
     170        case ProgressMode.Indeterminate:
     171          progressBar.Style = ProgressBarStyle.Marquee;
     172          progressBar.Value = 0;
     173          break;
     174        default:
     175          throw new NotImplementedException($"Invalid Progress Mode: {content.ProgressMode}");
    171176      }
    172177    }
  • branches/2845_EnhancedProgress/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs

    r16314 r16317  
    381381    /// Adds a <see cref="ProgressView"/> to the specified view.
    382382    /// </summary>
    383     internal void AddProgressToView(Control control, IProgress progress) {
     383    internal void AddProgressToControl(Control control, IProgress progress) {
    384384      if (InvokeRequired) {
    385         Invoke((Action<Control, IProgress>)AddProgressToView, control, progress);
     385        Invoke((Action<Control, IProgress>)AddProgressToControl, control, progress);
    386386        return;
    387387      }
     
    426426    /// Removes an existing <see cref="ProgressView"/> from the specified view.
    427427    /// </summary>
    428     internal void RemoveProgressFromView(Control control, bool finishProgress = true) {
     428    internal void RemoveProgressFromControl(Control control, bool finishProgress = true) {
    429429      if (InvokeRequired) {
    430         Invoke((Action<Control, bool>)RemoveProgressFromView, control, finishProgress);
     430        Invoke((Action<Control, bool>)RemoveProgressFromControl, control, finishProgress);
    431431        return;
    432432      }
  • branches/2845_EnhancedProgress/HeuristicLab.MainForm.WindowsForms/3.3/Progress.cs

    r16314 r16317  
    4848    }
    4949
    50     private ProgressBarMode progressBarMode;
    51     public ProgressBarMode ProgressBarMode {
    52       get { return progressBarMode; }
    53       set {
    54         if (progressBarMode != value) {
    55           progressBarMode = value;
     50    private ProgressMode progressMode;
     51    public ProgressMode ProgressMode {
     52      get { return progressMode; }
     53      set {
     54        if (progressMode != value) {
     55          progressMode = value;
    5656          OnProgressBarModeChanged();
    5757        }
     
    6363      get { return progressValue; }
    6464      set {
    65         if (progressBarMode == ProgressBarMode.Marquee)
    66           throw new InvalidOperationException("Cannot set ProgressValue while ProgressBar is in Marquee-Mode");
     65        if (progressMode == ProgressMode.Indeterminate)
     66          throw new InvalidOperationException("Cannot set ProgressValue while ProgressBar is in Indeterminate-Mode");
    6767        if (progressValue != value) {
    6868          progressValue = Math.Max(Math.Min(value, 1.0), 0.0);
     
    9898      canBeStopped = false;
    9999      canBeCanceled = false;
    100       progressBarMode = ProgressBarMode.Marquee;
     100      progressMode = ProgressMode.Indeterminate;
    101101      progressValue = 0.0;
    102102    }
    103103
    104     public void Start(string message, double progressValue = 0) {
     104    public void Start(string message, ProgressMode mode = ProgressMode.Determinate) {
    105105      ProgressState = ProgressState.Started;
    106       ProgressBarMode = ProgressBarMode.Continuous;
    107       ProgressValue = progressValue;
     106      ProgressMode = mode;
     107      if (mode == ProgressMode.Determinate)
     108        ProgressValue = 0.0;
    108109      Message = message;
    109110    }
    110     public void StartMarquee(string message) {
    111       ProgressState = ProgressState.Started;
    112       ProgressBarMode = ProgressBarMode.Marquee;
    113       Message = message;
    114     }
    115111
    116112    public void Finish() {
    117       if (ProgressBarMode == ProgressBarMode.Continuous && ProgressValue != 1.0)
     113      if (ProgressMode == ProgressMode.Determinate && ProgressValue != 1.0)
    118114        ProgressValue = 1.0;
    119115      ProgressState = ProgressState.Finished;
     
    135131    #region Show/Hide Progress
    136132    /// <summary>
    137     /// Shows a started Progress in Continuous-mode on all Views of the specified content.
    138     /// </summary>
    139     public static IProgress Show(IContent content, string progressMessage, double initialProgressValue = 0, bool addToObjectGraphObjects = true) {
     133    /// Shows a started Progress on all Views of the specified content.
     134    /// </summary>
     135    public static IProgress Show(IContent content, string progressMessage, ProgressMode mode = ProgressMode.Determinate, bool addToObjectGraphObjects = true) {
    140136      var progress = new Progress();
    141       progress.Start(progressMessage, initialProgressValue);
     137      progress.Start(progressMessage, mode);
    142138      AddProgressToContent(content, progress, addToObjectGraphObjects);
    143139      return progress;
    144140    }
    145     /// <summary>
    146     /// Shows a started Progress in Marquee-mode on all Views of the specified content.
    147     /// </summary>
    148     public static IProgress ShowMarquee(IContent content, string progressMessage, bool addToObjectGraphObjects = true) {
     141
     142    /// <summary>
     143    /// Shows a started Progress on the specified view.
     144    /// </summary>
     145    public static IProgress Show(IView view, string progressMessage, ProgressMode mode = ProgressMode.Determinate) {
    149146      var progress = new Progress();
    150       progress.StartMarquee(progressMessage);
    151       AddProgressToContent(content, progress, addToObjectGraphObjects);
    152       return progress;
    153     }
    154 
    155     /// <summary>
    156     /// Shows a started Progress in Continuous-mode on the specified view.
    157     /// </summary>
    158     public static IProgress Show(Control control, string progressMessage, double initialProgressValue = 0) {
     147      progress.Start(progressMessage, mode);
     148      AddProgressToView(view, progress);
     149      return progress;
     150    }
     151    /// <summary>
     152    /// Shows a started Progress on the specified control.
     153    /// </summary>
     154    /// <remarks>Use Progress.Show(IView, ...) if possible.</remarks>
     155    public static IProgress ShowOnControl(Control control, string progressMessage, ProgressMode mode = ProgressMode.Determinate) {
    159156      var progress = new Progress();
    160       progress.Start(progressMessage, initialProgressValue);
    161       AddProgressToView(control, progress);
    162       return progress;
    163     }
    164     /// <summary>
    165     /// Shows a started Progress in Marquee-mode on the specified view.
    166     /// </summary>
    167     public static IProgress ShowMarquee(Control control, string progressMessage) {
    168       var progress = new Progress();
    169       progress.StartMarquee(progressMessage);
    170       AddProgressToView(control, progress);
     157      progress.Start(progressMessage, mode);
     158      AddProgressToControl(control, progress);
    171159      return progress;
    172160    }
     
    181169    /// Hides the Progress from the specified view.
    182170    /// </summary>
    183     public static void Hide(Control control) {
    184       RemoveProgressFromView(control);
     171    public static void Hide(IView view) {
     172      RemoveProgressFromView(view);
     173    }
     174    /// <summary>
     175    /// Hides the Progress from the specified control.
     176    /// </summary>
     177    /// <remarks>Use Progress.Hide(IView) if possible.</remarks>
     178    public static void HideFromControl(Control control) {
     179      RemoveProgressFromControl(control);
    185180    }
    186181    #endregion
    187182
    188     #region Interface to from MainForm
     183    #region Interface to MainForm
    189184    public static IProgress AddProgressToContent(IContent content, IProgress progress, bool addToObjectGraphObjects = true) {
    190185      MainFormManager.GetMainForm<WindowsForms.MainForm>().AddProgressToContent(content, progress, addToObjectGraphObjects);
    191186      return progress;
    192187    }
    193     public static IProgress AddProgressToView(Control control, IProgress progress) {
    194       MainFormManager.GetMainForm<WindowsForms.MainForm>().AddProgressToView(control, progress);
     188    public static IProgress AddProgressToView(IView view, IProgress progress) {
     189      //return AddProgressToControl(MainFormManager.GetMainForm<WindowsForms.MainForm>().GetForm(view), progress);
     190      return AddProgressToControl((Control)view, progress);
     191    }
     192    public static IProgress AddProgressToControl(Control control, IProgress progress) {
     193      MainFormManager.GetMainForm<WindowsForms.MainForm>().AddProgressToControl(control, progress);
    195194      return progress;
    196195    }
     
    199198      MainFormManager.GetMainForm<WindowsForms.MainForm>().RemoveProgressFromContent(content, finishProgress);
    200199    }
    201     public static void RemoveProgressFromView(Control control, bool finishProgress = true) {
    202       MainFormManager.GetMainForm<WindowsForms.MainForm>().RemoveProgressFromView(control, finishProgress);
     200    public static void RemoveProgressFromView(IView view, bool finishProgress = true) {
     201      //RemoveProgressFromControl(MainFormManager.GetMainForm<WindowsForms.MainForm>().GetForm(view), finishProgress);
     202      RemoveProgressFromControl((Control)view, finishProgress);
     203    }
     204    public static void RemoveProgressFromControl(Control control, bool finishProgress = true) {
     205      MainFormManager.GetMainForm<WindowsForms.MainForm>().RemoveProgressFromControl(control, finishProgress);
    203206    }
    204207    #endregion
  • branches/2845_EnhancedProgress/HeuristicLab.MainForm/3.3/Interfaces/IProgress.cs

    r16311 r16317  
    2525namespace HeuristicLab.MainForm {
    2626  public enum ProgressState { Started, Finished, StopRequested, CancelRequested }
    27   public enum ProgressBarMode { Continuous, Marquee }
     27  public enum ProgressMode { Determinate, Indeterminate }
    2828
    2929  public interface IProgress : IContent {
    3030    ProgressState ProgressState { get; }
     31
    3132    string Message { get; set; }
    32     ProgressBarMode ProgressBarMode { get; set; }
     33
     34    ProgressMode ProgressMode { get; set; }
    3335    /// <summary>
    3436    /// Gets or sets the currently associated progress value in the range [0;1] (values outside the range are truncated).
    35     /// Changing the ProgressValue when ProgressBarMode is Marquee raises an Exception.
     37    /// Changing the ProgressValue when <c>ProgressMode</c> is <c>Indeterminate</c> raises an Exception.
    3638    /// </summary>
    37     /// <exception cref="InvalidOperationException">Setting the ProgressValue-property while in the Marquee state is invalid.</exception>
     39    /// <exception cref="InvalidOperationException">Setting the ProgressValue-property while in the Indeterminate state is invalid.</exception>
    3840    double ProgressValue { get; set; }
    39     bool CanBeStopped { get; }
    40     bool CanBeCanceled { get; }
    4141
    42     /// <summary>
    43     /// Start (or Restart) a progress in ProgressBarMode Continues to display specific progress values (from 0 to 1).
    44     /// A new progress value is reported by setting the ProgressValue-property.
    45     /// </summary>
    46     void Start(string message, double progressValue = 0);
     42    bool CanBeStopped { get; set; }
     43    bool CanBeCanceled { get; set; }
    4744
    48     /// <summary>
    49     /// Start (or Restart) a progress in ProgressBarMode Marquee to define an "unknown" progress state.
    50     /// Consider using marquee when the progress is not measurable but the user should be notified that something is still happening.
    51     /// Setting the ProgressValue-property in the Marquee state throws an exception.
    52     /// </summary>
    53     void StartMarquee(string message);
    54 
     45    void Start(string message, ProgressMode mode = ProgressMode.Determinate);
    5546    void Finish();
    5647    void Stop();
  • branches/2845_EnhancedProgress/HeuristicLab.Optimizer/3.3/StartPage.cs

    r16311 r16317  
    8888
    8989    private void LoadSamples(object state) {
    90       progress = Progress.Show(samplesListView, "Loading...");
     90      progress = Progress.ShowOnControl(samplesListView, "Loading...");
    9191      try {
    9292        var assembly = Assembly.GetExecutingAssembly();
     
    112112        OnAllSamplesLoaded();
    113113      } finally {
    114         Progress.Hide(samplesListView);
     114        Progress.HideFromControl(samplesListView);
    115115      }
    116116    }
  • branches/2845_EnhancedProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/SymbolicClassificationSolutionView.cs

    r16311 r16317  
    6060        var name = exportFileDialog.FileName;
    6161        using (BackgroundWorker bg = new BackgroundWorker()) {
    62           Progress.ShowMarquee(this, "Exportion solution to " + name + ".");
     62          Progress.Show(this, "Exportion solution to " + name + ".", ProgressMode.Indeterminate);
    6363          bg.DoWork += (o, a) => exporter.Export(Content, name);
    6464          bg.RunWorkerCompleted += (o, a) => Progress.Hide(this);
  • branches/2845_EnhancedProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/SymbolicDiscriminantFunctionClassificationSolutionView.cs

    r16311 r16317  
    5959        var name = exportFileDialog.FileName;
    6060        using (BackgroundWorker bg = new BackgroundWorker()) {
    61           Progress.ShowMarquee(this, "Exportion solution to " + name + ".");
     61          Progress.Show(this, "Exportion solution to " + name + ".", ProgressMode.Indeterminate);
    6262          bg.DoWork += (o, a) => exporter.Export(Content, name);
    6363          bg.RunWorkerCompleted += (o, a) => Progress.Hide(this);
  • branches/2845_EnhancedProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/SymbolicRegressionSolutionView.cs

    r16311 r16317  
    6161        var name = exportFileDialog.FileName;
    6262        using (BackgroundWorker bg = new BackgroundWorker()) {
    63           Progress.ShowMarquee(this, "Exporting solution to " + name + ".");
     63          Progress.Show(this, "Exporting solution to " + name + ".", ProgressMode.Indeterminate);
    6464          bg.DoWork += (o, a) => exporter.Export(Content, name);
    6565          bg.RunWorkerCompleted += (o, a) => Progress.Hide(this);
  • branches/2845_EnhancedProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs

    r16314 r16317  
    154154      Content.ProblemDataChanged += Content_Changed;
    155155      treeChart.Repainted += treeChart_Repainted;
    156       Progress.AddProgressToView(grpSimplify, progress);
     156      Progress.AddProgressToControl(grpSimplify, progress);
    157157      progress.StopRequested += progress_StopRequested;
    158158    }
     
    162162      Content.ProblemDataChanged -= Content_Changed;
    163163      treeChart.Repainted -= treeChart_Repainted;
    164       Progress.RemoveProgressFromView(grpSimplify, false);
     164      Progress.RemoveProgressFromControl(grpSimplify, false);
    165165      progress.StopRequested -= progress_StopRequested;
    166166    }
  • branches/2845_EnhancedProgress/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionVariableImpactsView.cs

    r16311 r16317  
    158158      variableImactsArrayView.Caption = Content.Name + " Variable Impacts";
    159159
    160       Progress.ShowMarquee(this, "Calculating variable impacts for " + Content.Name);
     160      Progress.Show(this, "Calculating variable impacts for " + Content.Name, ProgressMode.Indeterminate);
    161161
    162162      Task.Factory.StartNew(() => {
  • branches/2845_EnhancedProgress/HeuristicLab.Problems.DataAnalysis.Views/3.4/MenuItems/ShrinkDataAnalysisRunsMenuItem.cs

    r16311 r16317  
    7373      IContentView activeView = (IContentView)MainFormManager.MainForm.ActiveView;
    7474      var content = activeView.Content;
    75       Progress.ShowMarquee(content, "Removing duplicate datasets.");
     75      Progress.Show(content, "Removing duplicate datasets.", ProgressMode.Indeterminate);
    7676
    7777      Action<IContentView> action = (view) => DatasetUtil.RemoveDuplicateDatasets(view.Content);
  • branches/2845_EnhancedProgress/HeuristicLab.Problems.Instances.Views/3.3/ProblemInstanceProviderViewGeneric.cs

    r16311 r16317  
    123123        var content = activeView.Content;
    124124        // lock active view and show progress bar
    125         Progress.ShowMarquee(content, "Loading problem instance.");
     125        Progress.Show(content, "Loading problem instance.", ProgressMode.Indeterminate);
    126126
    127127        Task.Factory.StartNew(() => {
  • branches/2845_EnhancedProgress/HeuristicLab.Scripting.Views/3.3/ScriptView.cs

    r16311 r16317  
    178178
    179179    private void AddProgressView(string progressMessage) {
    180       Progress.ShowMarquee(this, progressMessage);
     180      Progress.Show(this, progressMessage, ProgressMode.Indeterminate);
    181181      progressViewCreated = true;
    182182    }
Note: See TracChangeset for help on using the changeset viewer.