Пример #1
0
        private void OnCutByTimeFromPuRunContextClicked()
        {
            int startOffset = _config.ChatCutStartOffset;
            int endOffset   = _config.ChatCutEndOffset;

            if (!_config.SkipChatOffsetsDialog)
            {
                var dialog = new TimeOffsetsDialog(_window, _config.ChatCutStartOffset, _config.ChatCutEndOffset);
                if (!dialog.Valid)
                {
                    return;
                }

                startOffset = dialog.StartOffset;
                endOffset   = dialog.EndOffset;
            }

            var item = _puRunsListView.SelectedItem as ListViewItem;

            if (item == null)
            {
                return;
            }

            var info = item.Content as PuRunDisplayInfo;

            if (info == null)
            {
                return;
            }

            int time = 0;

            if (!ParseMinutesSeconds(info.Time, out time))
            {
                return;
            }

            int duration = 0;

            if (!int.TryParse(info.Duration.Trim(new char[] { 's' }), out duration))
            {
                return;
            }

            var startTime = time - startOffset;
            var endTime   = time + duration + endOffset;

            _startTimeEditBox.Text = FormatMinutesSeconds(startTime);
            _endTimeEditBox.Text   = FormatMinutesSeconds(endTime);

            _tabControl.SelectedIndex = 3;
        }
Пример #2
0
        private void OnCutByTimeFromPuRunContextClicked()
        {
            int startOffset = _config.ChatCutStartOffset;
            int endOffset = _config.ChatCutEndOffset;
            if(!_config.SkipChatOffsetsDialog)
            {
                var dialog = new TimeOffsetsDialog(_window, _config.ChatCutStartOffset, _config.ChatCutEndOffset);
                if(!dialog.Valid)
                {
                    return;
                }

                startOffset = dialog.StartOffset;
                endOffset = dialog.EndOffset;
            }

            var item = _puRunsListView.SelectedItem as ListViewItem;
            if(item == null)
            {
                return;
            }

            var info = item.Content as PuRunDisplayInfo;
            if(info == null)
            {
                return;
            }

            int time = 0;
            if(!ParseMinutesSeconds(info.Time, out time))
            {
                return;
            }

            int duration = 0;
            if(!int.TryParse(info.Duration.Trim(new char[] { 's' }), out duration))
            {
                return;
            }

            var startTime = time - startOffset;
            var endTime = time + duration + endOffset;

            _startTimeEditBox.Text = FormatMinutesSeconds(startTime);
            _endTimeEditBox.Text = FormatMinutesSeconds(endTime);

            _tabControl.SelectedIndex = 3;
        }