Ejemplo n.º 1
0
        public static void LoadFromSettings()
        {
            //cleaning:
            foreach (Watcher watcher in AllOfThem)
            {
                watcher.Dispose();
            }
            //AllOfThem.Clear();


            //Watcher testWatcher = new Watcher(Application.StartupPath, Application.StartupPath + "\\_jpg\\", "*.jpg|*.jpeg|*.gif|*.png|*.bmp");

            //loading:
            for (int i = 0; i < 64; i++)
            {
                try { Watcher newWatcher = new Watcher(Form1.MySettings.WatchPaths[i], Form1.MySettings.MovePaths[i], Form1.MySettings.Filters[i]); }
                catch { break; }
            }
        }
Ejemplo n.º 2
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            if (comboRules.SelectedIndex != -1)
            {
                if (!Directory.Exists(txtWatchPath.Text))
                {
                    MessageBox.Show("Watch directory " + txtWatchPath.Text + " doesn't exist.", "Something is wrong...", MessageBoxButtons.OK);
                }
                else if (!Directory.Exists(txtMovePath.Text))
                {
                    MessageBox.Show("Move directory " + txtMovePath.Text + " doesn't exist.", "Something is wrong...", MessageBoxButtons.OK);
                }
                else if (txtFilter.Text == "")
                {
                    MessageBox.Show("The filter is empty. Please enter filter. You can use \"*\" and \"?\" symbols. Separate filters by \",\" or \"|\".");
                }
                else
                {
                    ((ComboWatcherItem)comboRules.SelectedItem).Watcher.WatchPath = txtWatchPath.Text;
                    ((ComboWatcherItem)comboRules.SelectedItem).Watcher.MovePath  = txtMovePath.Text;
                    ((ComboWatcherItem)comboRules.SelectedItem).Watcher.Filter    = txtFilter.Text;
                    Watcher.SaveToSettings();

                    //black magic here:
                    ((ComboWatcherItem)comboRules.SelectedItem).Text = txtWatchPath.Text;
                    typeof(ComboBox).InvokeMember("RefreshItems", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.InvokeMethod, null, comboRules, new object[] { });
                }
            }

            if (chkStartup.Checked)
            {
                rkApp.SetValue("Ejik", Application.ExecutablePath.ToString());
            }
            else
            {
                rkApp.DeleteValue("Ejik", false);
            }

            Form1.LastInstance.SetTooltip();
        }
Ejemplo n.º 3
0
 public ComboWatcherItem(string text, Watcher watcher)
 {
     _text    = text;
     _watcher = watcher;
 }