Exemplo n.º 1
0
 private void RunActionFlow(ActionFlow flow, bool notifyDone)
 {
     try
     {
         using (Utils.FrameworkDataUpdater upd = new Utils.FrameworkDataUpdater(Core))
         {
             //flows can call eachother, initialize them all
             foreach (ActionFlow af in _actionFlows)
             {
                 foreach (ActionImplementation ai in af.Actions)
                 {
                     ai.PrepareRun();
                 }
             }
             //find start and run
             ActionStart startAction = (from a in flow.Actions where a is ActionStart select a).FirstOrDefault() as ActionStart;
             if (notifyDone)
             {
                 //first start
                 startAction.PrepareFlow();
             }
             foreach (Framework.Data.Geocache gc in Core.Geocaches)
             {
                 startAction.Run(gc);
             }
             //wrap up
             foreach (ActionFlow af in _actionFlows)
             {
                 foreach (ActionImplementation ai in af.Actions)
                 {
                     ai.FinalizeRun();
                 }
             }
         }
         if (notifyDone && PluginSettings.Instance.ShowFlowCompletedMessage)
         {
             using (ExecutionCompletedForm dlg = new ExecutionCompletedForm())
             {
                 dlg.ShowDialog();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 2
0
 private void RunActionFlow(ActionFlow flow, bool notifyDone)
 {
     try
     {
         using (Utils.FrameworkDataUpdater upd = new Utils.FrameworkDataUpdater(Core))
         {
             //flows can call eachother, initialize them all
             foreach (ActionFlow af in _actionFlows)
             {
                 foreach (ActionImplementation ai in af.Actions)
                 {
                     ai.PrepareRun();
                 }
             }
             //find start and run
             ActionStart startAction = (from a in flow.Actions where a is ActionStart select a).FirstOrDefault() as ActionStart;
             if (notifyDone)
             {
                 //first start
                 startAction.PrepareFlow();
             }
             foreach (Framework.Data.Geocache gc in Core.Geocaches)
             {
                 startAction.Run(gc);
             }
             //wrap up
             foreach (ActionFlow af in _actionFlows)
             {
                 foreach (ActionImplementation ai in af.Actions)
                 {
                     ai.FinalizeRun();
                 }
             }
         }
         if (notifyDone && PluginSettings.Instance.ShowFlowCompletedMessage)
         {
             using (ExecutionCompletedForm dlg = new ExecutionCompletedForm())
             {
                 dlg.ShowDialog();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }