public RoomPropertiesDialog(PropertiesStartType start, int id) { InitializeComponent(); roomID = id; // load regions control cboRegion.Items.Clear(); foreach (var region in Settings.Regions.OrderBy(p => p.RegionName != Trizbort.Region.DefaultRegion).ThenBy(p => p.RegionName)) { cboRegion.Items.Add(region.RegionName); } cboRegion.DrawMode = DrawMode.OwnerDrawFixed; cboRegion.DrawItem += RegionListBox_DrawItem; if (Settings.Regions.Count > 0) { cboRegion.SelectedIndex = 0; } if (start == PropertiesStartType.Region) { m_tabControl.SelectedTabIndex = (int)Tab.Regions; cboRegion.Select(); } else { switch (mLastViewedTab) { case Tab.Objects: m_tabControl.SelectedTabIndex = 0; break; case Tab.Description: m_tabControl.SelectedTabIndex = 1; break; case Tab.Colors: m_tabControl.SelectedTabIndex = 2; break; case Tab.Regions: m_tabControl.SelectedTabIndex = 3; break; } if (start == PropertiesStartType.RoomName) { txtName.Focus(); } } }
public RoomPropertiesDialog(PropertiesStartType start, int id) { InitializeComponent(); roomID = id; // load regions control cboRegion.Items.Clear(); foreach (var region in Settings.Regions.OrderBy(p => p.RegionName != Trizbort.Region.DefaultRegion).ThenBy(p => p.RegionName)) { cboRegion.Items.Add(region.RegionName); } cboRegion.DrawMode = DrawMode.OwnerDrawFixed; cboRegion.DrawItem += RegionListBox_DrawItem; if (Settings.Regions.Count > 0) cboRegion.SelectedIndex = 0; if (start == PropertiesStartType.Region) { m_tabControl.SelectedTabIndex = (int) Tab.Regions; cboRegion.Select(); } else { switch (mLastViewedTab) { case Tab.Objects: m_tabControl.SelectedTabIndex = 0; break; case Tab.Description: m_tabControl.SelectedTabIndex = 1; break; case Tab.Colors: m_tabControl.SelectedTabIndex = 2; break; case Tab.Regions: m_tabControl.SelectedTabIndex = 3; break; } if (start == PropertiesStartType.RoomName) txtName.Focus(); } }
public RoomPropertiesDialog(PropertiesStartType start, int id) { InitializeComponent(); roomID = id; // load regions control cboRegion.Items.Clear(); foreach (var region in Settings.Regions.OrderBy(p => p.RegionName != Domain.Misc.Region.DefaultRegion) .ThenBy(p => p.RegionName)) { cboRegion.Items.Add(region.RegionName); } cboRegion.DrawMode = DrawMode.OwnerDrawFixed; cboRegion.DrawItem += RegionListBox_DrawItem; cboReference.Items.Add(""); foreach (var room in Project.Current.Elements.OfType <Room>().Where(p => p.ID != roomID).OrderBy(p => p.Name)) { cboReference.Items.Add(room); } if (Settings.Regions.Count > 0) { cboRegion.SelectedIndex = 0; } if (start == PropertiesStartType.Region) { m_tabControl.SelectedTab = tabRegions; cboRegion.Select(); } else { switch (mLastViewedTab) { case (int)Tab.Objects: m_tabControl.SelectedTab = tabObjects; break; case (int)Tab.Description: m_tabControl.SelectedTab = tabDescription; break; case (int)Tab.Colors: m_tabControl.SelectedTab = tabColors; break; case (int)Tab.Regions: m_tabControl.SelectedTab = tabRegions; break; case (int)Tab.RoomShapes: m_tabControl.SelectedTab = tabRoomShapes; break; } if (start == PropertiesStartType.RoomName) { txtName.Focus(); } } }