示例#1
0
        public PhotoUploadInformationPage(PhotoUploadWizard wizard)
        {
            Verify.IsNotNull(wizard, "wizard");
            Wizard = wizard;

            InitializeComponent();
        }
示例#2
0
        public void DoDrop(string[] fileNames)
        {
            List <string> imageFiles = PhotoUploadWizard.FindImageFiles(fileNames);

            if (imageFiles.Count != 0)
            {
                if (ServiceProvider.ViewManager.EndDialog(ServiceProvider.ViewManager.Dialog))
                {
                    // This is a bit hacky.  Don't clear the selected album on drop
                    // if a dialog (e.g. an existing upload wizard) is up.
                    // This will leave it if the embedded browser or settings dialog is up,
                    // but whatever.
                    _photoUploadWizard.SetDefaultAlbum(null);
                }
                _photoUploadWizard.Show(imageFiles);
            }
        }
示例#3
0
        protected override void OnDrop(DragEventArgs e)
        {
            base.OnDrop(e);

            if (!DragContainer.IsInDrag)
            {
                string[]      fileNames  = e.Data.GetData(DataFormats.FileDrop) as string[];
                List <string> imageFiles = PhotoUploadWizard.FindImageFiles(fileNames);
                if (imageFiles.Count != 0)
                {
                    PhotoUploadWizard.Show(imageFiles);
                }

#if !USE_STANDARD_DRAGDROP
                DropTargetHelper.Drop(e.Data, e.GetPosition(this), DragDropEffects.Copy);
#endif
            }
        }
示例#4
0
        private void BrowseButtonClick(object sender, RoutedEventArgs e)
        {
            var ofd = new System.Windows.Forms.OpenFileDialog
            {
                Filter           = "Image Files (*.jpg;*.jpeg;*.gif;*.png)|*.jpg;*.jpeg;*.gif;*.png",
                Title            = "Choose images to upload",
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures),
                Multiselect      = true,
            };

            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Hide();

                List <string> imageFiles = PhotoUploadWizard.FindImageFiles(ofd.FileNames);
                if (imageFiles.Count != 0)
                {
                    Wizard.Show(imageFiles);
                }
            }
        }
示例#5
0
 public void ToggleUploadWizard()
 {
     PhotoUploadWizard.Toggle();
 }
示例#6
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;
        }