private void imageLabel_Input_Click(object sender, EventArgs e) { double dv = 0; if (sender is ImageLabel) { ImageLabel lb = (ImageLabel)sender; KeypadForm f = KeypadForm.GetKeypadForm(lb.Text); if (f.ShowDialog() == DialogResult.OK) { { try { dv = Convert.ToDouble(f.KeyText); lb.Text = dv.ToString("0.0"); } catch (Exception) { //MessageBox.Show("输入非法!"); MessageBox.Show("输入非法!", "", MessageBoxButtons.YesNo, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1); } } } } }
public IEnumerable <Label> GetLabels(Topic topic, ImageLabel imageLabel) { #region validation if (topic == null) { throw new ArgumentNullException(nameof(topic)); } if (imageLabel == null) { throw new ArgumentNullException(nameof(imageLabel)); } #endregion IEnumerable <Label> labels = FileSession.Execute((fileName, filePath) => { if (!FileContainer.ExistsFile(fileName, filePath)) { return(new List <Label>()); } using (StreamReader streamReader = EncodingUtil.GetStreamReader(FileContainer.GetFileStream(fileName, filePath))) { string labelContentJson = streamReader.ReadToEnd(); return(JsonConvert.DeserializeObject <IEnumerable <Label> >(labelContentJson)); } }, GetLabelFileName(imageLabel.Url), GetLabelsPath(topic)); imageLabel.SetLabels(labels); return(labels); }
private void AddAudioOptions() { var colX = XPos(0.75f); var iconYOffset = 14; var margin = 10; var iconWidth = 48; Add(UiLabels.Option("Audio", new Vector2(colX, Height(0)))); Add(UiButtons.SmallIcon("Icons/MinusGreen", new Vector2(colX, Height(1) + iconYOffset), () => { CurrentOptions.Update((x) => x.SoundVolume = Math.Max(x.SoundVolume - 0.1f, 0)); _soundVolume.Text = GetSoundVolumeText(); })); _soundVolume = VolumeLabel(GetSoundVolumeText(), new Vector2(colX + iconWidth + margin, Height(1)), Color.White); Add(_soundVolume); Add(UiButtons.SmallIcon("Icons/PlusGreen", new Vector2(colX + 240 + iconWidth + margin * 2, Height(1) + iconYOffset), () => { CurrentOptions.Update((x) => x.SoundVolume = Math.Min(x.SoundVolume + 0.1f, 1)); _soundVolume.Text = GetSoundVolumeText(); })); Add(UiButtons.SmallIcon("Icons/MinusGreen", new Vector2(colX, Height(2) + iconYOffset), () => { CurrentOptions.Update((x) => x.MusicVolume = Math.Max(x.MusicVolume - 0.1f, 0)); _musicVolume.Text = GetMusicVolumeText(); })); _musicVolume = VolumeLabel(GetMusicVolumeText(), new Vector2(colX + iconWidth + margin, Height(2)), Color.White); Add(_musicVolume); Add(UiButtons.SmallIcon("Icons/PlusGreen", new Vector2(colX + 240 + iconWidth + margin * 2, Height(2) + iconYOffset), () => { CurrentOptions.Update((x) => x.MusicVolume = Math.Min(x.MusicVolume + 0.1f, 1)); _musicVolume.Text = GetMusicVolumeText(); })); }
public IEnumerable <Label> SaveLabels(Topic topic, ImageLabel image) { #region validation if (topic == null) { throw new ArgumentNullException(nameof(topic)); } if (image == null) { throw new ArgumentNullException(nameof(image)); } #endregion if (image.Labels != null) { if (image.Labels.Count > 0) { IEnumerable <Label> result = LabelRepository.CreateLabels(topic, image); return(result); } else { LabelRepository.DeleteLabels(topic, image); return(new List <Label>()); } } return(null); }
public TableEnemyCandidateControl(FormCompass parent) { #region Initialize Parent = parent; ToolTipInfo = parent.ToolTipInfo; ShipNames = new ImageLabel[6]; for (int i = 0; i < ShipNames.Length; i++) { ShipNames[i] = InitializeImageLabel(); ShipNames[i].Cursor = Cursors.Help; ShipNames[i].MouseClick += TableEnemyCandidateControl_MouseClick; } Formation = InitializeImageLabel(); Formation.Anchor = AnchorStyles.None; Formation.ImageAlign = ContentAlignment.MiddleLeft; Formation.ImageList = ResourceManager.Instance.Icons; Formation.ImageIndex = -1; AirSuperiority = InitializeImageLabel(); AirSuperiority.Anchor = AnchorStyles.Right; AirSuperiority.ImageAlign = ContentAlignment.MiddleLeft; AirSuperiority.ImageList = ResourceManager.Instance.Equipments; AirSuperiority.ImageIndex = (int)ResourceManager.EquipmentContent.CarrierBasedFighter; ConfigurationChanged(); #endregion }
public MainMenuGame() { RegisterMouseEvent(); UIManager.RemoveAll(); bgVolume = new Bar("UI/IL_Setting", "Setting"); //bgVolume.Position = new Vector2(0, 0); bgVolume.Enable = true; UIManager.Add(bgVolume); imageLabelClassical = new ImageLabel("UI/IL_Classical", Vector2.Zero); imageLabelClassical.Alpha = 0.9f; imageLabelAbout = new ImageLabel("UI/IL_About", Vector2.Zero); imageLabelAbout.Alpha = 0.9f; imageLabelSetting = new ImageLabel("UI/IL_Setting", Vector2.Zero); imageLabelSetting.Alpha = 0.9f; jellyObjectList.Add(new JellyBox(graphicsDevice, jellyUnitMass, jellyUnitSize, Color.Orange, new JellyVector2(-75, 150))); jellyObjectList.Add(new JellyBox(graphicsDevice, jellyUnitMass, jellyUnitSize, Color.Pink, new JellyVector2(75, 200))); jellyObjectList.Add(new JellyBox(graphicsDevice, jellyUnitMass, jellyUnitSize, Color.OrangeRed, new JellyVector2(-75, 250))); jellyObjectList.Add(new JellyBox(graphicsDevice, jellyUnitMass, jellyUnitSize, Color.Chocolate, new JellyVector2(75, 300))); LoadResource(); }
private ImageLabelNavigationResult GetImageLabelNavigationResult(Topic topic, NavigationParameter navigationParameter, ENavigationDirection navigationDirection) { // get list of all image labels List <ImageLabel> imageLabels = this.ImageService.GetImageLabels(topic).ToList(); // fill imagelabel-structure of image label ImageLabel navigationImageLabel = imageLabels.Navigate(navigationDirection, navigationParameter.Index); if (navigationImageLabel == null) { // return http-404 if no label found return(null); } // create naviation result return(new ImageLabelNavigationResult { ImageLabel = this.ImageService.Navigate(topic, (uint)navigationImageLabel.Index), ImageCount = imageLabels.Count, HasNextBlank = imageLabels.HasNextBlank(navigationImageLabel), HasNext = imageLabels.HasNext(navigationImageLabel), HasPrevious = imageLabels.HasPrevious(navigationImageLabel), HasPreviousBlank = imageLabels.HasPreviousBlank(navigationImageLabel) }); }
public IEnumerable <Label> GetLabels(Topic topic, ImageLabel image) { #region validation if (topic == null) { throw new ArgumentNullException(nameof(topic)); } if (image == null) { throw new ArgumentNullException(nameof(image)); } #endregion IEnumerable <Label> labels = FileSession.Execute((fileName, filePath) => { if (!FileContainer.ExistsFile(fileName, filePath)) { return(new List <Label>()); } using (Stream labelFileStream = FileContainer.GetFileStream(fileName, filePath)) { return(LabelStoreUtil.GetLabelsFromStream(labelFileStream)); } }, image.GetLabelFileName(), GetLabelsPath(topic)); image.SetLabels(labels); return(labels); }
public ImageNavigationResult GetNavigationResult(Topic topic, long startIndex, ELabelMode labelMode, ENavigationDirection navigationDirection) { #region valdiation if (topic == null) { throw new ArgumentNullException(nameof(topic)); } if (!Enum.IsDefined(typeof(ELabelMode), labelMode)) { throw new ArgumentException(nameof(labelMode)); } if (!Enum.IsDefined(typeof(ENavigationDirection), navigationDirection)) { throw new ArgumentException(nameof(navigationDirection)); } #endregion // get list of all image labels IList <ImageLabel> images = ImageRepository.GetImages(topic); // fill imagelabel-structure of image label ImageLabel image = images.Navigate(labelMode, navigationDirection, (int)startIndex); return(CreateImageNavigationResult(topic, image, images, labelMode)); }
public ShoppingItemUI(IItem item, int i, Action whenBought) { _playerAccount = CurrentGameState.State.PlayerAccount; Branch = new ClickUIBranch(item.Name, (int)ClickUIPriorities.Pad); var x = (i % 4) * (Sizes.Item.Width + Sizes.Margin); var y = (i / 4) * (Sizes.Item.Height + Sizes.Margin * 2 + Sizes.Button.Height); _transform = new Transform2(new Vector2((int)x, (int)y)); _productDetails = new ImageWithDescription("Images/Items/" + item.Name.ToLower().Replace(" ", "-").Replace(".", ""), item.Description, new Transform2(Sizes.Item)); _label = new Label { BackgroundColor = Color.Transparent, TextColor = Color.White, Font = "Fonts/14", Transform = new Transform2(new Vector2(0, Sizes.Item.Height + 5), new Size2(Sizes.Item.Width, 30)), RawText = item.Name + " - $" + item.Cost.Amount() }; _amount = item.Cost.Amount(); _button = ImageTextButtonFactory.Create("Buy", new Vector2(0, Sizes.Item.Height + Sizes.SmallMargin + 30), () => { if (_playerAccount.Amount() >= _amount) { whenBought(); } }); _disabledButton = new ImageLabel("Buy", "Images/UI/button-disable", new Transform2(new Vector2(0, Sizes.Item.Height + Sizes.SmallMargin + 30), Sizes.Button)); Branch.Add(_button); Branch.Add(_productDetails); }
public ImageLabel GetImageByIndex(Topic topic, uint index) { #region validation if (topic == null) { throw new ArgumentNullException(nameof(topic)); } #endregion // get all imagefile paths IEnumerable <string> imageFilePaths = GetImagePaths(topic); if (imageFilePaths.Count() > index) { // get imagefilepath for specified index string imagePath = GetImagePaths(topic).ElementAt((int)index); // create default imagelabel and set index ImageLabel imageLabel = CreateImageLabel(imagePath); imageLabel.Index = index; imageLabel.SetImageUrl(HttpContextAccessor.HttpContext, topic); SetImageSize(topic, imageLabel); return(imageLabel); } return(null); }
private void AddMenuItems(MobileRemoteUI parentForm, Bitmap expand, Bitmap menuDown, Bitmap menuUp, Font font, List <ImageLabel> labels, int y, Menu.MenuItemCollection menuItems, IList container) { _clickedButton = null; foreach (MenuItem menuItem in menuItems) { // TODO: handle disabled menu items ImageLabel label = new ImageLabel(this); label.Height = (int)(60 * MobileRemoteUI.ScaleFactor.Height); label.Width = this.Width + 4; label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; label.Location = new Point(-2, y); label.Click += new EventHandler(label_Click); label.Text = menuItem.Text.Replace("&", ""); label.Font = font; label.MenuItem = menuItem; label.SelectedImage = menuDown; label.RegularImage = menuUp; label.ExpandImage = expand; label.ItemActivated += new EventHandler(label_ItemActivated); label.Tag = menuItem; labels.Add(label); if (labels != container) { container.Add(label); } y += label.Height + 1; } }
public TableFleetControl(FormFleetOverview parent, int fleetID) { #region Initialize Number = new ImageLabel { Anchor = AnchorStyles.Left, ImageAlign = ContentAlignment.MiddleCenter, Padding = new Padding(0, 1, 0, 1), Margin = new Padding(2, 1, 2, 1), Text = $"#{fleetID}:", AutoSize = true }; State = new FleetState { Anchor = AnchorStyles.Left, Padding = new Padding(), Margin = new Padding(), AutoSize = true }; ConfigurationChanged(parent); this.fleetID = fleetID; ToolTipInfo = parent.ToolTipInfo; #endregion }
private void SurveillanceOnFaceDetected(Mat mat, List <Rectangle> faces, List <Rectangle> eyes) { //todo : maybe just put additional level of rectangles on what is already there; var frame = mat.Clone(); foreach (Rectangle face in faces) { CvInvoke.Rectangle(frame, face, new Bgr(Color.Red).MCvScalar, 2); } foreach (Rectangle eye in eyes) { CvInvoke.Rectangle(frame, eye, new Bgr(Color.Blue).MCvScalar, 2); } imageBox2.Image = frame; var text = LabelText; if (checkBoxCapture.Checked && faces.Count == 1 && eyes.Count == 2 && text != null && text.Length > 0) { MemoryStream imageMemoryStream = new MemoryStream(); Image imageToTrain = mat.Bitmap; imageToTrain.Save(imageMemoryStream, ImageFormat.Png); var directory = String.Format("{0}/Output", Directory.GetCurrentDirectory()); var imageLabel = new ImageLabel(text, imageMemoryStream.ToArray()); var dal = new FileSystemDAL(directory); dal.Add(imageLabel); } }
/// <summary> /// グループデータにGUIからの操作を適用します。 /// </summary> private void ApplyGroupData(ImageLabel target) { if (target != null) { target.BackColor = TabInactiveColor; //ソート順の保持 if (KCDatabase.Instance.Ships.Count == 0) { return; } ShipGroupData g = KCDatabase.Instance.ShipGroup[(int)target.Tag]; if (g == null) { return; } g.Members.Clear(); g.Members.Capacity = ShipView.Rows.GetRowCount(DataGridViewElementStates.None); foreach (DataGridViewRow row in ShipView.Rows) { g.Members.Add((int)row.Cells[ShipView_ID.Index].Value); } g.ColumnFilter = ShipView.Columns.OfType <DataGridViewColumn>().Select(c => c.Visible).ToList(); g.ColumnWidth = ShipView.Columns.OfType <DataGridViewColumn>().Select(c => c.Width).ToList(); g.ColumnAutoSize = MenuMember_ColumnAutoSize.Checked; g.LockShipNameScroll = MenuMember_LockShipNameScroll.Checked; } }
public TableFleetControl(FormFleetOverview parent, int fleetID) { #region Initialize Number = new ImageLabel(); Number.Anchor = AnchorStyles.Left; Number.ImageAlign = ContentAlignment.MiddleCenter; Number.Font = parent.Font; Number.Margin = new Padding(3, 2, 3, 2); Number.Text = string.Format("#{0}:", fleetID); Number.Tag = null; State = new ImageLabel(); State.Anchor = AnchorStyles.Left; State.Font = parent.Font; State.Margin = new Padding(3, 2, 3, 2); State.ImageList = ResourceManager.Instance.Icons; State.Text = "-"; State.Tag = FleetData.FleetStates.NoShip; this.fleetID = fleetID; ToolTipInfo = parent.ToolTipInfo; #endregion }
private IEnumerable <ImageLabel> GetImageLabels(Topic topic) { #region validation if (topic == null) { throw new ArgumentNullException(nameof(topic)); } #endregion List <ImageLabel> imageLabelList = new List <ImageLabel>(); long index = 0L; foreach (string imagePath in GetImagePaths(topic)) { string imageFileName = FileNameUtil.GetFileNameFromPath(imagePath); ImageLabel imgLabel = CreateImageLabel(imagePath); imgLabel.Index = index++; imgLabel.SetImageUrl(HttpContextAccessor.HttpContext, topic); imageLabelList.Add(imgLabel); } return(imageLabelList); }
public void SetImageSize(Topic topic, ImageLabel image) { #region validation if (topic == null) { throw new ArgumentNullException(nameof(topic)); } if (image == null) { throw new ArgumentNullException(nameof(image)); } #endregion using (System.IO.Stream imageStream = FileContainer.GetFileStream(image.Id, GetImageFolder(topic))) { if (ImageUtil.IsValidImage(imageStream, image.Id)) { Rect imageDimension = ImageUtil.GetDimensionFromImage(imageStream); image.Height = imageDimension.Height; image.Width = imageDimension.Width; } } }
private void MenuGroup_Delete_Click(object sender, EventArgs e) { ImageLabel senderLabel = MenuGroup.SourceControl as ImageLabel; if (senderLabel == null) { return; //想定外 } ShipGroupData group = KCDatabase.Instance.ShipGroup[(int)senderLabel.Tag]; if (group != null && group.GroupID >= 0) { if (MessageBox.Show(string.Format("グループ [{0}] を削除しますか?\r\nこの操作は元に戻せません。", group.Name), "確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes) { if (SelectedTab == senderLabel) { ShipView.Rows.Clear(); SelectedTab = null; } KCDatabase.Instance.ShipGroup.ShipGroups.Remove(group); TabPanel.Controls.Remove(senderLabel); senderLabel.Dispose(); } } else { MessageBox.Show("このグループは削除できません。", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public TableEnemyMemberControl(FormCompass parent) { #region Initialize Parent = parent; ToolTipInfo = parent.ToolTipInfo; ShipName = new ImageLabel(); ShipName.Anchor = AnchorStyles.Left; ShipName.ForeColor = parent.MainFontColor; ShipName.ImageAlign = ContentAlignment.MiddleCenter; ShipName.Padding = new Padding(0, 1, 0, 1); ShipName.Margin = new Padding(2, 0, 2, 0); ShipName.MaximumSize = new Size(60, 20); ShipName.AutoEllipsis = true; ShipName.AutoSize = true; ShipName.Cursor = Cursors.Help; ShipName.MouseClick += ShipName_MouseClick; Equipments = new ShipStatusEquipment(); Equipments.SuspendLayout(); Equipments.Anchor = AnchorStyles.Left; Equipments.Padding = new Padding(0, 2, 0, 1); Equipments.Margin = new Padding(2, 0, 2, 0); Equipments.Size = new Size(40, 20); //checkme: 要る? Equipments.AutoSize = true; Equipments.ResumeLayout(); ConfigurationChanged(); #endregion }
private void UpdateIconName(ImageLabel imageLabel, APFirmware.FirmwareInfo first) { if (first == null) { return; } if (this.Disposing) { return; } if (this.IsDisposed) { return; } this.BeginInvoke((MethodInvoker) delegate { if (String.IsNullOrEmpty(first.MavFirmwareVersionStr)) { imageLabel.Text = first.VehicleType?.ToString() + " " + first.MavFirmwareVersion.ToString() + " " + first.MavFirmwareVersionType.ToString(); } else { imageLabel.Text = first.VehicleType?.ToString() + " " + first.MavFirmwareVersionStr + " " + first.MavFirmwareVersionType.ToString(); } this.Enabled = true; }); }
/// <summary> /// 艦隊の状態の情報をもとにラベルを更新します。 /// </summary> /// <param name="label">更新するラベル。</param> /// <param name="state">艦隊の状態。</param> /// <param name="timer">日時。</param> public static void RefreshFleetState(ImageLabel label, FleetStates state, DateTime timer) { switch (state) { case FleetStates.Damaged: case FleetStates.SortieDamaged: label.BackColor = DateTime.Now.Second % 2 == 0 ? Color.LightCoral : Color.Transparent; break; case FleetStates.Docking: label.Text = FleetRes.Docking + DateTimeHelper.ToTimeRemainString(timer); break; case FleetStates.Expedition: label.Text = FleetRes.OnExped + DateTimeHelper.ToTimeRemainString(timer); break; case FleetStates.Tired: label.Text = FleetRes.Fatigued + DateTimeHelper.ToTimeRemainString(timer); break; case FleetStates.AnchorageRepairing: label.Text = FleetRes.AnchorageRepairing + DateTimeHelper.ToTimeElapsedString(KCDatabase.Instance.Fleet.AnchorageRepairingTimer); break; } }
public TablePresetControl(FormFleetPreset parent) { ImageLabel CreateDefaultLabel() { return(new ImageLabel { Text = "", Anchor = AnchorStyles.Left, ForeColor = parent.ForeColor, Tag = null, TextAlign = ContentAlignment.MiddleLeft, Padding = new Padding(0, 1, 0, 1), Margin = new Padding(2, 1, 2, 1), AutoEllipsis = false, AutoSize = true, Visible = true, ImageList = ResourceManager.Instance.Icons, ImageAlign = ContentAlignment.MiddleCenter, ImageIndex = -1 }); } Name = CreateDefaultLabel(); Name.ImageAlign = ContentAlignment.MiddleRight; // TODO: 本体側がもし 7 隻編成に対応したら変更してください Ships = new ImageLabel[6]; for (int i = 0; i < Ships.Length; i++) { Ships[i] = CreateDefaultLabel(); } _tooltip = parent.ToolTipInfo; }
private void MenuGroup_Rename_Click(object sender, EventArgs e) { ImageLabel senderLabel = MenuGroup.SourceControl as ImageLabel; if (senderLabel == null) { return; } ShipGroupData group = KCDatabase.Instance.ShipGroup[(int)senderLabel.Tag]; if (group != null && group.GroupID >= 0) { using (var dialog = new DialogTextInput("グループ名の変更", "グループ名を入力してください:")) { dialog.InputtedText = group.Name; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { group.Name = senderLabel.Text = dialog.InputtedText.Trim(); } } } else { MessageBox.Show("このグループの名前を変更することはできません。", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
/// <summary> /// 指定したグループIDに基づいてタブ ラベルを生成します。 /// </summary> private ImageLabel CreateTabLabel(int id) { ImageLabel label = new ImageLabel(); label.Text = KCDatabase.Instance.ShipGroup[id] != null ? KCDatabase.Instance.ShipGroup[id].Name : "全所属艦"; label.Anchor = AnchorStyles.Left; label.Font = ShipView.Font; label.BackColor = TabInactiveColor; label.BorderStyle = BorderStyle.FixedSingle; label.Padding = new Padding(4, 4, 7, 7); label.Margin = new Padding(0, 0, 0, 0); label.ImageAlign = ContentAlignment.MiddleCenter; label.AutoSize = true; label.Cursor = Cursors.Hand; //イベントと固有IDの追加(内部データとの紐付) label.Click += TabLabel_Click; label.MouseDown += TabLabel_MouseDown; label.MouseMove += TabLabel_MouseMove; label.MouseUp += TabLabel_MouseUp; label.ContextMenuStrip = MenuGroup; label.Tag = id; return(label); }
public void DeleteImage(Topic topic, string imageFileName) { #region validation if (topic == null) { throw new ArgumentNullException(nameof(topic)); } if (string.IsNullOrEmpty(imageFileName)) { throw new ArgumentNullException(nameof(imageFileName)); } #endregion ImageLabel imageLabel = CreateTemporaryImageLabel(topic, imageFileName); // remove all labels LabelService.DeleteLabels(topic, imageLabel); // remove image ImageFileRepository.DeleteImageFile(topic, imageFileName); ImageRepository.DeleteImage(topic, imageFileName); }
public IEnumerable <Label> SaveLabels(Topic topic, ImageLabel image, IEnumerable <Label> labels) { #region validation if (topic == null) { throw new ArgumentNullException(nameof(topic)); } if (image == null) { throw new ArgumentNullException(nameof(image)); } #endregion List <Label> result = new List <Label>(); if (labels != null) { if (labels.Any()) { result = LabelRepository.AddOrUpdateOrDeleteLabels(topic, image, labels).ToList(); } else { LabelRepository.DeleteLabels(topic, image); } } return(result); }
public IEnumerable <Label> GetLabels(Topic topic, ImageLabel imageLabel) { #region validation if (topic == null) { throw new ArgumentNullException(nameof(topic)); } if (imageLabel == null) { throw new ArgumentNullException(nameof(imageLabel)); } #endregion IEnumerable <Label> labels = LabelRepository.GetLabels(topic, imageLabel).ToList(); if (labels.Any(o => string.IsNullOrEmpty(o.ObjectClassName))) { // load objectclasses only when labels includes where name of objectclass is not set List <ObjectClass> objectClasses = ObjectClassRepository.GetObjectClasses(topic).ToList(); foreach (Label label in labels) { label.ObjectClassName = objectClasses.GetObjectClass(label.ObjectClassId).Name; } } return(labels); }
public void Add(ImageLabel image) { using (var context = new FaceRecognitionContext()) { context.ImageLabels.Add(image); context.SaveChanges(); } }
void ClearAircraftLabel(ImageLabel label) { label.Text = "-"; label.ForeColor = SystemColors.ControlText; label.ImageAlign = ContentAlignment.MiddleCenter; label.ImageIndex = -1; ToolTipInfo.SetToolTip(label, null); }
public GameBarPanel(Simulator simulator, double visualPriority) : base(simulator.Scene, new Vector3(0, (-simulator.Scene.Height / 2) + 34, 0), new Vector2(simulator.Scene.Width, 45), visualPriority, Color.White) { Simulator = simulator; ShowCloseButton = false; ShowFrame = false; BackgroundAlpha = 100; if (Preferences.Target == Core.Utilities.Setting.Xbox360) { Position += new Vector3(0, Preferences.DeadZoneV2.Y, 0); Padding = new Vector2(10 + Preferences.DeadZoneV2.X, 0); } CashWidget = new ImageLabel(new Image("ScoreMoney") { SizeX = 4 }, new Text(@"Pixelite") { SizeX = 3 }) { Position = Position + new Vector3(50, 0, 0), CanHover = true }; LivesWidget = new ImageLabel(new Image("ScoreLives") { SizeX = 4 }, new Text(@"Pixelite") { SizeX = 3 }) { Position = Position + new Vector3(250, 0, 0), CanHover = true }; TimeNextWaveText = new ImageLabel(new Image("ScoreTime") { SizeX = 4 }, new Text(@"Pixelite") { SizeX = 3 }) { Position = Position + new Vector3(850, 0, 0), CanHover = true }; RemainingWavesWidget = new ImageLabel(new Image("ScoreWaves") { SizeX = 4 }, new Text(@"Pixelite") { SizeX = 3 }) { Position = Position + new Vector3(700, 0, 0), CanHover = true }; NextWaveWidget = new NextWaveWidget() { Position = Position + new Vector3(1050, 0, 0) }; HBMessages = new Dictionary<string, List<KeyValuePair<string, PanelWidget>>>() { { @"None", new List<KeyValuePair<string, PanelWidget>>() { new KeyValuePair<string, PanelWidget>(@"msg", new Label(new Text("") { SizeX = 2 })) } }, { @"Cash", new List<KeyValuePair<string, PanelWidget>>() { new KeyValuePair<string, PanelWidget>(@"msg", new Label(new Text(@"Remaining money", @"Pixelite") { SizeX = 2 })) } }, { @"Lives", new List<KeyValuePair<string, PanelWidget>>() { new KeyValuePair<string, PanelWidget>(@"msg", new Label(new Text(@"Remaining lives", @"Pixelite") { SizeX = 2 })) } }, { @"Remaining", new List<KeyValuePair<string, PanelWidget>>() { new KeyValuePair<string, PanelWidget>(@"msg", new Label(new Text(@"Remaining waves", @"Pixelite") { SizeX = 2 })) } }, { @"Time", new List<KeyValuePair<string, PanelWidget>>() { new KeyValuePair<string, PanelWidget>(@"msg", new Label(new Text(@"Remaining time before next wave", @"Pixelite") { SizeX = 2 })) } }, { @"NextWave", new List<KeyValuePair<string, PanelWidget>>() { new KeyValuePair<string, PanelWidget>(@"msg", new Label(new Text(@"Composition of the next wave", @"Pixelite") { SizeX = 2 })) } } }; TimeNextWaveBuilder = new StringBuilder(); }
private void AddMenuItems(MobileRemoteUI parentForm, Bitmap expand, Bitmap menuDown, Bitmap menuUp, Font font, List<ImageLabel> labels, int y, Menu.MenuItemCollection menuItems, IList container) { _clickedButton = null; foreach (MenuItem menuItem in menuItems) { // TODO: handle disabled menu items ImageLabel label = new ImageLabel(this); label.Height = (int)(60 * MobileRemoteUI.ScaleFactor.Height); label.Width = this.Width + 4; label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; label.Location = new Point(-2, y); label.Click += new EventHandler(label_Click); label.Text = menuItem.Text.Replace("&", ""); label.Font = font; label.MenuItem = menuItem; label.SelectedImage = menuDown; label.RegularImage = menuUp; label.ExpandImage = expand; label.ItemActivated += new EventHandler(label_ItemActivated); label.Tag = menuItem; labels.Add(label); if (labels != container) { container.Add(label); } y += label.Height + 1; } }
void HandleSelections(ImageLabel selectedImage) { foreach (ImageLabel label in _currentLabels) { if (selectedImage != label) { label.Selected = false; } } selectedImage.Selected = true; _selectedIndex = _currentLabels.IndexOf(selectedImage); }
void ProcessChildChange(ImageLabel parentLabel) { _currentLabels = new List<ImageLabel>(); this._contentPanel.SuspendLayout(); this._contentPanel.Controls.Clear(); AddMenuItems(_ui, _expand, _menuDown, _menuUp, _font, _currentLabels, 5, parentLabel.MenuItem.MenuItems, this._contentPanel.Controls); foreach (ImageLabel button in _currentLabels) { this._contentPanel.Controls.Add(button); } ScaleWindow(_ui, true); if (_currentLabels.Count > 0) { HandleSelections(_currentLabels[0]); } this._contentPanel.ResumeLayout(); _selectedIndex = 0; }
void label_ItemActivated(object sender, EventArgs e) { this._clickedButton = (ImageLabel)sender; System.Reflection.MethodInfo x = this._clickedButton.MenuItem.GetType().GetMethod("OnPopup", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); x.Invoke(this._clickedButton.MenuItem, new object[] { null }); if (this._clickedButton.MenuItem.MenuItems.Count > 0) { ProcessChildChange(this._clickedButton); this._clickedButton = null; } else { this.Close(); } }
private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Firmware)); this.pictureBoxAPM = new ArdupilotMega.ImageLabel(); this.pictureBoxQuad = new ArdupilotMega.ImageLabel(); this.pictureBoxHexa = new ArdupilotMega.ImageLabel(); this.pictureBoxTri = new ArdupilotMega.ImageLabel(); this.pictureBoxY6 = new ArdupilotMega.ImageLabel(); this.lbl_status = new System.Windows.Forms.Label(); this.progress = new System.Windows.Forms.ProgressBar(); this.label2 = new System.Windows.Forms.Label(); this.pictureBoxHeli = new ArdupilotMega.ImageLabel(); this.BUT_setup = new ArdupilotMega.MyButton(); this.pictureBoxHilimage = new System.Windows.Forms.PictureBox(); this.pictureBoxAPHil = new System.Windows.Forms.PictureBox(); this.pictureBoxACHil = new System.Windows.Forms.PictureBox(); this.pictureBoxACHHil = new System.Windows.Forms.PictureBox(); this.pictureBoxOcta = new ArdupilotMega.ImageLabel(); this.pictureBoxOctav = new ArdupilotMega.ImageLabel(); this.label1 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxHilimage)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxAPHil)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxACHil)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxACHHil)).BeginInit(); this.SuspendLayout(); // // pictureBoxAPM // this.pictureBoxAPM.Cursor = System.Windows.Forms.Cursors.Hand; this.pictureBoxAPM.Image = null; resources.ApplyResources(this.pictureBoxAPM, "pictureBoxAPM"); this.pictureBoxAPM.Name = "pictureBoxAPM"; this.pictureBoxAPM.TabStop = false; this.pictureBoxAPM.Click += new System.EventHandler(this.pictureBoxAPM_Click); // // pictureBoxQuad // this.pictureBoxQuad.Cursor = System.Windows.Forms.Cursors.Hand; this.pictureBoxQuad.Image = null; resources.ApplyResources(this.pictureBoxQuad, "pictureBoxQuad"); this.pictureBoxQuad.Name = "pictureBoxQuad"; this.pictureBoxQuad.TabStop = false; this.pictureBoxQuad.Click += new System.EventHandler(this.pictureBoxQuad_Click); // // pictureBoxHexa // this.pictureBoxHexa.Cursor = System.Windows.Forms.Cursors.Hand; this.pictureBoxHexa.Image = null; resources.ApplyResources(this.pictureBoxHexa, "pictureBoxHexa"); this.pictureBoxHexa.Name = "pictureBoxHexa"; this.pictureBoxHexa.TabStop = false; this.pictureBoxHexa.Click += new System.EventHandler(this.pictureBoxHexa_Click); // // pictureBoxTri // this.pictureBoxTri.Cursor = System.Windows.Forms.Cursors.Hand; this.pictureBoxTri.Image = null; resources.ApplyResources(this.pictureBoxTri, "pictureBoxTri"); this.pictureBoxTri.Name = "pictureBoxTri"; this.pictureBoxTri.TabStop = false; this.pictureBoxTri.Click += new System.EventHandler(this.pictureBoxTri_Click); // // pictureBoxY6 // this.pictureBoxY6.Cursor = System.Windows.Forms.Cursors.Hand; this.pictureBoxY6.Image = null; resources.ApplyResources(this.pictureBoxY6, "pictureBoxY6"); this.pictureBoxY6.Name = "pictureBoxY6"; this.pictureBoxY6.TabStop = false; this.pictureBoxY6.Click += new System.EventHandler(this.pictureBoxY6_Click); // // lbl_status // resources.ApplyResources(this.lbl_status, "lbl_status"); this.lbl_status.Name = "lbl_status"; // // progress // resources.ApplyResources(this.progress, "progress"); this.progress.Name = "progress"; this.progress.Step = 1; // // label2 // resources.ApplyResources(this.label2, "label2"); this.label2.Name = "label2"; // // pictureBoxHeli // this.pictureBoxHeli.Cursor = System.Windows.Forms.Cursors.Hand; this.pictureBoxHeli.Image = null; resources.ApplyResources(this.pictureBoxHeli, "pictureBoxHeli"); this.pictureBoxHeli.Name = "pictureBoxHeli"; this.pictureBoxHeli.TabStop = false; this.pictureBoxHeli.Click += new System.EventHandler(this.pictureBoxHeli_Click); // // BUT_setup // resources.ApplyResources(this.BUT_setup, "BUT_setup"); this.BUT_setup.Name = "BUT_setup"; this.BUT_setup.UseVisualStyleBackColor = true; this.BUT_setup.Click += new System.EventHandler(this.BUT_setup_Click); // // pictureBoxHilimage // this.pictureBoxHilimage.Image = global::ArdupilotMega.Properties.Resources.hil; resources.ApplyResources(this.pictureBoxHilimage, "pictureBoxHilimage"); this.pictureBoxHilimage.Name = "pictureBoxHilimage"; this.pictureBoxHilimage.TabStop = false; // // pictureBoxAPHil // this.pictureBoxAPHil.Cursor = System.Windows.Forms.Cursors.Hand; this.pictureBoxAPHil.Image = global::ArdupilotMega.Properties.Resources.hilplane; resources.ApplyResources(this.pictureBoxAPHil, "pictureBoxAPHil"); this.pictureBoxAPHil.Name = "pictureBoxAPHil"; this.pictureBoxAPHil.TabStop = false; this.pictureBoxAPHil.Click += new System.EventHandler(this.pictureBoxAPHil_Click); // // pictureBoxACHil // this.pictureBoxACHil.Cursor = System.Windows.Forms.Cursors.Hand; this.pictureBoxACHil.Image = global::ArdupilotMega.Properties.Resources.hilquad; resources.ApplyResources(this.pictureBoxACHil, "pictureBoxACHil"); this.pictureBoxACHil.Name = "pictureBoxACHil"; this.pictureBoxACHil.TabStop = false; this.pictureBoxACHil.Click += new System.EventHandler(this.pictureBoxACHil_Click); // // pictureBoxACHHil // this.pictureBoxACHHil.Cursor = System.Windows.Forms.Cursors.Hand; this.pictureBoxACHHil.Image = global::ArdupilotMega.Properties.Resources.hilheli; resources.ApplyResources(this.pictureBoxACHHil, "pictureBoxACHHil"); this.pictureBoxACHHil.Name = "pictureBoxACHHil"; this.pictureBoxACHHil.TabStop = false; this.pictureBoxACHHil.Click += new System.EventHandler(this.pictureBoxACHHil_Click); // // pictureBoxOcta // this.pictureBoxOcta.Image = null; resources.ApplyResources(this.pictureBoxOcta, "pictureBoxOcta"); this.pictureBoxOcta.Name = "pictureBoxOcta"; this.pictureBoxOcta.TabStop = false; this.pictureBoxOcta.Click += new System.EventHandler(this.pictureBoxOcta_Click); // // pictureBoxOctav // this.pictureBoxOctav.Image = null; resources.ApplyResources(this.pictureBoxOctav, "pictureBoxOctav"); this.pictureBoxOctav.Name = "pictureBoxOctav"; this.pictureBoxOctav.TabStop = false; this.pictureBoxOctav.Click += new System.EventHandler(this.pictureBoxOctav_Click); // // label1 // resources.ApplyResources(this.label1, "label1"); this.label1.Name = "label1"; // // Firmware // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.label1); this.Controls.Add(this.BUT_setup); this.Controls.Add(this.label2); this.Controls.Add(this.lbl_status); this.Controls.Add(this.progress); this.Controls.Add(this.pictureBoxACHHil); this.Controls.Add(this.pictureBoxACHil); this.Controls.Add(this.pictureBoxAPHil); this.Controls.Add(this.pictureBoxHilimage); this.Controls.Add(this.pictureBoxOctav); this.Controls.Add(this.pictureBoxOcta); this.Controls.Add(this.pictureBoxHeli); this.Controls.Add(this.pictureBoxY6); this.Controls.Add(this.pictureBoxTri); this.Controls.Add(this.pictureBoxHexa); this.Controls.Add(this.pictureBoxQuad); this.Controls.Add(this.pictureBoxAPM); this.MinimumSize = new System.Drawing.Size(1008, 461); this.Name = "Firmware"; this.Load += new System.EventHandler(this.Firmware_Load); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxHilimage)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxAPHil)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxACHil)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxACHHil)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }