예제 #1
0
        void RegisterCommandEvents()
        {
            var runner = CsvCommandRunner.GetInstance();

            runner.OnSuccess += Runner_OnSuccess;
            runner.OnError   += Runner_OnError;
        }
예제 #2
0
 void DisplayAll()
 {
     if (csv == null)
     {
         MessageBox.Show("请先打开文件");
         return;
     }
     CsvCommandRunner.GetInstance().Run(csv, "select * where 1");
 }
예제 #3
0
        bool RunCommand(string s)
        {
            if (csv == null)
            {
                MessageBox.Show("请先打开文件");
                return(false);
            }
            var runner = CsvCommandRunner.GetInstance();
            var r      = runner.Run(csv, s);

            return(r != null);
        }
예제 #4
0
        private void Runner_OnSuccess(CsvCommand cmd, CsvCommandQueryResult result)
        {
            switch (cmd.CommandType)
            {
            case CsvCommandType.Select:
                lastSelectCommand = cmd;
                break;
            }

            switch (result.Type)
            {
            case CsvCommandQueryResultType.Csv:
                DisplayCsv(result.Csv);
                break;

            case CsvCommandQueryResultType.Int:
                if (lastSelectCommand != null)
                {
                    CsvCommandRunner.GetInstance().Run(csv, lastSelectCommand);
                }
                UpdateText();
                break;
            }
        }