Ejemplo n.º 1
0
 public TaskForm(ref Task taskObject) {
     InitializeComponent();
     TaskObject = taskObject;
     TaskIsLoaded = true;
     this.Text = "Task : " + TaskObject.Name;
     TaskName.Text = TaskObject.Name;
     SourceFolder.Text = TaskObject.Source.FullName;
     DestinationFolder.Text = TaskObject.Destination.FullName;
     TaskIDLabel.Text = "ID : " + TaskObject.ID.ToString();
     PerformTypeComboBox.SelectedItem = TaskObject.PerformType.ToString();
     RegexTextBox.Text = TaskObject.NameRegex.ToString();
     FileNameTB.Text = TaskObject.Format;
     CreateTaskbtn.Text = "Save Task";
     DeleteTaskButton.Visible = true;
     LoadedExtensionsList = new List<string>(TaskObject.ExtensionRegex.ToString().Replace(")", "").Replace("(", "").Split('|'));
     FileTypeCB.SelectedIndex = TaskObject.FileTypeIndex;
     TaskEnabledCheckBox.Checked = TaskObject.Enabled;
 }
Ejemplo n.º 2
0
 public void Initialize(ref Task taskObject) {
     TaskObject = taskObject;
     IDString = "ID : " + TaskObject.ID.ToString();
     PerformString = "Perform : " + TaskObject.PerformType;
     SourceString = "Source : " + PathFormatter.FormatPath(TaskObject.Source.FullName, 64);
     DestinationString = "Destination : " + PathFormatter.FormatPath(TaskObject.Destination.FullName, 64);
     Initialized = false;
     Running = false;
 }
Ejemplo n.º 3
0
 public TaskRunnerButton(ref Task taskObject) {
     Initialize(ref taskObject);
 }
Ejemplo n.º 4
0
 private void CreateTaskbtn_Click(object sender, EventArgs e) {
     if (TaskName.Text == "") {
         MessageBox.Show("TaskForm Name cannot be empty!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     } else if (SourceFolder.Text == "") {
         MessageBox.Show("Source Folder cannot be empty!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     } else if (DestinationFolder.Text == "") {
         MessageBox.Show("Destination Folder cannot be empty!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     } else if (RegexTextBox.Text == "") {
         MessageBox.Show("File Name Regex cannot be empty!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     } else if (FileNameTB.Text == "") {
         MessageBox.Show("File Name Format cannot be empty!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     } else {
         List<CheckBox> TypeCheckBoxList = (FileExtensionDisplayFLP.Controls.OfType<CheckBox>()).Where(cO => cO.Checked == true).ToList();
         int TypeCheckBoxListCount = TypeCheckBoxList.Count();
         if (TypeCheckBoxListCount > 0) {
             StringBuilder AttributeMatchBuilder = new StringBuilder(), ExtensionBuilder = new StringBuilder();
             ExtensionBuilder.Append("(");
             int i = 0, LastIndex = TypeCheckBoxListCount - 1;
             for (; i < TypeCheckBoxListCount; i++)
                 if (i != LastIndex) ExtensionBuilder.Append(TypeCheckBoxList[i].Text + "|");
                 else ExtensionBuilder.Append(TypeCheckBoxList[i].Text + ")");
             IEnumerable<TextBox> TextBoxList = FileAttributeFLP.Controls.OfType<TextBox>().Where(tO => tO.Enabled == true);
             foreach (TextBox TextBoxObject in TextBoxList) AttributeMatchBuilder.Append(TextBoxObject.Tag + "?" + TextBoxObject.Text + "|");
             TaskObject = new Task(TaskIsLoaded ? TaskObject.ID : Options.LastTaskID, TaskName.Text, SourceFolder.Text, DestinationFolder.Text, ExtensionBuilder.ToString(), RegexTextBox.Text,
                 AttributeMatchBuilder.ToString(), FileNameTB.Text, PerformTypeComboBox.SelectedItem.ToString().ToLower(), FileTypeCB.SelectedIndex, TaskEnabledCheckBox.Checked);
             Close();
         } else {
             MessageBox.Show("File Types cannot be empty!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }