Esempio n. 1
0
 public cropperForm(mainForm frm)
 {
     InitializeComponent();
     // for smoother drawing of the form...
     DoubleBuffered = true;
     ths = frm;
 }
Esempio n. 2
0
        public mainForm()
        {
            InitializeComponent();
            staticVar = this;
            if (fallyGrab.Properties.Settings.Default.saveLocation != "")
                ssfolder = fallyGrab.Properties.Settings.Default.saveLocation;
            else ssfolder = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
            if (ssfolder.Substring(ssfolder.Length - 1, 1) == @"\")
                ssfolder = ssfolder.Substring(0, ssfolder.Length - 2);
            // do not show
            this.Hide();
            // register the event that is fired after the key press.
            hook.KeyPressed += new EventHandler<KeyPressedEventArgs>(hook_KeyPressed);
            // register the control + alt + F12 combination as hot key.
            hook.RegisterHotKey((ModifierKeys)2 | (ModifierKeys)4, Properties.Settings.Default.keyShortcut);
            hook.RegisterHotKey((ModifierKeys)2 | (ModifierKeys)4, Properties.Settings.Default.keyShortcut2);
            // get appdata path
            string appdatapath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            // check if fallygrab folder exists in appdata and create if not
            if (!Directory.Exists(appdatapath + @"\fallyGrab"))
                Directory.CreateDirectory(appdatapath + @"\fallyGrab");
            // check if database file exists in the fallyGrab folder and if not, copy it from the current location
            if (!File.Exists(appdatapath + @"\fallyGrab\fallygrab.s3db"))
                File.Copy("fallygrab.s3db",appdatapath+@"\fallyGrab\fallygrab.s3db");
            // windows startup
            string shortcutName = string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "\\Andrei Neamtu\\fallyGrab\\fallyGrab.appref-ms");
            RegistryKey rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
            if (fallyGrab.Properties.Settings.Default.startup == 1)
            {
                if (rkApp.GetValue("fallyGrab") == null)
                    rkApp.SetValue("fallyGrab", shortcutName);

                else
                {
                    rkApp.DeleteValue("fallyGrab", false);
                    rkApp.SetValue("fallyGrab", shortcutName);
                }
            }
            else
            {
                if (rkApp.GetValue("fallyGrab") != null)
                    rkApp.DeleteValue("fallyGrab", false);
            }
            rkApp.Close();
        }