コード例 #1
0
ファイル: LibraryView.cs プロジェクト: jorik041/BloomDesktop
        public LibraryView(LibraryModel model, LibraryListView.Factory libraryListViewFactory,
			LibraryBookView.Factory templateBookViewFactory,
			SelectedTabChangedEvent selectedTabChangedEvent,
			SendReceiveCommand sendReceiveCommand)
        {
            _model = model;
            InitializeComponent();

            _toolStrip.Renderer = new NoBorderToolStripRenderer();

            _collectionListView = libraryListViewFactory();
            _collectionListView.Dock = DockStyle.Fill;
            splitContainer1.Panel1.Controls.Add(_collectionListView);

            _bookView = templateBookViewFactory();
            _bookView.Dock = DockStyle.Fill;
            splitContainer1.Panel2.Controls.Add(_bookView);

            splitContainer1.SplitterDistance = _collectionListView.PreferredWidth;
            _makeBloomPackButton.Visible = model.IsShellProject;
            _sendReceiveButton.Visible = Settings.Default.ShowSendReceive;

            _sendReceiveButton.Click+=new EventHandler((x,y)=>sendReceiveCommand.Raise(this));
            _sendReceiveButton.Enabled = !SendReceiver.SendReceiveDisabled;
            ;
            selectedTabChangedEvent.Subscribe(c=>
                                                {
                                                    if (c.To == this)
                                                    {
                                                        Logger.WriteEvent("Entered Collections Tab");
                                                    }
                                                });
        }
コード例 #2
0
        public LibraryView(LibraryModel model, LibraryListView.Factory libraryListViewFactory,
                           LibraryBookView.Factory templateBookViewFactory,
                           SelectedTabChangedEvent selectedTabChangedEvent,
                           SendReceiveCommand sendReceiveCommand)
        {
            _model = model;
            InitializeComponent();

            _toolStrip.Renderer = new NoBorderToolStripRenderer();

            _collectionListView      = libraryListViewFactory();
            _collectionListView.Dock = DockStyle.Fill;
            splitContainer1.Panel1.Controls.Add(_collectionListView);

            _bookView      = templateBookViewFactory();
            _bookView.Dock = DockStyle.Fill;
            splitContainer1.Panel2.Controls.Add(_bookView);

            splitContainer1.SplitterDistance = _collectionListView.PreferredWidth;
            _makeBloomPackButton.Visible     = model.IsShellProject;
            _sendReceiveButton.Visible       = Settings.Default.ShowSendReceive;

            _sendReceiveButton.Click  += new EventHandler((x, y) => sendReceiveCommand.Raise(this));
            _sendReceiveButton.Enabled = !SendReceiver.SendReceiveDisabled;
            ;
            selectedTabChangedEvent.Subscribe(c =>
            {
                if (c.To == this)
                {
                    Logger.WriteEvent("Entered Collections Tab");
                }
            });
        }
コード例 #3
0
        public LibraryView(LibraryModel model, LibraryListView.Factory libraryListViewFactory,
                           LibraryBookView.Factory templateBookViewFactory,
                           SelectedTabChangedEvent selectedTabChangedEvent,
                           SendReceiveCommand sendReceiveCommand)
        {
            _model = model;
            InitializeComponent();
            splitContainer1.BackColor = Palette.BookListSplitterColor;             // controls the left vs. right splitter
            _toolStrip.Renderer       = new NoBorderToolStripRenderer();

            _collectionListView      = libraryListViewFactory();
            _collectionListView.Dock = DockStyle.Fill;
            splitContainer1.Panel1.Controls.Add(_collectionListView);

            _bookView      = templateBookViewFactory();
            _bookView.Dock = DockStyle.Fill;
            splitContainer1.Panel2.Controls.Add(_bookView);

            splitContainer1.SplitterDistance = _collectionListView.PreferredWidth;
            _makeBloomPackButton.Visible     = model.IsShellProject;
            _sendReceiveButton.Visible       = Settings.Default.ShowSendReceive;

            if (sendReceiveCommand != null)
            {
#if Chorus
                _sendReceiveButton.Click  += (x, y) => sendReceiveCommand.Raise(this);
                _sendReceiveButton.Enabled = !SendReceiver.SendReceiveDisabled;
#endif
            }
            else
            {
                _sendReceiveButton.Enabled = false;
            }

            if (SIL.PlatformUtilities.Platform.IsMono)
            {
                BackgroundColorsForLinux();
            }

            selectedTabChangedEvent.Subscribe(c =>
            {
                if (c.To == this)
                {
                    Logger.WriteEvent("Entered Collections Tab");
                }
            });
        }
