Пример #1
0
 private void FormResultCreate()
 {
     if (_requestedUser != string.Empty)
     {
         ShowResult?.Invoke(this, EventArgs.Empty);
         ResultFormcs resultform = new ResultFormcs
         {
             StartPosition = FormStartPosition.CenterScreen
         };
         resultform.Show();
         int count = 0;
         foreach (KeyValuePair <string, string> keyValue in _report)
         {
             count = count + 25;
             Label lbl = new Label
             {
                 AutoSize = true,
                 Text     = keyValue.Key + keyValue.Value,
                 Parent   = resultform,
                 Left     = 20,
                 Top      = count,
                 Visible  = true
             };
         }
         _requestedUser = string.Empty;
     }
 }
Пример #2
0
        public static void Calculate(ShowResult showResult, int a, int b)
        {
            if (a < 0 || b < 0)
            {
                Console.WriteLine("参数有误");
            }
            else
            {
                System.Reflection.MethodInfo methodInfo = RuntimeReflectionExtensions.GetMethodInfo(showResult);
                Console.WriteLine("在这里写入一条日志" + methodInfo.ToString());

                Console.WriteLine(showResult?.Invoke(a, b));
                //Console.WriteLine(showResult(a, b));
            }
        }
Пример #3
0
        public void Integral()
        {
            Stopwatch watch = new Stopwatch();

            watch.Start();
            double       x, h;
            double       s        = 0;
            const double capacity = 0.00000001;

            for (x = capacity / 2; x < 1; x += capacity)
            {
                var y = Math.Sin(x);
                s += y * capacity; // Элементарное приращение
            }

            ShowResult?.Invoke(s);
            watch.Stop();
            Console.WriteLine(watch.Elapsed);
        }
Пример #4
0
        void LeftMenu_Inputed(IFocusable sender, InputEventArgs args)
        {
            if (args.InputInfo.IsPressed(ButtonType.Cross))
            {
                sound.Play(PPDSetting.DefaultSounds[2], -1000);
                FocusManager.RemoveFocus();
            }
            else if (args.InputInfo.IsPressed(ButtonType.Triangle))
            {
                sound.Play(PPDSetting.DefaultSounds[2], -1000);
                FocusManager.RemoveFocus();
            }
            else if (args.InputInfo.IsPressed(ButtonType.Circle))
            {
                switch (mode)
                {
                case Mode.SongSelect:
                    if (songSelectComponent == null)
                    {
                        songSelectComponent = new SongSelectComponent(device, resourceManager, sound, this, movieManager);
                        songSelectComponent.SongSelected += songSelectComponent_SongSelected;
                        songSelectSprite.InsertChild(songSelectComponent, 0);
                    }
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    FocusManager.Focus(songSelectComponent);
                    break;

                case Mode.GameRule:
                    if (gameRuleComponent == null)
                    {
                        gameRuleComponent              = new GameRuleComponent(device, resourceManager, sound);
                        gameRuleComponent.RuleChanged += gameRuleComponent_RuleChanged;
                        gameRuleSprite.InsertChild(gameRuleComponent, 0);
                    }
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    FocusManager.Focus(gameRuleComponent);
                    break;

                case Mode.UserManage:
                    if (userSelectComponent == null)
                    {
                        userSelectComponent = new UserSelectComponent(device, resourceManager, sound, users);
                        userSelectComponent.ChangeLeader += userSelectComponent_ChangeLeader;
                        userSelectComponent.KickUser     += userSelectComponent_KickUser;
                        userSelectSprite.InsertChild(userSelectComponent, 0);
                    }
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    FocusManager.Focus(userSelectComponent);
                    break;

                case Mode.ItemSetting:
                    if (itemSettingComponent == null)
                    {
                        itemSettingComponent = new ItemSettingComponent(device, resourceManager, sound);
                        itemSettingSprite.InsertChild(itemSettingComponent, 0);
                    }
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    FocusManager.Focus(itemSettingComponent);
                    break;

                case Mode.TryToPlayGame:
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    FocusManager.RemoveFocus();
                    OnTryToPlayGame();
                    break;

                case Mode.MuteSE:
                    sound.Play(PPDSetting.DefaultSounds[3], -1000);
                    MuteSE = !MuteSE;
                    (back[(int)mode] as TextureString).Text = String.Format("{0}:{1}", Utility.Language["MuteSE"], MuteSE ? Utility.Language["ON"] : Utility.Language["OFF"]);
                    break;

                case Mode.Connect:
                    sound.Play(PPDSetting.DefaultSounds[3], -1000);
                    Connect = !Connect;
                    (back[(int)mode] as TextureString).Text = String.Format("{0}:{1}", Utility.Language["Connect"], Connect ? Utility.Language["ON"] : Utility.Language["OFF"]);
                    SkinSetting.Setting.Connect             = Connect;
                    break;

                case Mode.ShowResult:
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    if (ShowResult != null)
                    {
                        ShowResult.Invoke(this, EventArgs.Empty);
                    }
                    break;

                case Mode.UpdateDB:
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    if (UpdateScoreDB != null)
                    {
                        UpdateScoreDB.Invoke(this, EventArgs.Empty);
                    }
                    break;

                case Mode.Mod:
                    if (modPanel == null)
                    {
                        modPanel = new ModPanel(device, gameHost, resourceManager, sound, allowedModList);
                        modSprite.InsertChild(modPanel, 0);
                    }
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    FocusManager.Focus(modPanel);
                    break;

                case Mode.Finish:
                    sound.Play(PPDSetting.DefaultSounds[1], -1000);
                    var confirmComponent = new ConfirmComponent(device, resourceManager, Utility.Path, Utility.Language["FinishConfirm"], Utility.Language["Yes"], Utility.Language["No"], Utility.Language["OK"], ConfirmComponent.ConfirmButtonType.YesNo);
                    confirmComponent.LostFocused += confirmComponent_LostFocused;
                    this.InsertChild(confirmComponent, 0);
                    FocusManager.Focus(confirmComponent);
                    break;
                }
            }
            else if (args.InputInfo.IsPressed(ButtonType.Up))
            {
                mode--;
                while (true)
                {
                    if (mode < 0)
                    {
                        mode = (Mode)(enables.Length - 1);
                    }

                    if (enables[(int)mode])
                    {
                        break;
                    }
                    mode--;
                }
                sound.Play(PPDSetting.DefaultSounds[0], -1000);
            }
            else if (args.InputInfo.IsPressed(ButtonType.Down))
            {
                mode++;
                while (true)
                {
                    if ((int)mode >= enables.Length)
                    {
                        mode = Mode.SongSelect;
                    }

                    if (enables[(int)mode])
                    {
                        break;
                    }
                    mode++;
                }
                sound.Play(PPDSetting.DefaultSounds[0], -1000);
            }

            select.Position = new Vector2(select.Position.X, selectDiffY + back[(int)mode].Position.Y);
        }