コード例 #1
0
        /// <summary>
        /// Instantiates the Shell window.
        /// </summary>
        /// <returns>A new ShellWindow window.</returns>
        protected override DependencyObject CreateShell()
        {
            ///* This method sets the UnityBootstrapper.Shell property to the ShellWindow
            // * we declared elsewhere in this project. Note that the UnityBootstrapper base
            // * class will attach an instance of the RegionManager to the new Shell window. */

            this.Container.RegisterType <IDialogService, DialogService>(new ContainerControlledLifetimeManager());
            this.Container.RegisterType <IApplicationService, ApplicationService>(new ContainerControlledLifetimeManager());

            // Use the container to create an instance of the shell.
            ShellWindow view = this.Container.TryResolve <ShellWindow>();

            return(view);
        }
コード例 #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            Person person = new Person()
            {
                Name     = "Luke",
                Birthday = new DateTime(2080, 2, 6)
            };

            ShellWindow mainWindow = new ShellWindow();

            mainWindow.DataContext = person;
            mainWindow.Show();
        }
コード例 #3
0
        public void ResetPosition(bool displayChanged)
        {
            ShellWindow?.SetSize();

            DesktopOverlayWindow?.ResetPosition();

            if (displayChanged && DesktopWindow != null)
            {
                DestroyDesktopWindow();
                CreateDesktopWindow();
            }
            else
            {
                DesktopWindow?.ResetPosition();
            }
        }
コード例 #4
0
        private void CreateShellWindow()
        {
            if (Shell.IsCairoRunningAsShell && ShellWindow == null)
            {
                // create native shell window; we must pass a native window's handle to SetShellWindow
                ShellWindow = new ShellWindow();
                ShellWindow.WallpaperChanged += WallpaperChanged;
                ShellWindow.WorkAreaChanged  += WorkAreaChanged;

                if (ShellWindow.IsShellWindow)
                {
                    // we did it
                    CairoLogger.Instance.Debug("DesktopManager: Successfully set as shell window");
                }
            }
        }
コード例 #5
0
ファイル: ShellApi.cs プロジェクト: congzw/demo-cefsharp
        private void ChangePosition(ShellWindow one, ShellWindow another)
        {
            var left   = one.Left;
            var top    = one.Top;
            var width  = one.Width;
            var height = one.Height;

            one.Left   = another.Left;
            one.Top    = another.Top;
            one.Width  = another.Width;
            one.Height = another.Height;

            another.Left   = left;
            another.Top    = top;
            another.Width  = width;
            another.Height = height;
        }
コード例 #6
0
        public Ghost(IIntelligence intelligence, IParlance parlance, IDemeanor demeanor, BaloonWindow baloon, ShellWindow shell)
        {
            _intelligence = intelligence;
            _parlance     = parlance;
            _demeanor     = demeanor;
            _baloon       = baloon;
            _shell        = shell;

            _inputQueue.Dispatched  += InputDispatched;
            _outputQueue.Dispatched += OutputDispatched;
            _intelligence.Output    += IntelligenceOutput;
            _shell.ScreenChanged    += ShellScreenChanged;
            _shell.Rendered         += ShellRendered;

            _demeanor.Loaded(shell);
            _intelligence.Loaded();
        }
コード例 #7
0
 private void Services_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     //if statement to prevent endless loop caused by UnselectAll() causing a slectionChanged event
     if (services.SelectedItem != null)
     {
         //Might be changed to page with navigation in frame
         ServiceEditView SEV    = new ServiceEditView();
         ShellWindow     window = new ShellWindow();
         window.WindowState = WindowState.Normal;
         window.Content     = SEV;
         window.ShowDialog();
         window.Height = 450;
         window.Width  = 900;
         services.UnselectAll();
         //Unselect current item so that a selection changed does not happen again
         //when exiting and re-entering the find customer page
     }
 }
