コード例 #1
0
        public static void Main()
        {
            if (SingleInstance.InitializeAsFirstInstance("Fishbowl"))
            {
                var splash = new SplashScreen
                {
                    ImageFileName             = SplashScreenOverlay.CustomSplashPath,
                    ResourceAssembly          = Assembly.GetEntryAssembly(),
                    ResourceName              = "resources/images/splash.png",
                    CloseOnMainWindowCreation = true,
                };

                splash.Show();

                BlackBox.DoctorWilson.InitializeReporting();
                BlackBox.DoctorWilson.Preamble = @"Something happened to Fishbowl that it wasn't expecting.
What follows is some information that would be helpful to the developer
to fix the issue.  It would be great if you could paste the content of this
file to http://fishbowl.codeplex.com/workitem/list/basic, along with a brief
description of what you were doing.

Thanks!
";

                var application = new FacebookClientApplication();

                application.InitializeComponent();
                application.Run();

                // Allow single instance code to perform cleanup operations
                SingleInstance.Cleanup();
            }
        }
コード例 #2
0
        private void _OnApplicationUpdated(object sender, EventArgs e)
        {
            var restartLink = new Hyperlink(new Run("Click here"));

            restartLink.Click += (sender2, e2) =>
            {
                FacebookClientApplication.ClearUserState();
                ApplicationCommands.InitiateRestartCommand.Execute(this);
            };

            _ShowGoldBar(true, new Inline[]
            {
                new Run("Fishbowl has been updated. "),
                restartLink,
                new Run(" to restart.")
            });
        }
コード例 #3
0
        public MiniModeWindow()
        {
            InitializeComponent();

            this.Topmost = Settings.Default.KeepMiniModeWindowOnTop;

            // When the window loses focus take it as an opportunity to trim our workingset.
            Deactivated += (sender, e) => FacebookClientApplication.PerformAggressiveCleanup();

            SourceInitialized += (sender, e) =>
            {
                IntPtr hwnd = new WindowInteropHelper(this).Handle;

                // Add back WS_THICKFRAME to get the glass border.
                _ModifyStyle(hwnd, 0, WS.THICKFRAME);

                _TryExtendGlass(hwnd);
                _SetDwmAttributes(hwnd);

                IntPtr hmenu = NativeMethods.GetSystemMenu(hwnd, false);
                Assert.IsNotDefault(hmenu);

                NativeMethods.RemoveMenu(hmenu, SC.MAXIMIZE, MF.BYCOMMAND);
                NativeMethods.RemoveMenu(hmenu, SC.MINIMIZE, MF.BYCOMMAND);
                NativeMethods.RemoveMenu(hmenu, SC.SIZE, MF.BYCOMMAND);

                NativeMethods.DrawMenuBar(hwnd);

                HwndSource.FromHwnd(hwnd).AddHook(_WndProc);
            };

            this.InputBindings.Add(new InputBinding(MediaCommands.NextTrack, new KeyGesture(Key.Right)));
            this.InputBindings.Add(new InputBinding(MediaCommands.PreviousTrack, new KeyGesture(Key.Left)));
            this.CommandBindings.Add(new CommandBinding(MediaCommands.TogglePlayPause, _OnPlayPauseCommandExecuted, _OnPlayPauseCommandCanExecute));
            this.CommandBindings.Add(new CommandBinding(MediaCommands.Pause, _OnPauseCommandExecuted, _OnPauseCommandCanExecute));
            this.CommandBindings.Add(new CommandBinding(MediaCommands.Play, _OnResumeCommandExecuted, _OnResumeCommandCanExecute));
            this.CommandBindings.Add(new CommandBinding(MediaCommands.NextTrack, _OnNextSlideCommandExecuted, _OnNextSlideCommandCanExecute));
            this.CommandBindings.Add(new CommandBinding(MediaCommands.PreviousTrack, _OnPreviousSlideCommandExecuted, _OnPreviousSlideCommandCanExecute));
        }
