internal StrategyConfig(IdentedStreamWriter Writer, string CanonicalTableName, Dictionary <string, Column> Columns, Dictionary <string, Column> DetailColumns, DataAccessTechnology DataAccessTech, GuiType Type, LanguageGenerator Language, bool ValidationsEnabled, List <ColumnValidation> ValidationColumns, List <ColumnValidation> DetailValidationColumns, string ConnectionString, string ConnectionStringWithPassword, string TableName, string DetailTableName, string ConstraintName, Dictionary <string, ForeignKeyColumnInfo> ForeignKeys, Dictionary <string, ForeignKeyColumnInfo> DetailForeignKeys) { this.Writer = Writer; this.CanonicalTableName = CanonicalTableName; this.Columns = Columns; this.DetailColumns = DetailColumns; this.DataAccessTech = DataAccessTech; this.Type = Type; this.Language = Language; this.ValidationsEnabled = ValidationsEnabled; this.ValidationColumns = ValidationColumns; this.ConnectionString = ConnectionString; this.ConnectionStringWithPassword = ConnectionStringWithPassword; this.TableName = TableName; this.DetailTableName = DetailTableName; this.DetailValidationColumns = DetailValidationColumns; this.ConstraintName = ConstraintName; this.ForeignKeys = ForeignKeys; this.DetailForeignKeys = DetailForeignKeys; }
public void EditContact(int num) { guiType = GuiType.Edit; editableContact = num; nameBox.stringDate = contacts[editableContact].name; phoneBox.stringDate = contacts[editableContact].number; }
public static void SendOpenGui(GuiType gt, NetConnection con) { NetOutgoingMessage outmsg = server.CreateMessage(); outmsg.Write((byte)PacketType.OpenGui); outmsg.Write((byte)gt); SendMessageTo(outmsg, con); }
/// <summary> /// Gets the form values from the wizard, and set them into the base private fields. /// </summary> /// <param name="form">The wizard form.</param> private void GetFormValues(ItemTemplatesWinFormsWizard form) { _selectedModel = form.SelectedModel; _selectedEntity = form.SelectedEntity; _detailEntity = form.SelectedDetailEntity; _GuiType = form.GuiType; _constraintName = form.ConstraintName; _dataAccessTechnology = form.DataAccessTechnology; }
internal void ShowAccountUI() { _guiType = GuiType.Account; if (_accountUI == null) { _accountUI = new AccountUI(this); } ShowPage(_accountUI); }
private void OpenGui(NetIncomingMessage incmsg) { GuiType gt = (GuiType)incmsg.ReadByte(); if (gt == GuiType.SelectFaction) { world = new World(true); core.currentGui = new GuiSelectFaction(); } }
public override void Back() { Save(); if (guiType == GuiType.Main) { phone.currentScreen = new MainScreen(phone); } else if (guiType == GuiType.Add || guiType == GuiType.Edit) { guiType = GuiType.Main; } }
public PhoneBookScreen(TelephoneBase tel) : base(tel) { Load(); base.LoadText(tel.content, "GuiElements\\screen_phonebook"); addContact = new Button(new Vector2(30, 64), true, "Новый", Color.Blue); addContact.LoadText(tel.content, "GuiElements\\gui_add"); addContact.size = 0.75f; addContact.stringPos = new Vector2(10, 0); acceptAdd = new Button(new Vector2(125, 386), true, "Добавить", Color.Blue); acceptAdd.LoadText(phone.content, "GuiElements\\gui_button"); acceptAdd.stringPos = new Vector2(-50, -10); guiType = GuiType.Main; nameBox = new TextBox(new Vector2(105, 180), phone, TextBoxType.All, "Имя", 16); nameBox.LoadText(phone.content, "GuiElements\\gui_inputbox"); phoneBox = new TextBox(new Vector2(105, 240), phone, TextBoxType.Number, "Номер", 11); phoneBox.LoadText(phone.content, "GuiElements\\gui_inputbox"); screenFonAdd = new Object(new Vector2(Core.screenWidth / 2, 66)); screenFonAdd.LoadText(phone.content, "GuiElements\\screen_phonebookadd"); search = new Object(new Vector2(75, 64)); search.LoadText(phone.content, "GuiElements\\gui_search"); //search.color = new Vector4(0.2f, 0.75f, 1, 1); searchBox = new TextBox(new Vector2(170, 64), phone, TextBoxType.All, "Поиск", 8); searchBox.LoadText(phone.content, "GuiElements\\gui_inputsearch"); search.position = new Vector2(120, 64); searchBox.position = new Vector2(190, 64); if (firstStart) { Contact c = new Contact(phone, "Balance", "104"); contacts.Add(c); c = new Contact(phone, "Mother", "89181112233"); contacts.Add(c); c = new Contact(phone, "Father", "89184433121"); contacts.Add(c); c = new Contact(phone, "Brother", "89187711889"); contacts.Add(c); c = new Contact(phone, "Friend", "89187722889"); contacts.Add(c); c = new Contact(phone, "Antoha", "89003475712"); contacts.Add(c); c = new Contact(phone, "My number", "89237643712"); contacts.Add(c); c = new Contact(phone, "OLD NUMBER", "89648527592"); contacts.Add(c); c = new Contact(phone, "Matvey", "8964245314"); contacts.Add(c); } firstStart = false; Save(); }
internal void ShowAutoConnectUI() { _guiType = GuiType.AutoConnect; this.ThreadSafeInvoke(() => { try { var ui = new AutoConnectUI(this); ShowPage(ui); } catch (Exception ex) { Common.ShowUnknownException(ex); } }); }
internal void ShowMainPage() { _guiType = GuiType.MainPage; try { this.ThreadSafeInvoke(() => { if (_mappingUI == null) { _mappingUI = new MappingUI(this); } _mappingUI.SetAppEnvironment(); // !important ShowPage(_mappingUI); }); } catch (System.Exception ex) { Common.ShowUnknownException(ex); } }
public EventGui(GuiMenu guiMenu, GuiType guiType) { this.GuiMenu = guiMenu; this.Type = guiType; }
internal void ShowFreeTrialExpiredUI() { _guiType = GuiType.FreeTrialExpired; ShowPage(new FreeTrialExpiredUI(this)); }
/// <summary> /// Runs custom wizard logic when the wizard has completed all tasks. /// </summary> public void RunFinished() { Array activeProjects = (Array)dte.ActiveSolutionProjects; Project project = (Project)activeProjects.GetValue(0); VSProject vsProj = null; if (wizardFinished) { #if NET_40_OR_GREATER string frmName = string.Empty; SortedSet <string> tables = new SortedSet <string>(); Dictionary <string, WindowsFormsCodeGeneratorStrategy> strategies = new Dictionary <string, WindowsFormsCodeGeneratorStrategy>(); vsProj = project.Object as VSProject; ItemTemplateUtilities.CopyResourcesToProject(project, _itemTemplateTempPath); try { // Ensure all model exists, even if user didn't went through validation pages, so metadata for table used in FKs is already loaded. GenerateModelsForItemTemplates(); string detailTableName = _detailEntity; string _canonicalTableName = ItemTemplateUtilities.GetCanonicalIdentifier(_selectedEntity); string canonicalDetailTableName = ItemTemplateUtilities.GetCanonicalIdentifier(detailTableName); // Gather all the tables tables.Add(_selectedEntity); if (!string.IsNullOrEmpty(detailTableName)) { tables.Add(detailTableName); } foreach (KeyValuePair <string, MySql.Data.VisualStudio.Wizards.ForeignKeyColumnInfo> kvp2 in ForeignKeys) { tables.Add(kvp2.Value.ReferencedTableName); } foreach (KeyValuePair <string, MySql.Data.VisualStudio.Wizards.ForeignKeyColumnInfo> kvp2 in DetailForeignKeys) { tables.Add(kvp2.Value.ReferencedTableName); } AddColumnMappings(_canonicalTableName, _colValidations); if (!string.IsNullOrEmpty(detailTableName)) { AddColumnMappings(canonicalDetailTableName, _colValidationsDetail); } InitializeColumnMappings(ForeignKeys); InitializeColumnMappings(DetailForeignKeys); // Generate the model using the proper technology ItemTemplateUtilities.GenerateEntityFrameworkModel(project, vsProj, _connection, _selectedModel, tables.ToList(), _projectPath, _currentEntityFrameworkVersion, _language, ColumnMappings, ref TablesIncludedInModel); // Generate screens for the selected table. _hasDataGridDateColumn = false; Dictionary <string, Column> Columns = _columns; Dictionary <string, Column> DetailColumns = _detailColumns; _canonicalTableName = ItemTemplateUtilities.GetCanonicalIdentifier(_selectedEntity); detailTableName = _detailEntity; canonicalDetailTableName = ItemTemplateUtilities.GetCanonicalIdentifier(detailTableName); if (!TablesIncludedInModel.ContainsKey(_selectedEntity)) { SendToGeneralOutputWindow(string.Format("Skipping generation of screen for table '{0}' because it does not have primary key.", _selectedEntity)); return; } if ((_GuiType == GuiType.MasterDetail) && !TablesIncludedInModel.ContainsKey(_detailEntity)) { // If Detail table does not have PK, then you cannot edit details, "degrade" layout from Master Detail to Individual Controls. _GuiType = GuiType.IndividualControls; SendToGeneralOutputWindow(string.Format("Degrading layout for table '{0}' from master detail to single controls (because detail table '{1}' does not have primary key).", _selectedEntity, _detailEntity)); } // Create the strategy StrategyConfig config = new StrategyConfig(sw, _canonicalTableName, Columns, DetailColumns, _dataAccessTechnology, _GuiType, _language, _colValidations != null, _colValidations, DetailValidationColumns, ItemTemplateUtilities.ConnectionStringWithIncludedPassword(_connection), _connectionString, _selectedEntity, _detailEntity, _constraintName, ForeignKeys, DetailForeignKeys); WindowsFormsCodeGeneratorStrategy Strategy = WindowsFormsCodeGeneratorStrategy.GetInstance(config); strategies.Add(_selectedEntity, Strategy); if (!_hasDataGridDateColumn) { ItemTemplateUtilities.EnsureCodeForDateTimeGridColumn(vsProj, Columns, DetailColumns, _language, _projectPath, _projectNamespace); } // Add new form to project. frmName = string.Format("frm{0}", _canonicalTableName); string frmDesignerName = string.Format("frm{0}.designer", _canonicalTableName); ItemTemplateUtilities.AddNewForm(project, frmName, _projectPath, _projectNamespace, _language); // Now generated the bindings & custom code List <string> formNames = new List <string>(); List <string> tableNames = new List <string>(); if (!TablesIncludedInModel.ContainsKey(_selectedEntity)) { return; } _canonicalTableName = ItemTemplateUtilities.GetCanonicalIdentifier(_selectedEntity); if (TablesIncludedInModel.ContainsKey(_selectedEntity)) { frmName = string.Format("frm{0}", _canonicalTableName); formNames.Add(frmName); tableNames.Add(_selectedEntity); frmDesignerName = string.Format("frm{0}.designer", _canonicalTableName); WindowsFormsCodeGeneratorStrategy strategy = strategies[_selectedEntity]; AddBindings(vsProj, strategy, frmName, frmDesignerName); } // This line is a hack to avoid "Project Unavailable" exceptions. project = (Project)((Array)(dte.ActiveSolutionProjects)).GetValue(0); vsProj = project.Object as VSProject; ItemTemplateUtilities.RemoveTemplateForm(vsProj, _projectPath, _language); ItemTemplateUtilities.FixNamespaces(_language, _projectPath, _projectNamespace, _dataAccessTechnology); // Update the model name with the Conn string name ItemTemplateUtilities.UpdateModelName(project, frmName, _projectPath, _projectNamespace, _connectionName, _language); if (_dataAccessTechnology == DataAccessTechnology.EntityFramework5) { string formFile = Path.Combine(_projectPath, _language == LanguageGenerator.CSharp ? string.Format("{0}.cs", frmName) : string.Format("{0}.vb", frmName)); if (File.Exists(formFile)) { string contents = ""; contents = File.ReadAllText(formFile); string strToReplace = string.Format("ObjectResult<{0}> _entities = ctx.{0}.Execute(MergeOption.AppendOnly);", _selectedEntity); string strReplaceWith = string.Format("var _entities = ctx.{0}.ToList<{0}>();", _selectedEntity); contents = contents.Replace(strToReplace, strReplaceWith); File.WriteAllText(formFile, contents); } } SendToGeneralOutputWindow("Building Solution..."); project.DTE.Solution.SolutionBuild.Build(true); Settings.Default.WinFormsWizardConnection = _connectionName; Settings.Default.Save(); SendToGeneralOutputWindow("Finished item generation."); } catch (WizardException e) { SendToGeneralOutputWindow(string.Format("An error ocurred: {0}\n\n{1}", e.Message, e.StackTrace)); } #else throw new NotImplementedException(); #endif } else { vsProj = project.Object as VSProject; ItemTemplateUtilities.RemoveTemplateForm(vsProj, _projectPath, _language); } }
public GuiProxy(GuiType type) { this._type = type; }
public EventGui(GuiMenu guiMenu, GuiType guiType) { this.GuiMenu = guiMenu; this.Type = guiType; }
/// <summary> /// Factory method to get a concrete implementation. /// </summary> /// <param name="tech"></param> /// <param name="type"></param> /// <returns></returns> public static WindowsFormsCodeGeneratorStrategy GetInstance(StrategyConfig config) { WindowsFormsCodeGeneratorStrategy strategy = null; GuiType type = config.Type; switch (type) { case GuiType.IndividualControls: if (config.Language == LanguageGenerator.CSharp) { if (config.DataAccessTech == DataAccessTechnology.TypedDataSet) { strategy = new CSharpTypedDatasetIndividualControlsStrategy(config); } else { // Entity Framework strategy = new CSharpEntityFrameworkIndividualControlsStrategy(config); } } else { if (config.DataAccessTech == DataAccessTechnology.TypedDataSet) { strategy = new VBTypedDatasetIndividualControlsStrategy(config); } else { strategy = new VBEntityFrameworkIndividualControlsStrategy(config); } } break; case GuiType.Grid: if (config.Language == LanguageGenerator.CSharp) { if (config.DataAccessTech == DataAccessTechnology.TypedDataSet) { strategy = new CSharpTypedDatasetDataGridStrategy(config); } else { strategy = new CSharpEntityFrameworkDataGridStrategy(config); } } else { if (config.DataAccessTech == DataAccessTechnology.TypedDataSet) { strategy = new VBTypedDatasetDataGridStrategy(config); } else { strategy = new VBEntityFrameworkDataGridStrategy(config); } } break; case GuiType.MasterDetail: if (config.Language == LanguageGenerator.CSharp) { if (config.DataAccessTech == DataAccessTechnology.TypedDataSet) { strategy = new CSharpTypedDatasetMasterDetailStrategy(config); } else { strategy = new CSharpEntityFrameworkMasterDetailStrategy(config); } } else { if (config.DataAccessTech == DataAccessTechnology.TypedDataSet) { strategy = new VBTypedDatasetMasterDetailStrategy(config); } else { strategy = new VBEntityFrameworkMasterDetailStrategy(config); } } break; } return(strategy); }
public EventGui(GuiMenu guiMenu, GuiType guiType) { GuiMenu = guiMenu; Type = guiType; }
internal void ShowResumeUI(List <string> excluded) { _guiType = GuiType.Other; ShowPage(new ResumeUI(_mappingUI, excluded)); }
internal void ShowIntroUI() { _guiType = GuiType.Other; ShowPage(new IntroUI(this)); }
public override void Click() { if (!isMovingScreen) { nameBox.isSelected = false; phoneBox.isSelected = false; searchBox.isSelected = false; if (guiType == GuiType.Main) { if (searchBox.rect.Contains(Core.mNewState.X, Core.mNewState.Y)) { searchBox.isSelected = true; } else if (addContact.rect.Contains(Core.mNewState.X, Core.mNewState.Y)) { nameBox.stringDate = null; phoneBox.stringDate = null; guiType = GuiType.Add; return; } else if (searchBox.stringDate != null && searchBox.stringDate.Length > 0) { for (int i = 0; i < contactsSearched.Count; i++) { if (contactsSearched[i].fon.rect.Contains(Core.mNewState.X, Core.mNewState.Y)) { contactsSearched[i].Click(i); return; } } } else { for (int i = 0; i < contacts.Count; i++) { if (contacts[i].fon.rect.Contains(Core.mNewState.X, Core.mNewState.Y)) { contacts[i].Click(i); return; } } } } else if (guiType == GuiType.Add) { if (nameBox.rect.Contains(Core.mNewState.X, Core.mNewState.Y)) { nameBox.isSelected = true; } else if (phoneBox.rect.Contains(Core.mNewState.X, Core.mNewState.Y)) { phoneBox.isSelected = true; } else if (acceptAdd.rect.Contains(Core.mNewState.X, Core.mNewState.Y)) { if (nameBox.stringDate != null && nameBox.stringDate.Length > 0 && phoneBox.stringDate != null && phoneBox.stringDate.Length > 0) { Contact c = new Contact(phone, nameBox.stringDate, phoneBox.stringDate); contacts.Add(c); guiType = GuiType.Main; } } } else if (guiType == GuiType.Edit) { if (nameBox.rect.Contains(Core.mNewState.X, Core.mNewState.Y)) { nameBox.isSelected = true; } else if (phoneBox.rect.Contains(Core.mNewState.X, Core.mNewState.Y)) { phoneBox.isSelected = true; } else if (acceptAdd.rect.Contains(Core.mNewState.X, Core.mNewState.Y)) { if (nameBox.stringDate != null && nameBox.stringDate.Length > 0 && phoneBox.stringDate != null && phoneBox.stringDate.Length > 0) { contacts[editableContact].name = nameBox.stringDate; contacts[editableContact].number = phoneBox.stringDate; guiType = GuiType.Main; editableContact = -1; } } } } }
internal void ShowNetDirectoryUI(string netPath) { _guiType = GuiType.Other; ShowPage(new NetDirectoryUI(_mappingUI, netPath)); }
internal void ShowSettingsUI() { _guiType = GuiType.Other; ShowPage(new SettingsUI(_mappingUI)); }
internal void ShowAboutUI() { _guiType = GuiType.Other; ShowPage(new AboutUI(_mappingUI)); }