private void loadFlowSeqeunces()
        {
            if (!string.IsNullOrEmpty(Settings.Settings.Default.FlowSequencesXml))
            {
                try
                {
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(Settings.Settings.Default.FlowSequencesXml);

                    XmlNodeList nl = doc.SelectNodes("/sequences/sequence");
                    foreach (XmlNode n in nl)
                    {
                        var af = new FlowSequence();
                        af.Name = n.Attributes["name"].Value;
                        af.Database = n.Attributes["database"].Value;
                        af.FlowSequenceItems = new ObservableCollection<FlowSequenceItem>();

                        XmlNodeList al = n.SelectNodes("flow");
                        foreach (XmlNode a in al)
                        {
                            var obj = new FlowSequenceItem();
                            obj.FlowName = a.Attributes["name"].Value;
                            obj.Database = a.Attributes["database"].Value;
                            af.FlowSequenceItems.Add(obj);
                        }
                        FlowSequences.Add(af);
                    }

                }
                catch
                {
                }
            }
        }
Exemple #2
0
        private void newDialog_DialogClosed(object sender, EventArgs e)
        {
            inputDialog.DialogClosed -= newDialog_DialogClosed;
            if (inputDialog.DialogResult)
            {
                if ((from a in FlowSequences.Manager.Instance.FlowSequences where string.Compare(a.Name, inputDialog.InputText, true) == 0 select a).Count() == 0)
                {
                    var fs = new FlowSequence();
                    fs.Name     = inputDialog.InputText;
                    fs.Database = "";

                    FlowSequences.Manager.Instance.FlowSequences.Add(fs);
                    SelectedFlowSequence = fs;
                }
            }
        }
 public async Task RunFowSequence(FlowSequence fs)
 {
     await Task.Run(() =>
     {
         var sw = new System.Diagnostics.Stopwatch();
         sw.Start();
         try
         {
             string defaultFlowDatabasePath = null;
             if (string.IsNullOrEmpty(fs.Database))
             {
                 defaultFlowDatabasePath = System.IO.Path.Combine(Settings.Settings.Default.DatabaseFolderPath, Settings.Settings.Default.SelectedDatabase, "sqlite.db3");
             }
             else
             {
                 defaultFlowDatabasePath = System.IO.Path.Combine(Settings.Settings.Default.DatabaseFolderPath, fs.Database, "sqlite.db3");
             }
             if (System.IO.File.Exists(defaultFlowDatabasePath))
             {
                 foreach (var sq in fs.FlowSequenceItems)
                 {
                     string fn = null;
                     if (string.IsNullOrEmpty(sq.Database))
                     {
                         fn = defaultFlowDatabasePath;
                     }
                     else
                     {
                         fn = System.IO.Path.Combine(Settings.Settings.Default.DatabaseFolderPath, sq.Database, "sqlite.db3");
                     }
                     var af = (from a in UIControls.ActionBuilder.Manager.Instance.ActionFlows where string.Compare(a.Name, sq.FlowName, true) == 0 select a).FirstOrDefault();
                     if (af != null)
                     {
                         using (var db = new Database.DBConSqlite(fn))
                         {
                             UIControls.ActionBuilder.Manager.Instance.RunFlow(af, db);
                         }
                     }
                 }
             }
             sw.Stop();
             ApplicationData.Instance.StatusText = string.Format(Localization.TranslationManager.Instance.Translate("FlowSequenceFinishedIn") as string, fs.Name, sw.Elapsed.TotalSeconds.ToString("0.0"));
         }
         catch (Exception e)
         {
             sw.Stop();
             ApplicationData.Instance.StatusText = string.Format("{0}: {1}", Localization.TranslationManager.Instance.Translate("Error"), e.Message);
         }
     });
 }