private void TreeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            var node = e.Node;

            if (node != null)
            {
                int id = Convert.ToInt32(node.Tag);

                IServiceClient client = new JsonServiceClient(CacheHelper.SERVICESTACK_URL).WithCache();
                var            fr     = client.Get <EbObjectResponse>(new EbObjectRequest()
                {
                    Id = id, Token = MainForm.JwtToken
                });

                var _formEbObject = EbSerializers.ProtoBuf_DeSerialize <EbObject>(fr.Data[0].Bytea);
                _formEbObject.EbObjectType = fr.Data[0].EbObjectType;
                _formEbObject.Name         = fr.Data[0].Name;
                _formEbObject.Id           = fr.Data[0].Id;

                if (_formEbObject.EbObjectType == EbObjectType.Form)
                {
                    var  _form_name = string.Format("form_{0}", id);
                    Form fc         = Application.OpenForms[_form_name];
                    if (fc == null)
                    {
                        FormDesignerForm pD = new FormDesignerForm(this.MainForm, StudioFormTypes.Desktop);
                        pD.Name = _form_name;
                        pD.Show(MainForm.DockPanel);
                        var _form = new EbFormControl();
                        _form.EbControlContainer    = _formEbObject as EbControlContainer;
                        _form.EbControlContainer.Id = id;
                        pD.SetEB_Form(_form);
                    }
                    else
                    {
                        fc.Activate();
                    }
                }
                else if (_formEbObject.EbObjectType == EbObjectType.DataSource)
                {
                    SqlStatementEditor ed = new SqlStatementEditor();
                    ed.MainForm = this.MainForm;
                    ed.Set(id, _formEbObject.Name, (_formEbObject as EbDataSource).Sql);
                    ed.Show(MainForm.DockPanel);
                }
            }
        }
예제 #2
0
 public static EbConfiguration ReadTestConfiguration(string path)
 {
     return(EbSerializers.ProtoBuf_DeSerialize <EbConfiguration>(EbFile.Bytea_FromFile(path)));
 }