Exemple #1
0
        private void ToolRunClick(object sender, EventArgs e)
        {
            procedure.Save();
            if (procedure.ProcedureType == ProcedureTypes.Source || procedure.ProcedureType == ProcedureTypes.Assembly)
            {
                var args = new ExecuteArgs();
                var obj  = procedure.CreateObject(args);

                if (obj is Window)
                {
                    ((Window)obj).TransientFor = ParentWindow;
                    ((Window)obj).Show();
                }
                else if (obj is Widget)
                {
                    var window = new ToolWindow
                    {
                        Mode   = ToolShowMode.Dialog,
                        Target = (Widget)obj,
                        Title  = procedure.Name
                    };
                    window.Show(this, Point.Zero);
                }
                else
                {
                    object result = procedure.ExecuteObject(obj, args);
                    MessageDialog.ShowMessage(ParentWindow, result == null ? "Succesfull!" : result.ToString(), "Execute complete!");
                }
            }
            else if (procedure.ProcedureType == ProcedureTypes.Query)
            {
                var form = new PQueryView {
                    Procedure = procedure
                };

                var window = new ToolWindow
                {
                    Mode   = ToolShowMode.Dialog,
                    Target = form,
                    Title  = procedure.Name
                };
                window.Show(this, Point.Zero);
                //window.Dispose();
            }
            else
            {
                var args = new ExecuteArgs {
                    Parameters = ProcedureProgress.CreateParam(procedure)
                };
                var    obj    = procedure.CreateObject(args);
                object result = procedure.ExecuteObject(obj, args);
                MessageDialog.ShowMessage(ParentWindow, result == null ? "Succesfull!" : result.ToString(), "Execute complete!");
            }
        }
Exemple #2
0
        private void ToolLoadFileClick(object sender, EventArgs e)
        {
            var dialog = new OpenFileDialog()
            {
                Multiselect = true
            };

            if (dialog.Run(ParentWindow))
            {
                foreach (string fileName in dialog.FileNames)
                {
                    string name  = Path.GetFileName(fileName);
                    var    query = new Query <DBProcedure>(new[]
                    {
                        new QueryParameter <DBProcedure>()
                        {
                            Invoker = EmitInvoker.Initialize <DBProcedure>(nameof(DBProcedure.DataName)),
                            Value   = name
                        },
                        new QueryParameter <DBProcedure>()
                        {
                            Invoker = EmitInvoker.Initialize <DBProcedure>(nameof(DBProcedure.ProcedureType)),
                            Value   = ProcedureTypes.File
                        },
                    });
                    if (!(CurrentSchema.Procedures.Find(query) is DBProcedure procedire))
                    {
                        procedire = new DBProcedure
                        {
                            ProcedureType = ProcedureTypes.File,
                            DataName      = name,
                            Name          = Path.GetFileNameWithoutExtension(name)
                        };
                    }
                    procedire.Data  = File.ReadAllBytes(fileName);
                    procedire.Stamp = File.GetLastWriteTime(fileName);
                    procedire.Save();
                }
                MessageDialog.ShowMessage(ParentWindow, Locale.Get("FlowExplorer", "Files load complete!"), "File Loader!");
            }
        }