コード例 #4
0
        //autofac uses this
        public WorkspaceView(WorkspaceModel model,
							 Control libraryView,
							 EditingView.Factory editingViewFactory,
							 PublishView.Factory pdfViewFactory,
							 CollectionSettingsDialog.Factory settingsDialogFactory,
							 EditBookCommand editBookCommand,
							SendReceiveCommand sendReceiveCommand,
							 SelectedTabAboutToChangeEvent selectedTabAboutToChangeEvent,
							SelectedTabChangedEvent selectedTabChangedEvent,
							 FeedbackDialog.Factory feedbackDialogFactory,
							ChorusSystem chorusSystem,
							Sparkle sparkleApplicationUpdater,
							LocalizationManager localizationManager

			)
        {
            _model = model;
            _settingsDialogFactory = settingsDialogFactory;
            _selectedTabAboutToChangeEvent = selectedTabAboutToChangeEvent;
            _selectedTabChangedEvent = selectedTabChangedEvent;
            _feedbackDialogFactory = feedbackDialogFactory;
            _chorusSystem = chorusSystem;
            _sparkleApplicationUpdater = sparkleApplicationUpdater;
            _localizationManager = localizationManager;
            _model.UpdateDisplay += new System.EventHandler(OnUpdateDisplay);
            InitializeComponent();

            #if !DEBUG
            _sparkleApplicationUpdater.CheckOnFirstApplicationIdle();
            #endif
            _toolStrip.Renderer = new NoBorderToolStripRenderer();

            //we have a number of buttons which don't make sense for the remote (therefore vulnerable) low-end user
            //_settingsLauncherHelper.CustomSettingsControl = _toolStrip;

            _settingsLauncherHelper.ManageComponent(_settingsButton);

            //NB: the rest of these aren't really settings, but we're using that feature to simplify this menu down to what makes sense for the easily-confused user
            _settingsLauncherHelper.ManageComponent(_openCreateCollectionButton);
            _settingsLauncherHelper.ManageComponent(deepBloomPaperToolStripMenuItem);
            _settingsLauncherHelper.ManageComponent(_makeASuggestionMenuItem);
            _settingsLauncherHelper.ManageComponent(_webSiteMenuItem);
            _settingsLauncherHelper.ManageComponent(_showLogMenuItem);
            _settingsLauncherHelper.ManageComponent(_releaseNotesMenuItem);
            _settingsLauncherHelper.ManageComponent(_divider2);
            _settingsLauncherHelper.ManageComponent(_divider3);
            _settingsLauncherHelper.ManageComponent(_divider4);

            OnSettingsProtectionChanged(this, null);//initial setup
            SettingsProtectionSettings.Default.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(OnSettingsProtectionChanged);

            _uiLanguageMenu.Visible = true;
               _settingsLauncherHelper.ManageComponent(_uiLanguageMenu);

            editBookCommand.Subscribe(OnEditBook);
            sendReceiveCommand.Subscribe(OnSendReceive);

            //Cursor = Cursors.AppStarting;
            Application.Idle += new EventHandler(Application_Idle);
            Text = _model.ProjectName;

            //SetupTabIcons();

            //
            // _collectionView
            //
            this._collectionView = (LibraryView) libraryView;
            this._collectionView.Dock = System.Windows.Forms.DockStyle.Fill;

            //
            // _editingView
            //
            this._editingView = editingViewFactory();
            this._editingView.Dock = System.Windows.Forms.DockStyle.Fill;

            //
            // _pdfView
            //
            this._publishView = pdfViewFactory();
            this._publishView.Dock = System.Windows.Forms.DockStyle.Fill;

            _collectionTab.Tag = _collectionView;
            _publishTab.Tag = _publishView;
            _editTab.Tag = _editingView;

            this._collectionTab.Text = _collectionView.CollectionTabLabel;

            SetTabVisibility(_publishTab, false);
            SetTabVisibility(_editTab, false);

            //			if (Program.StartUpWithFirstOrNewVersionBehavior)
            //			{
            //				_tabStrip.SelectedTab = _infoTab;
            //				SelectPage(_infoView);
            //			}
            //			else
            //			{
                _tabStrip.SelectedTab = _collectionTab;
                SelectPage(_collectionView);
            //			}

            SetupUILanguageMenu();
        }
コード例 #5
0
//autofac uses this

        public WorkspaceView(WorkspaceModel model,
                             Control libraryView,
                             EditingView.Factory editingViewFactory,
                             PublishView.Factory pdfViewFactory,
                             CollectionSettingsDialog.Factory settingsDialogFactory,
                             EditBookCommand editBookCommand,
                             SendReceiveCommand sendReceiveCommand,
                             SelectedTabAboutToChangeEvent selectedTabAboutToChangeEvent,
                             SelectedTabChangedEvent selectedTabChangedEvent,
                             LocalizationChangedEvent localizationChangedEvent,
                             FeedbackDialog.Factory feedbackDialogFactory,
                             ProblemReporterDialog.Factory problemReportDialogFactory,
                             //ChorusSystem chorusSystem,
                             LocalizationManager localizationManager

                             )
        {
            _model = model;
            _settingsDialogFactory         = settingsDialogFactory;
            _selectedTabAboutToChangeEvent = selectedTabAboutToChangeEvent;
            _selectedTabChangedEvent       = selectedTabChangedEvent;
            _localizationChangedEvent      = localizationChangedEvent;
            _feedbackDialogFactory         = feedbackDialogFactory;
            _problemReportDialogFactory    = problemReportDialogFactory;
            //_chorusSystem = chorusSystem;
            _localizationManager  = localizationManager;
            _model.UpdateDisplay += new System.EventHandler(OnUpdateDisplay);
            InitializeComponent();

            _checkForNewVersionMenuItem.Visible = SIL.PlatformUtilities.Platform.IsWindows;

            _toolStrip.Renderer = new NoBorderToolStripRenderer();

            //we have a number of buttons which don't make sense for the remote (therefore vulnerable) low-end user
            //_settingsLauncherHelper.CustomSettingsControl = _toolStrip;

            _settingsLauncherHelper.ManageComponent(_settingsButton);

            //NB: the rest of these aren't really settings, but we're using that feature to simplify this menu down to what makes sense for the easily-confused user
            _settingsLauncherHelper.ManageComponent(_openCreateCollectionButton);
            _settingsLauncherHelper.ManageComponent(_keyBloomConceptsMenuItem);
            _settingsLauncherHelper.ManageComponent(_makeASuggestionMenuItem);
            _settingsLauncherHelper.ManageComponent(_webSiteMenuItem);
            _settingsLauncherHelper.ManageComponent(_showLogMenuItem);
            _settingsLauncherHelper.ManageComponent(_releaseNotesMenuItem);
            _settingsLauncherHelper.ManageComponent(_divider2);
            _settingsLauncherHelper.ManageComponent(_divider3);
            _settingsLauncherHelper.ManageComponent(_divider4);

            OnSettingsProtectionChanged(this, null);            //initial setup
            SettingsProtectionSettings.Default.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(OnSettingsProtectionChanged);


            _uiLanguageMenu.Visible = true;
            _settingsLauncherHelper.ManageComponent(_uiLanguageMenu);

            editBookCommand.Subscribe(OnEditBook);
            sendReceiveCommand.Subscribe(OnSendReceive);

            //Cursor = Cursors.AppStarting;
            Application.Idle += new EventHandler(Application_Idle);
            Text              = _model.ProjectName;

            //SetupTabIcons();

            //
            // _collectionView
            //
            this._collectionView      = (LibraryView)libraryView;
            this._collectionView.Dock = System.Windows.Forms.DockStyle.Fill;

            //
            // _editingView
            //
            this._editingView      = editingViewFactory();
            this._editingView.Dock = System.Windows.Forms.DockStyle.Fill;

            //
            // _pdfView
            //
            this._publishView      = pdfViewFactory();
            this._publishView.Dock = System.Windows.Forms.DockStyle.Fill;

            _collectionTab.Tag = _collectionView;
            _publishTab.Tag    = _publishView;
            _editTab.Tag       = _editingView;

            this._collectionTab.Text = _collectionView.CollectionTabLabel;

            SetTabVisibility(_publishTab, false);
            SetTabVisibility(_editTab, false);

//			if (Program.StartUpWithFirstOrNewVersionBehavior)
//			{
//				_tabStrip.SelectedTab = _infoTab;
//				SelectPage(_infoView);
//			}
//			else
//			{
            _tabStrip.SelectedTab = _collectionTab;
            SelectPage(_collectionView);
//			}

            if (SIL.PlatformUtilities.Platform.IsMono)
            {
                // Without this adjustment, we lose some controls on smaller resolutions.
                AdjustToolPanelLocation(true);
                // in mono auto-size causes the height of the tab strip to be too short
                _tabStrip.AutoSize = false;
            }

            SetupUiLanguageMenu();
            _viewInitialized = false;
        }
コード例 #6
0
        public LibraryView(LibraryModel model, LibraryListView.Factory libraryListViewFactory,
                           LibraryBookView.Factory templateBookViewFactory,
                           SelectedTabChangedEvent selectedTabChangedEvent,
                           SendReceiveCommand sendReceiveCommand,
                           TeamCollectionManager tcManager)
        {
            _model = model;
            InitializeComponent();
            splitContainer1.BackColor = Palette.BookListSplitterColor;             // controls the left vs. right splitter
            _toolStrip.Renderer       = new NoBorderToolStripRenderer();
            _toolStripLeft.Renderer   = new NoBorderToolStripRenderer();

            _collectionListView      = libraryListViewFactory();
            _collectionListView.Dock = DockStyle.Fill;
            splitContainer1.Panel1.Controls.Add(_collectionListView);

            _bookView = templateBookViewFactory();
            _bookView.TeamCollectionMgr = tcManager;
            _bookView.Dock = DockStyle.Fill;
            splitContainer1.Panel2.Controls.Add(_bookView);

            // When going down to Shrink Stage 3 (see WorkspaceView), we want the right-side toolstrip to take precedence
            // (Settings, Other Collection).
            // This essentially makes the TC Status button's zIndex less than the buttons on the right side.
            _toolStripLeft.SendToBack();

            splitContainer1.SplitterDistance = _collectionListView.PreferredWidth;
            _makeBloomPackButton.Visible     = model.IsShellProject;
            _sendReceiveButton.Visible       = Settings.Default.ShowSendReceive;

            if (sendReceiveCommand != null)
            {
#if Chorus
                _sendReceiveButton.Click  += (x, y) => sendReceiveCommand.Raise(this);
                _sendReceiveButton.Enabled = !SendReceiver.SendReceiveDisabled;
#endif
            }
            else
            {
                _sendReceiveButton.Enabled = false;
            }

            if (SIL.PlatformUtilities.Platform.IsMono)
            {
                BackgroundColorsForLinux();
            }

            selectedTabChangedEvent.Subscribe(c =>
            {
                if (c.To == this)
                {
                    Logger.WriteEvent("Entered Collections Tab");
                }
            });
            SetTeamCollectionStatus(tcManager);
            TeamCollectionManager.TeamCollectionStatusChanged += (sender, args) =>
            {
                if (IsHandleCreated && !IsDisposed)
                {
                    SafeInvoke.InvokeIfPossible("update TC status", this, false,
                                                () => SetTeamCollectionStatus(tcManager));
                }
            };
            _tcStatusButton.Click += (sender, args) =>
            {
                // Any messages for which reloading the collection is a useful action?
                var showReloadButton = tcManager.MessageLog.ShouldShowReloadButton;
                // Reinstate this to see messages from before we started up.
                // We think it might be too expensive to show a list as long as this might get.
                // Instead, in the short term we may add a button to show the file.
                // Later we may implement some efficient way to scroll through them.
                // tcManager.CurrentCollection?.MessageLog?.LoadSavedMessages();
                using (var dlg = new ReactDialog("teamCollectionDialogBundle", new
                {
                    showReloadButton
                }, "Team Collection"))
                {
                    dlg.ShowDialog(this);
                    tcManager.CurrentCollectionEvenIfDisconnected?.MessageLog.WriteMilestone(MessageAndMilestoneType
                                                                                             .LogDisplayed);
                }
            };
        }
