Beispiel #1
0
        public ControlPrintToFax()
        {
            InitializeComponent();

            userSession = ActiveUserSession.GetInstance();
            userSession.ActingAsChanged += SelectedUserChanged;
        }
Beispiel #2
0
        public ControlFolderToDrive()
        {
            InitializeComponent();

            userSession = ActiveUserSession.GetInstance();
            userSession.ActingAsChanged += SelectedUserChanged;
        }
Beispiel #3
0
        public LoginForm(ActiveUserSession userSession)
        {
            InitializeComponent();

            this.userSession = userSession;

            InitBrowser();
        }
Beispiel #4
0
        public DrivePicker(ActiveUserSession userSession, string filename = null)
        {
            InitializeComponent();

            this.userSession = userSession;
            this.filename    = filename;

            InitBrowser();
        }
Beispiel #5
0
        public SendFax(ActiveUserSession userSession, string fileId)
        {
            InitializeComponent();

            this.userSession = userSession;
            this.fileId      = fileId;

            InitBrowser();
        }
Beispiel #6
0
        public MhwDesktopForm(Options options)
        {
            // Run windows generated form code.
            InitializeComponent();

            // Create our "FormClosing" event handler.
            FormClosing += MhwCloseRequested;

            accountsBindingSource = new BindingSource();
            userSession           = ActiveUserSession.GetInstance();

            controlPrintToDrive.NotificationService = this;
            controlPrintToDrive.UploadService       = this;

            controlFolderToDrive.NotificationService = this;
            controlFolderToDrive.UploadService       = this;

            controlPrintToFax.NotificationService = this;
            controlPrintToFax.UploadService       = this;

            this.options = options;
        }
Beispiel #7
0
        private async void MhwFormInitialize(object sender, EventArgs e)
        {
            bool runAtStartup = ActiveUserSession.GetSettings().RunAtStartup;

            if (options.AutoStarted && !runAtStartup)
            {
                Application.Exit();
                return;
            }

            // Load persisted settings values.
            LoadRunAtStartup(runAtStartup);

            // Make sure that standard and standard double clicks are enabled,
            // if they are not enabled, enable them. This really is OverKill but better to be
            // safe than sorry.
            if (!GetStyle(ControlStyles.StandardClick))
            {
                SetStyle(ControlStyles.StandardClick, true);
            }

            if (!GetStyle(ControlStyles.StandardDoubleClick))
            {
                SetStyle(ControlStyles.StandardDoubleClick, true);
            }

            faxTabIndex = tabs.TabPages.IndexOf(tabPagePrintToFax);

            // Main form event handlers.
            MouseClick       += MhwSingleClick;
            MouseDoubleClick += MhwDoubleClick;
            MouseDown        += MhwMouseDown;

            // NotifyIcon event handlers.
            trayIcon.MouseClick       += MhwSingleClick;
            trayIcon.MouseDoubleClick += MhwDoubleClick;
            trayIcon.MouseDown        += MhwMouseDown;

            aboutToolStripMenuItem.Click    += MenuAboutClicked;
            quitToolStripMenuItem.Click     += MenuQuitClicked;
            settingsToolStripMenuItem.Click += MenuSettingsClicked;

            MhwMinimizeToTray();

            Application.DoEvents();

            // SettingsForm Resize event handler.
            // NOTE: Must be after our initial display logic
            // otherwise if it was before, it will cause logic problems.
            Resize += FormResize;

            accountsBindingSource.DataSource = new BindingList <MhwAccount>();
            pictureBoxActingAs.DataBindings.Add("Image", accountsBindingSource, "ProfilePic", true);
            accountsComboBox.DataSource = accountsBindingSource;

            bool pinged = ActiveUserSession.PingApi();

            if (!pinged)
            {
                string domain        = ActiveUserSession.GetSettings().myHEALTHwareDomain;
                var    messageDialog = new MhwMessageForm("myHEALTHware",
                                                          string.Format("We're unable to reach {0} at this time.", domain),
                                                          true);
                messageDialog.ShowDialog(this);
                Application.Exit();
                return;
            }

            // Try the previous credentials.
            string connectionId = userSession.Settings.ConnectionId;
            string accessToken  = userSession.Settings.AccessToken;

            if (!string.IsNullOrEmpty(connectionId) && !string.IsNullOrEmpty(accessToken))
            {
                await ExecuteLogin(connectionId, accessToken);
            }
            if (!userSession.IsLoggedIn)
            {
                await ChangeLogin();
            }
            if (!userSession.IsLoggedIn)
            {
                LogOut();
            }

            UpdateLoginButtonText();
            RefreshTabControl();

            // We now at this point, are completely event driven.
        }