コード例 #8
0
ファイル: ShellViewModel.cs プロジェクト: michelav/HandBrake
 /// <summary>
 /// Change the page displayed on this window.
 /// </summary>
 /// <param name="window">
 /// The window.
 /// </param>
 public void DisplayWindow(ShellWindow window)
 {
     if (window == ShellWindow.MainWindow)
     {
         this.ShowMainWindow = true;
         this.ShowOptions    = false;
     }
     else if (window == ShellWindow.OptionsWindow)
     {
         this.ShowOptions    = true;
         this.ShowMainWindow = false;
     }
     else
     {
         this.ShowMainWindow = true;
         this.ShowOptions    = false;
     }
 }
コード例 #9
0
 private void machines_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     //if statement to prevent endless loop caused by UnselectAll() causing a slectionChanged event
     if (machines.SelectedItem != null)
     {
         //Might be changed to page with navigation in frame
         OrderCreateViewModel CEV    = new OrderCreateViewModel();
         ShellWindow          window = new ShellWindow();
         window.WindowState           = WindowState.Normal;
         window.Content               = CEV;
         window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
         window.ShowDialog();
         window.Height = 450;
         window.Width  = 900;
         machines.UnselectAll();
         //Unselect current item so that a selection changed does not happen again
         //when exiting and re-entering the find customer page
     }
 }
コード例 #10
0
        protected override Window EnsureWindow(FrameworkElement view, bool isDialog)
        {
            if (view == null)
            {
                throw new ArgumentNullException(nameof(view));
            }

            if (!(view is Window window))
            {
                window = new ShellWindow()
                {
                    DataContext   = view.DataContext,
                    Content       = view,
                    SizeToContent = isDialog ? SizeToContent.WidthAndHeight : SizeToContent.Manual,
                    ResizeMode    = isDialog ? ResizeMode.NoResize : ResizeMode.CanResize,
                };
            }

            return(window);
        }
コード例 #11
0
        public WhisperTrayAgent(ShellWindow shellWindow, SettingsWindowManager settingsManager)
        {
            _shellWindow     = shellWindow;
            _settingsManager = settingsManager;

            _noticon = new NotifyIcon
            {
                BalloonTipText  = "Whisper is still running. Shhh!",
                BalloonTipTitle = "Whisper",
                Text            = "Whisper",
                Icon            = new Icon("WhisperIcon.ico")
            };

            _noticon.DoubleClick += (sender, e) => { RestoreApplication(); };

            _noticon.ContextMenu = new ContextMenu(new[]
            {
                new MenuItem("Restore", (sender, e) => { RestoreApplication(); }),
                new MenuItem("-"),
                //new MenuItem("Generators", ),
                new MenuItem("-"),
                new MenuItem("Settings", (sender, e) => { ShowSettings(); }),
                new MenuItem("Exit", (sender, e) => { CloseApplication(); })
            });

            shellWindow.SetNotificationTrayMinimiseAction(() => MinimiseApplication());

            shellWindow.IsVisibleChanged += (sender, e) =>
            {
                var isVisible = (bool)e.NewValue;

                if (isVisible)
                {
                    DismissTray();
                }
            };
        }
コード例 #12
0
 /// <summary>
 /// Change the page displayed on this window.
 /// </summary>
 /// <param name="window">
 /// The window.
 /// </param>
 public void DisplayWindow(ShellWindow window)
 {
     if (window == ShellWindow.MainWindow)
     {
         this.ShowMainWindow = true;
         this.ShowOptions = false;
         this.ShowInstant = false;
     }
     else if (window == ShellWindow.OptionsWindow)
     {
         this.ShowOptions = true;
         this.ShowMainWindow = false;
         this.ShowInstant = false;
     }
     else if (window == ShellWindow.InstantMainWindow)
     {
         this.ShowInstant = true;
         this.ShowOptions = false;
         this.ShowMainWindow = false;
     }
     else
     {
         this.ShowMainWindow = true;
         this.ShowOptions = false;
         this.ShowInstant = false;
     }
 }
