<commit_before>﻿using System;
using System.Windows.Forms;
using Bloom.Properties;
//using Bloom.SendReceive;
using Bloom.Workspace;
using L10NSharp;
using SIL.Reporting;
using System.Drawing;
using Bloom.Book;
using Bloom.MiscUI;
using Bloom.TeamCollection;
using Bloom.ToPalaso;
using Bloom.web;
using SIL.Windows.Forms.SettingProtection;

namespace Bloom.CollectionTab
{
	public partial class ReactCollectionTabView : UserControl, IBloomTabArea
	{
		private readonly LibraryModel _model;

		public ReactCollectionTabView(LibraryModel model, LibraryListView.Factory libraryListViewFactory,
			LibraryBookView.Factory templateBookViewFactory,
			SelectedTabChangedEvent selectedTabChangedEvent,
			SendReceiveCommand sendReceiveCommand,
			TeamCollectionManager tcManager, BookSelection bookSelection)
		{
			_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));<commit_msg>Fix TeamCollectionStatusChanged handler, which was not being called<commit_after>﻿using System;
using System.Windows.Forms;
using Bloom.Properties;
//using Bloom.SendReceive;
using Bloom.Workspace;
using L10NSharp;
using SIL.Reporting;
using System.Drawing;
using Bloom.Book;
using Bloom.MiscUI;
using Bloom.TeamCollection;
using Bloom.ToPalaso;
using Bloom.web;
using SIL.Windows.Forms.SettingProtection;

namespace Bloom.CollectionTab
{
	public partial class ReactCollectionTabView : UserControl, IBloomTabArea
	{
		private readonly LibraryModel _model;

		public ReactCollectionTabView(LibraryModel model, LibraryListView.Factory libraryListViewFactory,
			LibraryBookView.Factory templateBookViewFactory,
			SelectedTabChangedEvent selectedTabChangedEvent,
			SendReceiveCommand sendReceiveCommand,
			TeamCollectionManager tcManager, BookSelection bookSelection)
		{
			_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) =>
			{
				if (!IsDisposed)
				{
					SafeInvoke.InvokeIfPossible("update TC status", this, false,
						() => SetTeamCollectionStatus(tcManager));
{'fraction_non_alphanumeric': 0.08562162162162162, 'fraction_numerical': 0.0017297297297297297, 'mean_word_length': 4.7825, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6266676', 'n_tokens_mistral': 1538, 'n_tokens_neox': 1292, 'n_words': 303}