//リセット
        private static void ResetAirBaseBattle(UserControls.AirBaseCorpsLabelHandler handler, System.Windows.Forms.ToolTip tooltip, int index)
        {
            var reset = new Action<UserControls.AirBaseCorpsLabelHandler.AirCombatItem>(item =>
            {
                item.Stage1Enemy.Text = "";
                item.Stage1Player.Text = "";
                item.Stage2Enemy.Text = "";
                item.Stage2Player.Text = "";

                item.AttachPlayer.Text = "";
                tooltip.SetToolTip(item.AttachPlayer, null);
                item.AttachEnemy.Text = "";
                tooltip.SetToolTip(item.AttachEnemy, null);

                item.AirSupCondition.Text = "";
            });

            var b = handler.AirCombats[index];
            reset(b.First);
            reset(b.Second);
        }
		/// <summary>
		///     Recurs <c>Controls</c> members of the control to change
		///     corresponding texts.
		/// </summary>
		/// <param name="parent">
		///     Parent <c>Control</c> object.
		/// </param>
		/// <param name="resources">
		///     <c>ResourceManager</c> object.
		/// </param>
		private void RecurControls(System.Windows.Forms.Control parent, System.Resources.ResourceManager resources, System.Windows.Forms.ToolTip toolTip) {
			foreach (Control control in parent.Controls) {
				control.SuspendLayout();
				ReloadControlCommonProperties(control, resources);
				ReloadControlSpecificProperties(control, resources);
				if (toolTip != null) {
					toolTip.SetToolTip(control, (string)GetSafeValue(resources, control.Name + ".ToolTip", control.Text));
				}
				if (control is System.Windows.Forms.UserControl)
					RecurUserControl((System.Windows.Forms.UserControl)control);
				else {
					ReloadTextForSelectedControls(control, resources);
					ReloadListItems(control, resources);
					if (control is System.Windows.Forms.TreeView)
						ReloadTreeViewNodes((System.Windows.Forms.TreeView)control, resources);
					if (control.Controls.Count > 0)
						RecurControls(control, resources, toolTip);
				}
				control.ResumeLayout();
			}
		}
 public static void SetControlTooltip(Control control, System.Windows.Forms.ToolTip toolTip, string tip)
 {
     if (control.InvokeRequired)
         control.Invoke(new SetControlTooltipHandler(SetControlTooltip), new object[] { control, toolTip, tip });
     else
         toolTip.SetToolTip(control, tip);
 }
 internal override void UpdateActionItem(DesignerActionList actionList, DesignerActionItem actionItem, System.Windows.Forms.ToolTip toolTip, ref int currentTabIndex)
 {
     this._textItem = (DesignerActionTextItem) actionItem;
     this._label.Text = DesignerActionPanel.StripAmpersands(this._textItem.DisplayName);
     this._label.Font = this.GetFont();
     this._label.TabIndex = currentTabIndex++;
     toolTip.SetToolTip(this._label, this._textItem.Description);
 }
 protected override void OnPropertyTaskItemUpdated(System.Windows.Forms.ToolTip toolTip, ref int currentTabIndex)
 {
     this._label.Text = DesignerActionPanel.StripAmpersands(base.PropertyItem.DisplayName);
     this._label.TabIndex = currentTabIndex++;
     toolTip.SetToolTip(this._label, base.PropertyItem.Description);
     this._textBoxDirty = false;
     if (this.IsReadOnly())
     {
         this._readOnlyTextBoxLabel.Visible = true;
         this._textBox.Visible = false;
         this._textBox.Location = new Point(0x7fffffff, 0x7fffffff);
         this._editControl = this._readOnlyTextBoxLabel;
     }
     else
     {
         this._readOnlyTextBoxLabel.Visible = false;
         this._readOnlyTextBoxLabel.Location = new Point(0x7fffffff, 0x7fffffff);
         this._textBox.Visible = true;
         this._editControl = this._textBox;
     }
     this._editControl.AccessibleDescription = base.PropertyItem.Description;
     this._editControl.AccessibleName = DesignerActionPanel.StripAmpersands(base.PropertyItem.DisplayName);
     this._editControl.TabIndex = currentTabIndex++;
     this._editControl.BringToFront();
 }
 internal override void UpdateActionItem(DesignerActionList actionList, DesignerActionItem actionItem, System.Windows.Forms.ToolTip toolTip, ref int currentTabIndex)
 {
     this._actionList = actionList;
     this._methodItem = (DesignerActionMethodItem) actionItem;
     toolTip.SetToolTip(this._linkLabel, this._methodItem.Description);
     this._linkLabel.Text = DesignerActionPanel.StripAmpersands(this._methodItem.DisplayName);
     this._linkLabel.AccessibleDescription = actionItem.Description;
     this._linkLabel.TabIndex = currentTabIndex++;
 }
 protected override void OnPropertyTaskItemUpdated(System.Windows.Forms.ToolTip toolTip, ref int currentTabIndex)
 {
     this._checkBox.Text = DesignerActionPanel.StripAmpersands(base.PropertyItem.DisplayName);
     this._checkBox.AccessibleDescription = base.PropertyItem.Description;
     this._checkBox.TabIndex = currentTabIndex++;
     toolTip.SetToolTip(this._checkBox, base.PropertyItem.Description);
 }
 /// <summary>
 ///     Recurs <c>Controls</c> members of the control to change 
 ///     corresponding texts.
 /// </summary>
 /// <param name="parent">
 ///     Parent <c>Control</c> object.
 /// </param>
 /// <param name="resources">
 ///     <c>ResourceManager</c> object.
 /// </param>
 private void RecurControls(System.Windows.Forms.Control parent, System.Resources.ResourceManager resources, System.Windows.Forms.ToolTip toolTip)
 {
     foreach (Control control in parent.Controls)
     {
         ReloadControlCommonProperties(control, resources);
         ReloadControlSpecificProperties(control, resources);
         if (toolTip != null)
             toolTip.SetToolTip(control, resources.GetString(control.Name + ".ToolTip", m_cultureInfo));
         if (control is System.Windows.Forms.UserControl)
             RecurUserControl((System.Windows.Forms.UserControl)control);
         else
         {
             ReloadTextForSelectedControls(control, resources);
             ReloadListItems(control, resources);
             if (control is System.Windows.Forms.TreeView)
                 ReloadTreeViewNodes((System.Windows.Forms.TreeView)control, resources);
             if (control.Controls.Count > 0)
                 RecurControls(control, resources, toolTip);
         }
     }
 }
 internal void SetToolTip(System.Windows.Forms.ToolTip toolTip, string caption)
 {
     toolTip.SetToolTip(this.upDownEdit, caption);
     toolTip.SetToolTip(this.upDownButtons, caption);
 }
