Ejemplo n.º 1
0
        /// <summary>
        /// Place WPF window on Taskbar
        /// </summary>
        /// <param name="control">WPF window to be placed on taskbar</param>
        /// <param name="initialWidth">Initial width</param>
        public void InsertPanel(TaskbarPanel panel)
        {
            if (_taskBarIcon != null)
            {
                RemovePanel();
            }

            _taskBarIcon = new TaskbarHost(panel);

            _taskBarIcon.SetTaskBarControl(panel);
            panel.SetTaskBarHost(_taskBarIcon);

            _taskBarIcon.Setup();
        }
Ejemplo n.º 2
0
        private void InitializeMainWindowAndTaskbarPanel()
        {
            _taskbarPanel = CreateTaskbarPanel(_mainViewModel, ServiceLocator.UiHelper);
            _mainWindow   = new MainWindow(_mainViewModel, _taskbarPanel);

            _taskbarPanel.ApplicationWindow = _mainWindow;
            _mainWindow.RegisterTaskbarCallbacks(_taskbarPanel);

            UpdateManager.Start(_mainWindow);
            AppSessionRefresher.Start(_mainWindow);

            _mainWindowReadyLatch.Unlock();

            if (!ServiceLocator.LocalStorage.IsLoadedFromFile)
            {
                ServiceLocator.UiHelper.PerformInUiThread(() => _mainWindow.Show());
                ResurrectBrowserWindows();
            }
        }
Ejemplo n.º 3
0
        private TaskbarPanel CreateTaskbarPanel(MainViewModel mainViewModel, IUiHelper uiHelper)
        {
            try
            {
                var taskbarPanel = new TaskbarPanel(_mainWindowReadyLatch, new NLogLogger("TaskbarPanel"), mainViewModel, uiHelper);
                taskbarPanel.InitializeButtons();

                return(taskbarPanel);
            }
            catch (Exception ex)
            {
                _log.ErrorException("Failed to initialize taskbar module", ex);
                uiHelper.ShowMessage(ex.ToString());
                uiHelper.IgnoreException(_instanceMutex.ReleaseMutex);
                _instanceMutex = null;
                Current.Shutdown();
                Environment.Exit(0);
            }

            return(null);
        }