コード例 #1
0
ファイル: MainForm.cs プロジェクト: sbreitf1/quick-hash
        private void MainForm_Load(object sender, EventArgs e)
        {
            this.cbxSendTo.Left = btnClose.Left - cbxSendTo.Width - 12;
            this.MinimumSize    = new Size(cbxHashEncoding.Right + cbxSendTo.Width + btnClose.Width + 48, this.Height);
            this.MaximumSize    = new Size(int.MaxValue, this.Height);

            this.cbxHashEncoding.SelectedIndex = Settings.Default.SelectedEncoding;

            this.ignoreCheckedChange = true;
            this.cbxSendTo.Checked   = ShortcutManager.ShortcutExists(Environment.SpecialFolder.ApplicationData, "Microsoft\\Windows\\SendTo", "Quick Hash");
            this.ignoreCheckedChange = false;

            string[] args = Environment.GetCommandLineArgs();
            if (args.Length > 1)
            {
                SelectFile(args[1]);
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: sbreitf1/quick-hash
        private void cbxSendTo_CheckedChanged(object sender, EventArgs e)
        {
            if (this.ignoreCheckedChange)
            {
                return;
            }

            if (cbxSendTo.Checked)
            {
                ShortcutManager.CreateShortcut(Environment.SpecialFolder.ApplicationData, "Microsoft\\Windows\\SendTo", "Quick Hash", Environment.GetCommandLineArgs()[0]);
            }
            else
            {
                ShortcutManager.DeleteShortcut(Environment.SpecialFolder.ApplicationData, "Microsoft\\Windows\\SendTo", "Quick Hash");
            }

            // maybe there were errors...
            this.ignoreCheckedChange = true;
            this.cbxSendTo.Checked   = ShortcutManager.ShortcutExists(Environment.SpecialFolder.ApplicationData, "Microsoft\\Windows\\SendTo", "Quick Hash");
            this.ignoreCheckedChange = false;
        }