static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); CommonConnection connection = ConnectionFactory.createConnection("mysql", "remotemysql.com", "WEJMD9dLmJ", "WEJMD9dLmJ", "CqlKK8zDL3", 3306); MyContainer.RegisterInstance <CommonConnection>(connection); Login login = new Login { SuccessAction = roles => { Role role = new Role { isAllowedAdd = roles.Contains("C"), isAllowedRead = roles.Contains("R"), isAllowedUpdate = roles.Contains("U"), isAllowedDelete = roles.Contains("D") }; MyContainer.RegisterInstance <Role>(role); new MainForm().Show(); } }; Application.Run(login); }
private void ReadBtn_Click(object sender, EventArgs e) { Table t = this.database.GetTableByName(this.tableList.SelectedItem.ToString()); MyContainer.RegisterInstance <Table>(t); BaseForm r = (BaseForm)MyContainer.Create <IReadForm>(); this.Hide(); r.FormClosed += (s, args) => this.Show(); r.Show(); }
private void DataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= table.Rows.Count) { return; } MyContainer.RegisterInstance <int>(e.RowIndex); BaseForm r = (BaseForm)MyContainer.Create <IUpdateForm>(); r.done = this.Done; r.ShowDialog(); }
private void UpdateBtn_Click(object sender, System.EventArgs e) { if (currentRow < 0) { return; } MyContainer.RegisterInstance <int>(currentRow); BaseForm r = (BaseForm)MyContainer.Create <IUpdateForm>(); r.done = this.Done; r.ShowDialog(); }
public static void RegisterRole(Role role) { MyContainer.RegisterInstance <Role>(role); }
public static void RegisterConnection(CommonConnection conn) { MyContainer.RegisterInstance <CommonConnection>(conn); }