private void button3_Click(object sender, EventArgs e) { if (_selected == null) { _selected = new NPCEquipment { TemplateID = _templateId, ObjectId = null }; _equipment.Add(_selected); } BindingService.SyncData(_selected, this); // template id has changed if (!string.IsNullOrWhiteSpace(_selected.TemplateID) && _selected.TemplateID != _templateId) { _equipment.ForEach(x => { x.TemplateID = _selected.TemplateID; _npcEquipmentService.Save(x); }); LoadItems(_selected.TemplateID); return; } var templateId = _npcEquipmentService.Save(_selected); LoadItems(templateId); }
public string[] GetCompatibleMethodsInCodeBehind(CodeMemberMethod method) { ProjectDom ctx; IType fullClass = GetFullClass(out ctx); if (fullClass == null) { return(new string[0]); } IMethod MDMeth = BindingService.CodeDomToMDDomMethod(method); if (MDMeth == null) { return(null); } List <IMethod> compatMeth = new List <IMethod> (BindingService.GetCompatibleMethodsInClass(ctx, fullClass, MDMeth)); string[] names = new string[compatMeth.Count]; for (int i = 0; i < names.Length; i++) { names[i] = compatMeth[i].Name; } return(names); }
private void button1_Click(object sender, EventArgs e) { if (_mob == null) { _mob = new Mob { ObjectId = null }; } try { BindingService.SyncData(_mob, this); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } SyncFlags(); SyncWeaponSlots(); _mobService.SaveMob(_mob); BindingService.ClearData(this); }
// Item Remove private async void button8_Click(object sender, EventArgs e) { var model = GetSelected(); if (_model?.MobXLootTemplate == null || model == null) { return; } var confirmResult = MessageBox.Show(@"Are you sure to delete the selected object", @"Confirm Delete!!", MessageBoxButtons.YesNo); if (confirmResult != DialogResult.Yes) { return; } BindingService.ToggleEnabled(this); await _lootTemplateService.Remove(model); await LoadTemplate(_model.MobXLootTemplate.ObjectId); BindingService.ToggleEnabled(this); }
private void itemSave_Click_1(object sender, EventArgs e) { string id; if (_item == null) { _item = new ItemTemplate(); id = _item.Id_nb; } else { id = _item.Id_nb; } try { _item.AllowUpdate = true; BindingService.SyncData(_item, this); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } if (id != _item.Id_nb && !_itemService.UpdateId(id, _item.Id_nb, _item.ObjectId)) { MessageBox.Show(@"Unfortunately Id_nb cannot be changed. Please update manually if needed."); return; } var itemId = _itemService.SaveItem(_item); LoadItem(itemId); }
private void dataGridView1_SelectionChanged(object sender, EventArgs e) { BindingService.ClearData(this); pictureBox1.Image = null; _TemplateID.Text = _templateId; var selected = GetSelected(); if (selected == null) { _selected = null; return; } groupBox1.Text = selected.Value; _Slot.SelectedItem = _Slot.Items.Cast <ComboboxService.SelectItemModel>().First(x => x.Id == selected.SlotId); if (selected.Item == null) { _selected = null; return; } _selected = selected.Item; BindingService.BindData(selected.Item, this); _imageService.LoadItem(selected.Item.Model, pictureBox1.Width, pictureBox1.Height) .ContinueWith(x => _imageService.AttachImage(pictureBox1, x)); }
private async Task LoadTemplate(string templateId) { if (string.IsNullOrWhiteSpace(templateId)) { return; } Clear(); _model = await _lootTemplateService.Get(templateId); if (_model == null) { MessageBox.Show($@"Object with ObjectId: {templateId} not found", @"Object not found"); return; } BindingService.BindData(_model.MobXLootTemplate, this); _MobXLootTemplate_ID.Text = _model.MobXLootTemplate.ObjectId; var mob = _mobs.FirstOrDefault(x => _model.MobXLootTemplate.MobName == x.Name); if (mob != null) { await _modelImageService.LoadMob(mob.Model, pictureBox2.Width, pictureBox2.Height) .ContinueWith(x => pictureBox2.Image = x.Result); } var bindingList = new BindingList <LootTemplate>(_model.LootTemplates); var source = new BindingSource(bindingList, null); dataGridView1.DataSource = source; SetGridColumns(); }
private void Clear() { _model = null; BindingService.ClearData(this); dataGridView1.DataSource = null; pictureBox1.Image = null; pictureBox2.Image = null; }
public string[] GetCompatibleMethodsInCodeBehind(CodeMemberMethod method) { if (codeBehindClass == null) { return(new string[0]); } return(BindingService.GetCompatibleMethodsInClass(codeBehindClass, method)); }
//TODO: make this work with inline code #region event binding public bool IdentifierExistsInCodeBehind(string trialIdentifier) { if (codeBehindClass == null) { return(false); } return(BindingService.IdentifierExistsInClass(codeBehindClass, trialIdentifier)); }
public void SetUp() { productService = new DefaultProductService(); distributorService = new DefaultDistributorService(); qrcodeService = new DefaultQrCodeService(); bindingService = new DefaultBindingService(); applicationContext = new ApplicationContext(); applicationContext.ConfigureHibernateMapping(); }
public string GenerateIdentifierUniqueInCodeBehind(string trialIdentifier) { if (fullClass == null) { return(trialIdentifier); } return(BindingService.GenerateIdentifierUniqueInClass(fullClass, trialIdentifier)); }
private void Clear() { BindingService.ClearData(this); _equipment = new List <NPCEquipment>(); pictureBox1.Image = null; _templateId = null; dataGridView1.Rows.Clear(); dataGridView1.Columns.Clear(); }
private void StartForm() { SessionSQLService.Create(); this.WindowState = FormWindowState.Maximized; List <Book> books = SessionSQLService.FindAllBooks(); SessionSQLService.Close(); dtBooks = BindingService.BindingReaderTable(books); dgvListBooks.DataSource = dtBooks; }
public ActionResult Edit(BindingViewModel viewModel, int?page) { if (ModelState.IsValid) { var binding = AutoMapper.Mapper.Map <BindingViewModel, IBinding>(viewModel); PopulateSelectListsToModel(viewModel, binding); BindingService.CreateOrUpdate(binding); return(RedirectToAction("Index", new { page })); } return(View(viewModel)); }
public ActionResult Delete(int id, int?page) { var binding = BindingService.GetById(id); if (binding != null) { BindingService.Delete(binding); } return(RedirectToAction("Index", new { page })); }
public string GenerateIdentifierUniqueInCodeBehind(string trialIdentifier) { ProjectDom ctx; IType fullClass = GetFullClass(out ctx); if (fullClass == null) { return(trialIdentifier); } return(BindingService.GenerateIdentifierUniqueInClass(ctx, fullClass, trialIdentifier)); }
public bool IdentifierExistsInCodeBehind(string trialIdentifier) { ProjectDom ctx; IType fullClass = GetFullClass(out ctx); if (fullClass == null) { return(false); } return(BindingService.IdentifierExistsInClass(ctx, fullClass, trialIdentifier)); }
public ActionResult Index(int?page) { var viewModel = new BindingListViewModel(); var pageNumber = (page ?? 1) - 1; long totalCount; IEnumerable <IBinding> bindings = BindingService.GetAll(pageNumber, PageSize, out totalCount); viewModel.Bindings = new StaticPagedList <IBinding>(bindings, pageNumber + 1, PageSize, (int)totalCount); return(View(viewModel)); }
public ActionResult Edit(long?id, int?page) { if (id.HasValue) { var viewModel = AutoMapper.Mapper.Map <IBinding, BindingViewModel>(BindingService.GetById(id.Value)); viewModel.Websites = WebsiteService.GetAll().ToList(); viewModel.SelectableServers = ServerService.GetAll().ToList(); viewModel.SelectableEnvironments = EnvironmentService.GetAll().ToList(); return(View(viewModel)); } return(RedirectToAction("Create")); }
public bool ShowMethod(CodeMemberMethod method) { if (codeBehindClass == null) { return(false); } Gtk.Application.Invoke(delegate { BindingService.CreateAndShowMember(codeBehindClass, method); }); return(true); }
//Template Save private async void button10_Click(object sender, EventArgs e) { var model = _model?.MobXLootTemplate ?? new MobXLootTemplate(); BindingService.SyncData(model, this); BindingService.ToggleEnabled(this); var objectId = await _lootTemplateService.Save(model); await LoadTemplate(objectId); BindingService.ToggleEnabled(this); }
private void button1_Click(object sender, System.EventArgs e) { if (_template == null) { return; } BindingService.SyncData(_template, this); SyncFlags(); SyncWeaponSlots(); _npcTemplateService.Save(_template); BindingService.ClearData(this); }
public TypeAnnotationPass(DeclarationFinder declarationFinder, VBAExpressionParser expressionParser) { _declarationFinder = declarationFinder; var typeBindingContext = new TypeBindingContext(_declarationFinder); var procedurePointerBindingContext = new ProcedurePointerBindingContext(_declarationFinder); _bindingService = new BindingService( _declarationFinder, new DefaultBindingContext(_declarationFinder, typeBindingContext, procedurePointerBindingContext), typeBindingContext, procedurePointerBindingContext); _expressionParser = expressionParser; }
public bool ShowMethod(CodeMemberMethod method) { if (nonDesignerClass == null) { return(false); } Gtk.Application.Invoke(delegate { BindingService.CreateAndShowMember(project, fullClass.GetDefinition(), nonDesignerClass, method); }); return(true); }
public MainView(IResolver resolver) { _resolver = resolver; _binding = new BindingService(); _binding.RegisterAdapterFactory <Control>( arg => new ControlBindingAdapter(arg)); _binding.RegisterAdapterFactory <ToolStripItem>( arg => new ToolStripItemBindingAdapter(arg)); SetStyle(ControlStyles.Opaque | ControlStyles.AllPaintingInWmPaint, true); InitializeComponent(); Icon = ResourceImages.IconApp; Bind(); }
private void Insertspell_Click(object sender, EventArgs e) { _spell = new DBSpell { AllowAdd = true }; SyncSpell(); _spell.ObjectId = null; _spell.SpellID = _spellService.GetNextSpellId(); _spellService.Save(_spell); BindingService.ClearData(this); }
private void button2_Click(object sender, System.EventArgs e) { var dialogResult = MessageBox.Show(@"You are about to create a new NPC Template record.\nAre you sure this is what you want to do?", @"Insert new NPC Template", MessageBoxButtons.YesNo); if (dialogResult != DialogResult.Yes) { return; } _template = new DBNpcTemplate(); BindingService.SyncData(_template, this); SyncFlags(); SyncWeaponSlots(); _template.ObjectId = null; _npcTemplateService.Save(_template); BindingService.ClearData(this); }
private async Task LoadSpell(string spellId) { if (string.IsNullOrWhiteSpace(spellId)) { return; } _spell = await _spellService.Get(spellId); if (_spell == null) { MessageBox.Show($@"Object with ObjectId: {spellId} not found", @"Object not found"); return; } BindingService.BindData(_spell, this); }
// Item Save private async void button9_Click(object sender, EventArgs e) { var model = GetSelected(); if (_model?.MobXLootTemplate == null || model == null) { return; } BindingService.SyncData(model, this); BindingService.ToggleEnabled(this); await _lootTemplateService.Save(model); await LoadTemplate(_model.MobXLootTemplate.ObjectId); BindingService.ToggleEnabled(this); }