Ejemplo n.º 1
0
 /// <summary>
 /// The action control running event handler.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="item">Action folder being run</param>
 /// <param name="running">The running flag.</param>
 private void actionControl_Running(object sender, ActionFolder item, bool running)
 {
     string scriptName = Path.GetFileName(item.ScriptLocation);
     if (running)
     {
         this.trayIcon.ShowBalloonTip(int.MaxValue, scriptName, scriptName + " is being run.", ToolTipIcon.Info);
     }
     else
     {
         this.trayIcon.ShowBalloonTip(5000, scriptName, scriptName + " is done running", ToolTipIcon.Info);
     }
 }
Ejemplo n.º 2
0
 /// <summary>Creates an action folder</summary>
 /// <param name="item">Action folder item to create</param>
 public void Insert(ActionFolder item)
 {
     string txtSQLQuery =
         "insert into actionFolders (Folder, FileType, ScriptLocation, JsonConfigs, Type, Active) values ('"
         + item.Folder + "', '" + item.FileType + "', '" + item.ScriptLocation + "', '" + item.JsonConfigs
         + "', '" + item.Type + "', '" + item.Active + "')";
     this.ExecuteQuery(txtSQLQuery);
 }
Ejemplo n.º 3
0
 /// <summary>Update an action folder</summary>
 /// <param name="item">Item to update</param>
 /// <returns>The <see cref="IList"/>.</returns>
 public void UpdateActionFolder(ActionFolder item)
 {
     string txtSQLQuery = "update actionFolders set " +
                          "Folder = '" + item.Folder + "'," + "FileType = '" + item.FileType + "',"
                          + "ScriptLocation = '" + item.ScriptLocation + "'," + "JsonConfigs = '" + item.JsonConfigs
                          + "'," + "Type = '" + item.Type + "'," + "Active = '" + item.Active + "' where Id = "
                          + item.Id;
     this.ExecuteQuery(txtSQLQuery);
 }
Ejemplo n.º 4
0
        /// <summary>Adds an action folder both into the xml file and into the file system watching mechanism
        ///     This method removes an Action Folder if one currently exists for a path/file type combo.</summary>
        /// <param name="item">What item to add</param>
        public void AddActionFolder(ActionFolder item)
        {
            // Remove the item if it currently exists.
            ActionFolder existingItem = this.ActionFolders.FirstOrDefault(x => x.Folder == item.Folder && x.FileType == item.FileType);
            if (existingItem != null)
            {
                this.ActionFolders.Remove(existingItem);
            }

            // Create a new item
            var tempFileSystemWatcher = new FileSystemWatcher { Path = item.Folder, Filter = item.FileType, EnableRaisingEvents = true };
            tempFileSystemWatcher.Created += this.FileSystemWatcherCreated;
            tempFileSystemWatcher.Renamed += this.FileSystemWatcherCreated;

            item.FileSystemWatcher = tempFileSystemWatcher;

            // Add it into the watch of the system
            this.actionFolders.Add(item);

            // Also save down to the XML file
            this.actionFolderDAL.Insert(item);
        }