コード例 #7
0
//autofac uses this

        public WorkspaceView(WorkspaceModel model,
                             Control libraryView,
                             EditingView.Factory editingViewFactory,
                             PublishView.Factory pdfViewFactory,
                             CollectionSettingsDialog.Factory settingsDialogFactory,
                             EditBookCommand editBookCommand,
                             SendReceiveCommand sendReceiveCommand,
                             SelectedTabAboutToChangeEvent selectedTabAboutToChangeEvent,
                             SelectedTabChangedEvent selectedTabChangedEvent,
                             FeedbackDialog.Factory feedbackDialogFactory,
                             ChorusSystem chorusSystem,
                             Sparkle sparkleApplicationUpdater,
                             LocalizationManager localizationManager

                             )
        {
            _model = model;
            _settingsDialogFactory         = settingsDialogFactory;
            _selectedTabAboutToChangeEvent = selectedTabAboutToChangeEvent;
            _selectedTabChangedEvent       = selectedTabChangedEvent;
            _feedbackDialogFactory         = feedbackDialogFactory;
            _chorusSystem = chorusSystem;
            _sparkleApplicationUpdater = sparkleApplicationUpdater;
            _localizationManager       = localizationManager;
            _model.UpdateDisplay      += new System.EventHandler(OnUpdateDisplay);
            InitializeComponent();

#if !DEBUG
            _sparkleApplicationUpdater.CheckOnFirstApplicationIdle();
#endif
            _toolStrip.Renderer = new NoBorderToolStripRenderer();

            //we have a number of buttons which don't make sense for the remote (therefore vulnerable) low-end user
            //_settingsLauncherHelper.CustomSettingsControl = _toolStrip;

            _settingsLauncherHelper.ManageComponent(_settingsButton);

            //NB: the rest of these aren't really settings, but we're using that feature to simplify this menu down to what makes sense for the easily-confused user
            _settingsLauncherHelper.ManageComponent(_openCreateCollectionButton);
            _settingsLauncherHelper.ManageComponent(deepBloomPaperToolStripMenuItem);
            _settingsLauncherHelper.ManageComponent(_makeASuggestionMenuItem);
            _settingsLauncherHelper.ManageComponent(_webSiteMenuItem);
            _settingsLauncherHelper.ManageComponent(_showLogMenuItem);
            _settingsLauncherHelper.ManageComponent(_releaseNotesMenuItem);
            _settingsLauncherHelper.ManageComponent(_divider2);
            _settingsLauncherHelper.ManageComponent(_divider3);
            _settingsLauncherHelper.ManageComponent(_divider4);

            OnSettingsProtectionChanged(this, null);            //initial setup
            SettingsProtectionSettings.Default.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(OnSettingsProtectionChanged);


            _uiLanguageMenu.Visible = true;
            _settingsLauncherHelper.ManageComponent(_uiLanguageMenu);

            editBookCommand.Subscribe(OnEditBook);
            sendReceiveCommand.Subscribe(OnSendReceive);

            //Cursor = Cursors.AppStarting;
            Application.Idle += new EventHandler(Application_Idle);
            Text              = _model.ProjectName;

            //SetupTabIcons();

            //
            // _collectionView
            //
            this._collectionView      = (LibraryView)libraryView;
            this._collectionView.Dock = System.Windows.Forms.DockStyle.Fill;

            //
            // _editingView
            //
            this._editingView      = editingViewFactory();
            this._editingView.Dock = System.Windows.Forms.DockStyle.Fill;

            //
            // _pdfView
            //
            this._publishView      = pdfViewFactory();
            this._publishView.Dock = System.Windows.Forms.DockStyle.Fill;

            _collectionTab.Tag = _collectionView;
            _publishTab.Tag    = _publishView;
            _editTab.Tag       = _editingView;

            this._collectionTab.Text = _collectionView.CollectionTabLabel;

            SetTabVisibility(_publishTab, false);
            SetTabVisibility(_editTab, false);

//			if (Program.StartUpWithFirstOrNewVersionBehavior)
//			{
//				_tabStrip.SelectedTab = _infoTab;
//				SelectPage(_infoView);
//			}
//			else
//			{
            _tabStrip.SelectedTab = _collectionTab;
            SelectPage(_collectionView);
//			}

            SetupUILanguageMenu();
        }