コード例 #13
0
        /// <summary>
        /// Crea la ventana principal de aplicación.
        /// </summary>
        /// <returns>
        /// Instancia creada de la ventana principal de aplicación.
        /// </returns>
        protected override DependencyObject CreateShell()
        {
            var shell = new ShellWindow();

            return(shell);
        }
コード例 #14
0
        public string DownloadFromOrderUrl(string orderUrl, string destPath)
        {
            var decoded     = HttpUtilityFromMono.UrlDecode(orderUrl);
            var bucketStart = decoded.IndexOf(_s3Client.BucketName, StringComparison.InvariantCulture);

            if (bucketStart == -1)
            {
#if DEBUG
                if (decoded.StartsWith(("BloomLibraryBooks")))
                {
                    Palaso.Reporting.ErrorReport.NotifyUserOfProblem(
                        "The book is from bloomlibrary.org, but you are running the DEBUG version of Bloom, which can only use dev.bloomlibrary.org.");
                }
                else
                {
                    throw new ApplicationException("Can't match URL of bucket of the book being downloaded, and I don't know why.");
                }
#else
                if (decoded.StartsWith(("BloomLibraryBooks-Sandbox")))
                {
                    Palaso.Reporting.ErrorReport.NotifyUserOfProblem(
                        "The book is from the testing version of the bloomlibrary, but you are running the RELEASE version of Bloom. The RELEASE build cannot use the 'dev.bloomlibrary.org' site. If you need to do that for testing purposes, set the windows Environment variable 'BloomSandbox' to 'true'.", decoded);
                }
                else
                {
                    throw new ApplicationException(string.Format("Can't match URL of bucket of the book being downloaded {0}, and I don't know why.", decoded));
                }
#endif
                return(null);
            }

            var    s3orderKey = decoded.Substring(bucketStart + _s3Client.BucketName.Length + 1);
            string url        = "unknown";
            string title      = "unknown";
            try
            {
                var metadata = BookMetaData.FromString(_s3Client.DownloadFile(s3orderKey));
                url   = metadata.DownloadSource;
                title = metadata.Title;
                if (_progressDialog != null)
                {
                    _progressDialog.Invoke((Action)(() => { _progressDialog.Progress = 1; }));
                }
                // downloading the metadata is considered step 1.
                var destinationPath = DownloadBook(metadata.DownloadSource, destPath);
                LastBookDownloadedPath = destinationPath;

                Analytics.Track("DownloadedBook-Success",
                                new Dictionary <string, string>()
                {
                    { "url", url }, { "title", title }
                });
                return(destinationPath);
            }
            catch (WebException e)
            {
                DisplayNetworkDownloadProblem(e);
                Analytics.Track("DownloadedBook-Failure",
                                new Dictionary <string, string>()
                {
                    { "url", url }, { "title", title }
                });
                Analytics.ReportException(e);
                return("");
            }
            catch (AmazonServiceException e)
            {
                DisplayNetworkDownloadProblem(e);
                Analytics.Track("DownloadedBook-Failure",
                                new Dictionary <string, string>()
                {
                    { "url", url }, { "title", title }
                });
                Analytics.ReportException(e);
                return("");
            }
            catch (Exception e)
            {
                ShellWindow.Invoke((Action)(() =>
                                            Palaso.Reporting.ErrorReport.NotifyUserOfProblem(e,
                                                                                             LocalizationManager.GetString("PublishTab.Upload.DownloadProblem",
                                                                                                                           "There was a problem downloading your book. You may need to restart Bloom or get technical help."))));
                Analytics.Track("DownloadedBook-Failure",
                                new Dictionary <string, string>()
                {
                    { "url", url }, { "title", title }
                });
                Analytics.ReportException(e);
                return("");
            }
        }
コード例 #15
0
 private void openShellWindow(OpenSimulationMessage message)
 {
     ShellWindow shellwindow = new ShellWindow(message);
     shellwindow.Show();
 }
