Пример #1
0
        private void joinSessionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            _networkSession = new NikseWebServiceSession(_subtitle, _subtitleAlternate, TimerWebServiceTick, OnUpdateUserLogEntries);
            using (var networkJoin = new NetworkJoin())
            {
                networkJoin.Initialize(_networkSession);

                if (networkJoin.ShowDialog(this) == DialogResult.OK)
                {
                    _subtitle = _networkSession.Subtitle;
                    _subtitleAlternate = _networkSession.OriginalSubtitle;
                    if (_subtitleAlternate != null && _subtitleAlternate.Paragraphs.Count > 0)
                        SubtitleListview1.ShowAlternateTextColumn(_languageGeneral.OriginalText);
                    _fileName = networkJoin.FileName;
                    SetTitle();
                    Text = Title;
                    toolStripStatusNetworking.Visible = true;
                    toolStripStatusNetworking.Text = _language.NetworkMode;
                    EnableDisableControlsNotWorkingInNetworkMode(false);
                    _networkSession.AppendToLog(string.Format(_language.XStartedSessionYAtZ, _networkSession.CurrentUser.UserName, _networkSession.SessionId, DateTime.Now.ToLongTimeString()));
                    SubtitleListview1.ShowExtraColumn(_language.UserAndAction);
                    SubtitleListview1.AutoSizeAllColumns(this);
                    _subtitleListViewIndex = -1;
                    _oldSelectedParagraph = null;

                    if (Configuration.Settings.General.AllowEditOfOriginalSubtitle && _subtitleAlternate != null && _subtitleAlternate.Paragraphs.Count > 0)
                    {
                        buttonUnBreak.Visible = false;
                        buttonAutoBreak.Visible = false;
                        buttonSplitLine.Visible = false;

                        textBoxListViewText.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom;
                        textBoxListViewText.Width = (groupBoxEdit.Width - (textBoxListViewText.Left + 10)) / 2;
                        textBoxListViewTextAlternate.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom;
                        textBoxListViewTextAlternate.Left = textBoxListViewText.Left + textBoxListViewText.Width + 3;
                        textBoxListViewTextAlternate.Width = textBoxListViewText.Width;
                        textBoxListViewTextAlternate.Visible = true;
                        labelAlternateText.Text = _languageGeneral.OriginalText;
                        labelAlternateText.Visible = true;
                        labelAlternateCharactersPerSecond.Visible = true;
                        labelTextAlternateLineLengths.Visible = true;
                        labelAlternateSingleLine.Visible = true;
                        labelTextAlternateLineTotal.Visible = true;

                        labelCharactersPerSecond.Left = textBoxListViewText.Left + (textBoxListViewText.Width - labelCharactersPerSecond.Width);
                        labelTextLineTotal.Left = textBoxListViewText.Left + (textBoxListViewText.Width - labelTextLineTotal.Width);
                        AddAlternate();
                        Main_Resize(null, null);
                        _changeAlternateSubtitleToString = _subtitleAlternate.ToText(new SubRip()).Trim();
                    }
                    else
                    {
                        RemoveAlternate(false);
                    }
                    SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
                    SubtitleListview1.SelectIndexAndEnsureVisible(0);
                    TimerWebServiceTick(null, null);
                }
                else
                {
                    _networkSession = null;
                }
            }
        }
Пример #2
0
        private void startServerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var networkNew = new NetworkStart())
            {
                _networkSession = new NikseWebServiceSession(_subtitle, _subtitleAlternate, TimerWebServiceTick, OnUpdateUserLogEntries);
                networkNew.Initialize(_networkSession, _fileName);
                if (networkNew.ShowDialog(this) == DialogResult.OK)
                {
                    if (GetCurrentSubtitleFormat().HasStyleSupport)
                    {
                        SubtitleListview1.HideExtraColumn();
                    }

                    _networkSession.AppendToLog(string.Format(_language.XStartedSessionYAtZ, _networkSession.CurrentUser.UserName, _networkSession.SessionId, DateTime.Now.ToLongTimeString()));
                    toolStripStatusNetworking.Visible = true;
                    toolStripStatusNetworking.Text = _language.NetworkMode;
                    EnableDisableControlsNotWorkingInNetworkMode(false);
                    SubtitleListview1.ShowExtraColumn(_language.UserAndAction);
                    SubtitleListview1.AutoSizeAllColumns(this);
                    TimerWebServiceTick(null, null);
                }
                else
                {
                    _networkSession = null;
                }
            }
        }