コード例 #8
0
        public ReactCollectionTabView(LibraryModel model, LibraryListView.Factory libraryListViewFactory,
                                      LibraryBookView.Factory templateBookViewFactory,
                                      SelectedTabChangedEvent selectedTabChangedEvent,
                                      SendReceiveCommand sendReceiveCommand,
                                      TeamCollectionManager tcManager)
        {
            _model = model;
            InitializeComponent();
            BackColor               = _reactControl.BackColor = Palette.GeneralBackground;
            _toolStrip.Renderer     = new NoBorderToolStripRenderer();
            _toolStripLeft.Renderer = new NoBorderToolStripRenderer();

            // When going down to Shrink Stage 3 (see WorkspaceView), we want the right-side toolstrip to take precedence
            // (Settings, Other Collection).
            // This essentially makes the TC Status button's zIndex less than the buttons on the right side.
            _toolStripLeft.SendToBack();

            //TODO splitContainer1.SplitterDistance = _collectionListView.PreferredWidth;
            _makeBloomPackButton.Visible = model.IsShellProject;
            _sendReceiveButton.Visible   = Settings.Default.ShowSendReceive;

            if (sendReceiveCommand != null)
            {
#if Chorus
                _sendReceiveButton.Click  += (x, y) => sendReceiveCommand.Raise(this);
                _sendReceiveButton.Enabled = !SendReceiver.SendReceiveDisabled;
#endif
            }
            else
            {
                _sendReceiveButton.Enabled = false;
            }

            if (SIL.PlatformUtilities.Platform.IsMono)
            {
                BackgroundColorsForLinux();
            }

            selectedTabChangedEvent.Subscribe(c =>
            {
                if (c.To == this)
                {
                    Logger.WriteEvent("Entered Collections Tab");
                }
            });
            SetTeamCollectionStatus(tcManager);
            TeamCollectionManager.TeamCollectionStatusChanged += (sender, args) =>
            {
                return;

                if (!IsDisposed)
                {
                    SafeInvoke.InvokeIfPossible("update TC status", this, false,
                                                () => SetTeamCollectionStatus(tcManager));
                }
            };
            _tcStatusButton.Click += (sender, args) =>
            {
                // Any messages for which reloading the collection is a useful action?
                var showReloadButton = tcManager.MessageLog.ShouldShowReloadButton;
                // Reinstate this to see messages from before we started up.
                // We think it might be too expensive to show a list as long as this might get.
                // Instead, in the short term we may add a button to show the file.
                // Later we may implement some efficient way to scroll through them.
                // tcManager.CurrentCollection?.MessageLog?.LoadSavedMessages();
                using (var dlg = new ReactDialog("teamCollectionDialog", new { showReloadButton }))
                {
                    dlg.ShowDialog(this);
                    tcManager.CurrentCollectionEvenIfDisconnected?.MessageLog.WriteMilestone(MessageAndMilestoneType.LogDisplayed);
                }
            };

            // We don't want this control initializing until team collections sync (if any) is done.
            // That could change, but for now we're not trying to handle async changes arriving from
            // the TC to the local collection, and as part of that, the collection tab doesn't expect
            // the local collection to change because of TC stuff once it starts loading.
            Controls.Remove(_reactControl);
        }