public PackForm(string levelTemplatePath, string packPath = null) { InitializeComponent(); cmLinePanel.MenuItems.Add(new MenuItem("Add", cmLinePanel_ClickAdd)); cmLinePanel.MenuItems.Add(new MenuItem("Add wizard...", cmLinePanel_ClickAddWizard)); cmLinePanel.MenuItems.Add(new MenuItem("Delete all", cmLinePanel_ClickDeleteAll)); cmButton.MenuItems.Add(new MenuItem("Insert", cmButton_ClickInsert)); cmButton.MenuItems.Add(new MenuItem("Insert wizard...", cmButton_ClickInsertWizard)); cmButton.MenuItems.Add(new MenuItem("Delete", cmButton_ClickDelete)); cmButton.MenuItems.Add(new MenuItem("Delete all", cmButton_ClickDeleteAll)); decimal zoomOut = (decimal)23 / Math.Max(ilSpawnItemTypesLarge.ImageSize.Width, ilSpawnItemTypesLarge.ImageSize.Height); ilSpawnItemTypesSmall.ImageSize = new Size((int)(ilSpawnItemTypesLarge.ImageSize.Width * zoomOut), (int)(ilSpawnItemTypesLarge.ImageSize.Height * zoomOut)); ilSpawnItemTypesSmall.Images.Clear(); foreach (string key in ilSpawnItemTypesLarge.Images.Keys) { ilSpawnItemTypesSmall.Images.Add(key, ilSpawnItemTypesLarge.Images[key]); } BeginBinding(); try { for (int i = 0; i < MaxAttachmentsForType; i++) { var gc = gvAttachmentTypes.Columns.Add(); gc.Name = AttachmentColNamePrefix + i.ToString(); gc.FieldName = gc.Name; gc.UnboundType = UnboundColumnType.String; gc.Visible = true; gc.Width = 30; } txtTime.Properties.Increment = (decimal)SpawnLine.DefaultDelay; txtSpawnItemDelay.Properties.Increment = (decimal)SpawnLine.DefaultDelay; for (int i = 0; ; i++) { string panelName = String.Format("pnlLine{0}", i + 1); if (!pnlLines.Controls.ContainsKey(panelName)) { break; } var pnlLine = (Panel)pnlLines.Controls[panelName]; _linePanels.Add(pnlLine); pnlLine.AllowDrop = true; pnlLine.ContextMenu = cmLinePanel; pnlLine.MouseDown += pnlLine_MouseDown; pnlLine.Paint += pnlLine_Paint; pnlLine.DragEnter += pnlLine_DragEnter; pnlLine.DragDrop += pnlLine_DragDrop; } InitTaskParamMap(); BindSpawnItem(null); Text = packPath; string packXml = packPath.IsNullOrWhiteSpace() ? null : File.ReadAllText(packPath); _pack = new Pack(File.ReadAllText(levelTemplatePath), packXml, this); LookupUtility.Configure(repCmbTaskCategory, Pack.TaskConfig.Categories); LookupUtility.Configure(repCmbTaskType, Pack.TaskConfig.Types); GridUtility.ConfigureInstantCommit(gvTasks, repCmbTaskCategory); GridUtility.ConfigureInstantCommit(gvTasks, repCmbTaskType); ConfigureSpawnItems(); gvAttachmentTypes.CellValueChanged += view_CellValueChanged; gvTasks.CellValueChanged += view_CellValueChanged; gvLevelItems.CellValueChanged += view_CellValueChanged; LoadLevel(true); // сбрасываем флаги в последнюю очередь, т.к. биндинг может привести к изменению значений bool isNew = packPath == null; IsNeedSave = isNew; IsNew = isNew; } finally { EndBinding(); } }
protected void ddlZone_SelectedIndexChanged(object sender, EventArgs e) { LookupUtility.BindBranchLookup(ddlBranch, SessionContext, Utility.GetLong(ddlZone.SelectedValue)); ddlBranch.ClearSelection(); }
protected void ddlRegionSearch_SelectedIndexChanged(object sender, EventArgs e) { LookupUtility.BindZoneLookup(ddlZoneSearch, SessionContext, Utility.GetLong(ddlRegionSearch.SelectedValue)); ddlZoneSearch.ClearSelection(); }