コード例 #16
0
        /// <summary>
        /// Obtiene la referencia al ViewModel asociado a la barra de herramientas actual.
        /// </summary>
        /// <returns>
        /// La referencia al ViewModel asociado a la barra de herramientas actual.
        /// </returns>
        public static ToolbarViewModel GetCurrentToolbarViewModel()
        {
            ShellWindow shell = (ShellWindow)System.Windows.Application.Current.MainWindow;

            return((ToolbarViewModel)shell.ApplicationRibbon.DataContext);
        }
コード例 #17
0
        protected override async void OnStartup(StartupEventArgs e)
        {
            _applicationInstance = new WhisperApplication();

            // Initialise the application instance.
            using (var splash = new SplashWindow(_applicationInstance.InitialisationProgress))
            {
                splash.Show();

                var timer = System.Diagnostics.Stopwatch.StartNew();
                await _applicationInstance.InitialiseApplication();

                timer.Stop();

                var delayDelta = (int)(1000 - timer.ElapsedMilliseconds);

                if (delayDelta > 0)
                {
                    await Task.Delay(delayDelta);
                }


                Locator.CurrentMutable.Register(() => new CreateItemView(), typeof(IViewFor <CreateItemViewModel>));
                Locator.CurrentMutable.Register(() => new HistoryListItemView(), typeof(IViewFor <HistoryListItemViewModel>));
                Locator.CurrentMutable.Register(() => new HistoryListView(), typeof(IViewFor <HistoryListViewModel>));

                Locator.CurrentMutable.Register(() => new SettingsPageAboutView(), typeof(IViewFor <SettingsPageAboutViewModel>));
                Locator.CurrentMutable.Register(() => new SettingsPageApplicationView(), typeof(IViewFor <SettingsPageApplicationViewModel>));
                Locator.CurrentMutable.Register(() => new SettingsPageGeneralView(), typeof(IViewFor <SettingsPageGeneralViewModel>));
                Locator.CurrentMutable.Register(() => new SettingsPageGenerationView(), typeof(IViewFor <SettingsPageGenerationViewModel>));
                Locator.CurrentMutable.Register(() => new SettingsPageGenerationItemView(), typeof(IViewFor <SettingsPageGenerationItemViewModel>));

                Func <SettingsWindow> settingsWindowFactory = () =>
                {
                    var settingsWindow = new SettingsWindow();

                    var settingsVm = new SettingsWindowViewModel(new List <SettingsPageViewModelBase>
                    {
                        new SettingsPageAboutViewModel(_applicationInstance.AppInfoService),
                        new SettingsPageGeneralViewModel(_applicationInstance.ConfigService),
                        //new SettingsPageApplicationViewModel(),
                        new SettingsPageGenerationViewModel(_applicationInstance.ConfigService, _applicationInstance.GeneratorService)
                    });

                    settingsWindow.ViewModel = settingsVm;

                    return(settingsWindow);
                };

                var settingsManager = new SettingsWindowManager(settingsWindowFactory);

                var shellWindowViewModel = new ShellWindowViewModel(_applicationInstance.ConfigService, new CreateItemViewModel(_applicationInstance.ConfigService, _applicationInstance.GeneratorService, _applicationInstance.ClipboardService), new HistoryListViewModel(_applicationInstance.GeneratorService, _applicationInstance.ClipboardService), settingsManager);

                // Fix this bat-shit nonsense.
                Locator.CurrentMutable.UnregisterAll <IPropertyBindingHook>();
                Locator.CurrentMutable.Register <IPropertyBindingHook>(() => new BindingHookFixerer());

                var shell = new ShellWindow
                {
                    ViewModel = shellWindowViewModel
                };

                var trayIcon = new WhisperTrayAgent(shell, settingsManager);
                _applicationDisposables.Add(trayIcon);

                splash.Hide();
                splash.Close();

                shell.Show();
            }

            base.OnStartup(e);
        }