Пример #1
0
                public async override Task <object> Run(Hashtable xc)
                {
                    var      list = xc.GetCSVariable <Glist>("params");
                    Variable ret  = new Variable(0);

                    GwpfLib.IO.Input input = null;
                    try
                    {
                        string title = "Input", inf = "";
                        if (list.Count == 0)
                        {
                        }
                        else if (list.Count == 1)
                        {
                            title = list[0].value.IGetCSValue().ToString();
                        }
                        else if (list.Count == 2)
                        {
                            title = list[0].value.IGetCSValue().ToString();
                            inf   = list[1].value.IGetCSValue().ToString();
                        }
                        else
                        {
                            throw new Exceptions.RunException(Exceptions.EXID.参数错误);
                        }
                        MainWindow.MainApp.Dispatcher.Invoke(() =>
                        {
                            input = new GwpfLib.IO.Input();
                            GwpfLib.IO.Input.done = false;
                            input.SetContent(title, inf);
                            input.Show();
                        });



                        await Task.Run(() =>
                        {
                            while (!Convert.ToBoolean(GwpfLib.IO.Input.done))
                            {
                                ;
                            }
                        });
                    }
                    catch
                    {
                        throw new Exceptions.RunException(Exceptions.EXID.未知);
                    }
                    ret = new Variable(input.content);
                    return(ret);
                }
Пример #2
0
                public async override Task <object> Run(Hashtable xc)
                {
                    var      list = xc.GetCSVariable <Glist>("params");
                    Variable ret  = new Variable(0);
                    object   done = false;

                    try
                    {
                        await MainWindow.MainApp.Dispatcher.InvokeAsync(async() =>
                        {
                            var input = new GwpfLib.IO.Input();
                            if (list.Count == 0)
                            {
                                ret = new Variable(await input.GetInput());
                            }
                            else if (list.Count == 1)
                            {
                                ret = new Variable(await input.GetInput(list[0].value.IGetCSValue().ToString(), ""));
                            }
                            else if (list.Count == 2)
                            {
                                ret = new Variable(await input.GetInput(list[0].value.IGetCSValue().ToString(), list[1].value.IGetCSValue().ToString()));
                            }
                            else
                            {
                                throw new Exceptions.RunException(Exceptions.EXID.参数错误);
                            }
                            done = true;
                        });

                        await Task.Run(() =>
                        {
                            while (!Convert.ToBoolean(done))
                            {
                                ;
                            }
                        });
                    }
                    catch
                    {
                        throw new Exceptions.RunException(Exceptions.EXID.未知);
                    }
                    return(ret);
                }