コード例 #4
0
 public void SignOut()
 {
     FacebookClientApplication.ClearUserState();
     ApplicationCommands.InitiateRestartCommand.Execute(this);
 }
コード例 #5
0
        public MainWindow()
        {
            ServiceProvider.Initialize(FacebookClientApplication.FacebookApiId, FacebookClientApplication.FacebookApiKey, FacebookClientApplication.BingApiKey, Environment.GetCommandLineArgs(), Dispatcher);
            ServiceProvider.GoneOnline += (sender, e) =>
            {
                IsOnline = true;
                ServiceProvider.ViewManager.Friends.CollectionChanged += _OnFriendsHasCount;
            };

            ServiceProvider.ViewManager.PropertyChanged             += _OnViewManagerPropertyChanged;
            ServiceProvider.ViewManager.ExternalNavigationRequested += _OnExternalNavigationRequested;

            Loaded += (sender, e) =>
            {
                ServiceProvider.ViewManager.NavigationCommands.NavigateLoginCommand.Execute(null);

                if (FacebookClientApplication.Current2.IsFirstRun)
                {
                    FacebookClientApplication.Current2.IsFirstRun = false;
                }
            };

            SourceInitialized += (sender, e) =>
            {
                // Defer starting the update timer until the Window is up, but not until the application is online.
                // We want to make sure that the user is able to update the app if there's a fix available for an issue that
                // was preventing them from connecting to the service.
                DeploymentManager.ApplicationUpdated      += _OnApplicationUpdated;
                DeploymentManager.ApplicationUpdateFailed += _OnApplicationUpdateFailed;
                DeploymentManager.StartMonitor();
            };

            // When the window loses focus take it as an opportunity to trim our workingset.
            Deactivated += (sender, e) => FacebookClientApplication.PerformAggressiveCleanup();

            ApplicationCommands = new MainWindowCommands(ServiceProvider.ViewManager);

            _SwitchFullScreenModeCommand = new RoutedCommand("SwitchFullScreenMode", typeof(MainWindow));

            InitializeComponent();

            _photoUploadWizard         = new PhotoUploadWizard();
            _photoUploadWizardInfoPage = new PhotoUploadInformationPage(_photoUploadWizard);
            _embeddedBrowserControl    = new EmbeddedBrowserControl();

            Rect settingsBounds = Properties.Settings.Default.MainWindowBounds;

            if (!settingsBounds.IsEmpty)
            {
                if (settingsBounds.Left == 0 && settingsBounds.Top == 0)
                {
                    WindowStartupLocation = WindowStartupLocation.CenterScreen;
                }
                else
                {
                    this.Left = settingsBounds.Left;
                    this.Top  = settingsBounds.Top;
                }
                this.Width  = settingsBounds.Width;
                this.Height = settingsBounds.Height;
            }

            CommandBindings.Add(new CommandBinding(System.Windows.Input.NavigationCommands.BrowseBack, (sender, e) => _SafeBrowseBack(), (sender, e) => e.CanExecute = CanGoBack));
            CommandBindings.Add(new CommandBinding(System.Windows.Input.NavigationCommands.Refresh, (sender, e) => ServiceProvider.ViewManager.ActionCommands.StartSyncCommand.Execute(null)));
            CommandBindings.Add(new CommandBinding(_SwitchFullScreenModeCommand, OnSwitchFullScreenCommand));

            RoutedCommand backNavigationKeyOverrideCommand = new RoutedCommand();

            CommandBindings.Add(
                new CommandBinding(
                    backNavigationKeyOverrideCommand,
                    (sender, e) => ((MainWindow)sender)._SafeBrowseBack()));

            InputBindings.Add(new InputBinding(backNavigationKeyOverrideCommand, new KeyGesture(Key.Back)));

            this.PreviewStylusSystemGesture += new StylusSystemGestureEventHandler(OnPreviewStylusSystemGesture);
            this.PreviewStylusMove          += new StylusEventHandler(OnPreviewStylusMove);

            this.SizeChanged += _OnSizeChanged;
        }