コード例 #1
0
        public MainForm(Mutex mutex)
        {
            _sharer           = new Sharer();
            _openWithListener = new OpenWithListener();
            _mutex            = mutex;
            _uploadCancellationTokenSource = new CancellationTokenSource();
            ToastHelper.TryCreateShortcut(Sharer.Me);

            // start listener in separate thread
            Task.Run(() => _openWithListener.Start(filePath => {
                try {
                    UploadPath(filePath, this, CancellationToken.None).Wait();
                    return(true);
                } catch (Exception ex) {
                    MessageBox.Show(ex.ToString());
                    return(true);
                }
            }));

            InitializeComponent();
            _icon = this.notifyIcon1.Icon;
            this.notifyIcon1.ContextMenuStrip = BuildContextMenuStrip();
            SetupContextMenuStrip(
                out _contextMenuUploadCancelled,
                out _contextMenuUploadFinished
                );
        }
コード例 #2
0
ファイル: AuthForm.cs プロジェクト: ewgraf/Sharer.Client
        public AuthForm(Sharer sharer, Account account)
        {
            _sharer = sharer;
            Account = account;

            InitializeComponent();
        }