/// <summary> /// Attach the model and view to the presenter /// </summary> /// <param name="model">The model to attach</param> /// <param name="view">The view to attach</param> /// <param name="explorerPresenter">The presenter to attach to</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.query = model as CustomQuery; this.view = view as CustomQueryView; this.explorer = explorerPresenter; this.view.OnRunQuery += RunQuery; this.view.OnLoadFile += LoadFile; this.view.OnWriteTable += WriteTable; // If the model contains sql, update the view to display it if (!string.IsNullOrEmpty(query.Sql)) { this.view.Sql = query.Sql; this.view.Filename = query.Filename; this.view.Tablename = query.Tablename; RunQuery(this, EventArgs.Empty); } }