Exemple #10
0
        private static void ApplyToContainer(System.Windows.Forms.Control Container, Dictionary<string, string> Referred, System.Windows.Forms.ToolTip tooltip = null)
        {
            foreach (System.Windows.Forms.Control Control in Container.Controls) {
                //Console.Out.WriteLine(Control.Name + " " + Control);
                if (Referred.ContainsKey(Control.Name)) {
                    Control.Text = Referred[Control.Name];
                }
                //Applies tooltip text to a control
                if (tooltip != null && Referred.ContainsKey(Control.Name + ".tooltip")) {
                    tooltip.SetToolTip(Control, Referred[Control.Name + ".tooltip"]);
                }

                if (Control is System.Windows.Forms.ToolStrip) {
                    System.Windows.Forms.ToolStrip TS = Control as System.Windows.Forms.ToolStrip;
                    foreach (System.Windows.Forms.ToolStripItem TSItem in TS.Items) {
                        if (Referred.ContainsKey(TSItem.Name)) {
                            TSItem.Text = Referred[TSItem.Name];
                        }
                        //Sets tooltip on a toolstrip
                        if (Referred.ContainsKey(TSItem.Name + ".tooltip")) {
                            TSItem.ToolTipText = Referred[TSItem.Name + ".tooltip"];
                        }
                    }
                }

                if (Control.Controls.Count > 0) {
                    ApplyToContainer(Control, Referred, tooltip);
                }
            }
        }
        //基地航空隊の戦闘の更新(非スレッドセーフ)
        private static void SetAirBaseBattleInvokerLogic(UserControls.AirBaseCorpsLabelHandler handler, System.Windows.Forms.ToolTip tooltip)
        {
            if (handler.AirCombats == null) return;
            if (APIBattle.BattleQueue == null || APIBattle.BattleView == null) return;
            if (APIGetMember.BaseAirCorps == null) return;

            if(!Config.ShowBattleInfo)
            {
                foreach(var i in Enumerable.Range(0, handler.AirCombats.Length))
                    ResetAirBaseBattle(handler, tooltip, i);
                return;
            }
            var view = APIBattle.BattleView;
            if(view.Situation == BattleSituation.EndBattle || view.Situation == BattleSituation.EndCombinedBattle)
            {
                return;
            }

            if(APIBattle.BattleQueue.Count == 0)
            {
                foreach(var i in Enumerable.Range(0, handler.AirCombats.Length))
                    if (!Config.BattleDetailViewKeeping) ResetAirBaseBattle(handler, tooltip, i);
                return;
            }

            var info = APIBattle.BattleQueue.Peek();
            if (info.api_air_base_attack == null) return;

            bool[] isSecond = new bool[BaseAirCorp.NumOfSquadron];

            foreach(var attack in info.api_air_base_attack)
            {
                if (handler.AirCombats.Length < attack.api_base_id) continue;

                var index = attack.api_base_id - 1;

                //1回目か2回目のターゲット判定
                var target = isSecond[index] ? handler.AirCombats[index].Second : handler.AirCombats[index].First;
                isSecond[index] = true;

                if(attack.api_stage1 != null)
                {
                    target.Stage1Player.Text = attack.api_stage1.api_f_lostcount + "/" + attack.api_stage1.api_f_count;
                    target.Stage1Enemy.Text = attack.api_stage1.api_e_lostcount + "/" + attack.api_stage1.api_e_count;

                    //触接
                    if(attack.api_stage1.api_touch_plane != null && attack.api_stage1.api_touch_plane.Count >= 2)
                    {
                        ExMasterSlotitem playerAttach;
                        if(APIMaster.MstSlotitems.TryGetValue(attack.api_stage1.api_touch_plane[0], out playerAttach))
                        {
                            target.AttachPlayer.Text = "+" + playerAttach.api_houm;
                            tooltip.SetToolTip(target.AttachPlayer, playerAttach.api_name);
                        }
                        else
                        {
                            target.AttachPlayer.Text = "×";
                            tooltip.SetToolTip(target.AttachPlayer, null);
                        }

                        ExMasterSlotitem enemyAttach;
                        if(APIMaster.MstSlotitems.TryGetValue(attack.api_stage1.api_touch_plane[1], out enemyAttach))
                        {
                            target.AttachEnemy.Text = "+" + enemyAttach.api_houm;
                            tooltip.SetToolTip(target.AttachEnemy, enemyAttach.api_name);
                        }
                        else
                        {
                            target.AttachEnemy.Text = "×";
                            tooltip.SetToolTip(target.AttachEnemy, null);
                        }
                    }
                    else
                    {
                        target.AttachPlayer.Text = "×";
                        tooltip.SetToolTip(target.AttachPlayer, null);
                    }

                    //制空権
                    target.AirSupCondition.Text = Helper.BattleAirConditionToString(attack.api_stage1.api_disp_seiku);
                }

                if(attack.api_stage2 != null)
                {
                    target.Stage2Player.Text = attack.api_stage2.api_f_lostcount + "/" + attack.api_stage2.api_f_count;
                    target.Stage2Enemy.Text = attack.api_stage2.api_e_lostcount + "/" + attack.api_stage2.api_e_count;
                }
            }
        }