Пример #1
0
 private void btnAddPreset_Click(object sender, EventArgs e)
 {
     try
     {
         MouseClicker.InputBox iBox = new MouseClicker.InputBox("Define preset name", "My preset");
         if (iBox.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             Preset p = new Preset(iBox.Value, "", "", "");
             _presets.Add(p);
             DisplayPresets();
             cboPresets.SelectedItem = p;
             SavePresets();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #2
0
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 1)
            {
                FileInfo f = (FileInfo)listView1.SelectedItems[0].Tag;
                if (f != null)
                {
                    string destFile = f.FullName.Replace(_currentPreset.Destination, _currentPreset.Source);
                    string lastChar = destFile.Substring(destFile.Length - 1);
                    int val;
                    bool isNumeric = int.TryParse(lastChar, out val);

                    while (int.TryParse(destFile.Substring(destFile.Length - 1), out val))
                    {
                        destFile = destFile.Substring(0, destFile.Length - 1);
                    }
                    MouseClicker.InputBox ibox = new MouseClicker.InputBox("Copy file to :", destFile);
                    if (ibox.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        _watcher.EnableRaisingEvents = false;
                        destFile = ibox.Value;
                        f.CopyTo(destFile, true);
                        _watcher.EnableRaisingEvents = true;
                    }
                }
            }
        }