예제 #1
0
        public void ShowExportToSpreadsheetUI(Book.Book book)
        {
            // Throw up a Requires Bloom Enterprise dialog if it's not turned on
            if (!_collectionModel.CollectionSettings.HaveEnterpriseFeatures)
            {
                Enterprise.ShowRequiresEnterpriseNotice(Form.ActiveForm, "Export to Spreadsheet");
                return;
            }

            dynamic messageBundle = new DynamicJson();

            messageBundle.folderPath = GetSpreadsheetFolderFor(book, true);
            _webSocketServer.LaunchDialog("SpreadsheetExportDialog", messageBundle);
        }
예제 #2
0
        public delegate CollectionTabView Factory();      //autofac uses this

        public CollectionTabView(CollectionModel model,
                                 SelectedTabChangedEvent selectedTabChangedEvent,
                                 TeamCollectionManager tcManager, BookSelection bookSelection,
                                 WorkspaceTabSelection tabSelection, BloomWebSocketServer webSocketServer, LocalizationChangedEvent localizationChangedEvent)
        {
            _model           = model;
            _tabSelection    = tabSelection;
            _bookSelection   = bookSelection;
            _webSocketServer = webSocketServer;
            _tcManager       = tcManager;

            BookCollection.CollectionCreated += OnBookCollectionCreated;

            InitializeComponent();
            _reactControl.SetLocalizationChangedEvent(localizationChangedEvent);             // after InitializeComponent, which creates it.
            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;

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

            selectedTabChangedEvent.Subscribe(c =>
            {
                if (c.To == this)
                {
                    Logger.WriteEvent("Entered Collections Tab");
                    if (_bookChangesPending && _bookSelection.CurrentSelection != null)
                    {
                        UpdateForBookChanges(_bookSelection.CurrentSelection);
                    }
                }
            });
            SetTeamCollectionStatus(tcManager);
            TeamCollectionManager.TeamCollectionStatusChanged += (sender, args) =>
            {
                if (IsHandleCreated && !IsDisposed)
                {
                    SafeInvoke.InvokeIfPossible("update TC status", this, false,
                                                () => SetTeamCollectionStatus(tcManager));
                }
            };
            _tcStatusButton.Click += (sender, args) =>
            {
                // 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();

                dynamic messageBundle = new DynamicJson();
                messageBundle.showReloadButton = tcManager.MessageLog.ShouldShowReloadButton;
                _webSocketServer.LaunchDialog("TeamCollectionDialog", messageBundle);
                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);
            bookSelection.SelectionChanged += (sender, e) => BookSelectionChanged(bookSelection.CurrentSelection);
        }