Пример #1
0
        public override bool?ParseStartStopCommands(Message message, ref bool continuation)
        {
            bool?is_alive = null;

            if (message.Text != null)
            {
                string text = message.Text.ToLower();
                if (StartCommands.Contains(text))
                {
                    is_alive     = true;
                    continuation = false;
                    if (PrivateChatGreeting != null && !PrivateChatGreeting.Equals(string.Empty))
                    {
                        sender_to_tg.Put(factory.CreateMessage(new ChatId(message.Chat.Id),
                                                               PrivateChatGreeting, keyboardMarkup: CommonFunctions.CreateInlineKeyboard(this.MainMenuDescription)));
                    }
                }
                else if (StopCommands.Contains(text))
                {
                    is_alive     = false;
                    continuation = false;
                }
            }
            return(is_alive);
        }
Пример #2
0
        private void DataPackWork()
        {
            //Waiting
            var w       = new SubWindow.Waiting(); w.Owner = this;
            var waiting = new BackgroundWorker();

            waiting.DoWork             += (ee, ea) => { };
            waiting.RunWorkerCompleted += (ee, ea) =>
            {
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    try { w.ShowDialog(); } catch { }
                }));
            };
            waiting.RunWorkerAsync();
            //Work
            var worker = new BackgroundWorker();

            worker.WorkerReportsProgress = true;
            bool error = false;

            worker.DoWork += (o, ea) =>
            {
                StartCommands.Clear(); ResetCommands.Clear();
                if (MainWindow.Midipath != "")
                {
                    sliceMidi(exportLine, !MainWindow.DataPackOrderByInstruments);
                }
                if (MainWindow.Wavepath != "")
                {
                    sliceWav(exportLine);
                }
                if (lrcs != null)
                {
                    sliceLrc();
                }
                try { cutByMaximum(commandMax); } catch { Dispatcher.Invoke(() => { w.Close(); MainWindow.ResetProgressStage(); }); System.Windows.MessageBox.Show("问题可能由以下原因造成:\n1.导出序列不包含任何命令\n2.命令溢出,数量大于2,147,483,647", "分类错误"); error = true; }
            };
            worker.RunWorkerCompleted += (o, ea) =>
            {
                if (!error)
                {
                    try { GenerateDataPack(); } catch { Dispatcher.Invoke(() => { w.Close(); MainWindow.ResetProgressStage(); }); System.Windows.MessageBox.Show("问题可能由以下原因造成:\n1.目标文件被占用\n2.目标文件夹被占用", "导出错误"); return; }
                }
                w.Close();
                this.Close();
                this.Owner.Focus();
            };
            worker.RunWorkerAsync();
        }
Пример #3
0
        public override bool?ParseStartStopCommands(Message message, ref bool continuation)
        {
            bool?is_alive = null;

            if (message.Text != null)
            {
                string text = message.Text.ToLower();
                if (StartCommands.Contains(text))
                {
                    is_alive     = true;
                    continuation = false;
                    if (PrivateChatGreeting != null && !PrivateChatGreeting.Equals(string.Empty))
                    {
                        SendDefaultMenu(message.Chat.Id);
                    }
                }
                else if (StopCommands.Contains(text))
                {
                    is_alive     = false;
                    continuation = false;
                }
            }
            return(is_alive);
        }