Esempio n. 1
0
        private void ShowPoints(object clickedButton, RoutedEventArgs e)
        {
            Button b__ = (Button)clickedButton;


            // mcid(playername)を表示させる
            mcid.Text = b__.Content.ToString();

            var playerdata = DictionaryManager.getDictionary();

            int scpoint = playerdata[b__.Content.ToString()].getSc_();
            int cppoint = playerdata[b__.Content.ToString()].getContribution_();

            string convertedSCPoint = ConvertNumber(scpoint);
            string convertedCPPoint = ConvertNumber(cppoint);


            // UIにポイントを表示させる
            SC.Text           = convertedSCPoint;
            Contribution.Text = convertedCPPoint;


            scpoint_copy           = scpoint;
            contributionpoint_copy = cppoint;
        }
Esempio n. 2
0
        // DataGridにデータを追加するメソッド
        public static List <Customer> Customers()
        {
            MainPage mainPage = MainPage.returnInstance();

            var unsortedList = new List <Customer>();

            foreach (Button buttonsInNameList in mainPage.getAllButtonFromNameList())
            {
                var playerdataDictionary = DictionaryManager.getDictionary();

                string playername = buttonsInNameList.Content.ToString();

                int    sc           = playerdataDictionary[playername].getSc_();
                int    contribution = playerdataDictionary[playername].getContribution_();
                string mcid         = playername;
                int    id           = playerdataDictionary[playername].getId_();

                var playerdata = new Customer(mcid, sc, contribution, id);

                unsortedList.Add(playerdata);
            }

            // DataGridのデータのコピーを取る
            customers = unsortedList;


            return(unsortedList);
        }
Esempio n. 3
0
        private async void InputMCIDDIalogAsync(string title)
        {
            TextBox inputTextBox = new TextBox
            {
                AcceptsReturn = false,
                Height        = 32,
            };


            ContentDialog dialog = new ContentDialog
            {
                Content = inputTextBox,
                Title   = title,
                IsSecondaryButtonEnabled = false,
                PrimaryButtonText        = "OK",
                CloseButtonText          = "Cancel"
            };

            var result = await dialog.ShowAsync();

            var OK = ContentDialogResult.Primary;

            if (result == OK)
            {
                if (inputTextBox.Text == null)
                {
                    return;
                }


                ChangeStyle(mcid.Text, inputTextBox.Text);


                // データとmcidのテキストを入れ替える
                var playerdata = DictionaryManager.getDictionary();

                Points data = playerdata[mcid.Text];
                playerdata.Remove(mcid.Text);
                playerdata.Add(inputTextBox.Text, data);

                DictionaryManager.setPlayerData(mcid.Text, data);


                mcid.Text = inputTextBox.Text;


                if (EditOnce)
                {
                    return;
                }

                EditOnce = true;
            }
        }
Esempio n. 4
0
        private async void ChangeSC(object sender, DoubleTappedRoutedEventArgs e)
        {
            string orderedPoints = await InputPointsDialogAsync("Change SC");


            // ※補足 int.TryParse(orderedPoints, out d)) -> 取得した数字を元の数字に足して再表示する
            int d;

            if (int.TryParse(orderedPoints, out d))
            {
                if (isPlus)
                {
                    int totalpoints = scpoint_copy + d;
                    SC.Text = ConvertNumber(totalpoints);

                    var playerdata = DictionaryManager.getDictionary();

                    playerdata[mcid.Text].setSc_(totalpoints);
                    scpoint_copy = totalpoints;


                    if (EditOnce == false)
                    {
                        EditOnce = true;
                    }
                }
                else
                {
                    var playerdata = DictionaryManager.getDictionary();

                    int totalpoints = scpoint_copy - d;
                    SC.Text = ConvertNumber(totalpoints);


                    playerdata[mcid.Text].setSc_(totalpoints);
                    scpoint_copy = totalpoints;


                    if (EditOnce == false)
                    {
                        EditOnce = true;
                    }
                }
            }
        }
Esempio n. 5
0
        private async void ChangeContribution(object sender, DoubleTappedRoutedEventArgs e)
        {
            string orderedPoints = await InputPointsDialogAsync("Change Contribution");


            // ※補足 int.TryParse(orderedPoints, out d)) -> string型からint型へ変換する
            int d;

            if (int.TryParse(orderedPoints, out d))
            {
                var playerdata = DictionaryManager.getDictionary();

                if (isPlus)
                {
                    int totalpoints = contributionpoint_copy + d;
                    Contribution.Text = ConvertNumber(totalpoints);


                    playerdata[mcid.Text].setContribution_(totalpoints);
                    contributionpoint_copy = totalpoints;


                    if (EditOnce == false)
                    {
                        EditOnce = true;
                    }
                }
                else
                {
                    int totalpoints = contributionpoint_copy - d;
                    Contribution.Text = ConvertNumber(totalpoints);


                    playerdata[mcid.Text].setContribution_(totalpoints);
                    contributionpoint_copy = totalpoints;


                    if (EditOnce == false)
                    {
                        EditOnce = true;
                    }
                }
            }
        }
Esempio n. 6
0
        // 他のクラスでも使うためにメソッドとして作った
        public void saveAllData()
        {
            foreach (Button button in getAllButtonFromNameList())
            {
                string playername = button.Content.ToString();


                // 元からUIに存在するボタンを除くために作った
                if (playername.Equals("Add"))
                {
                    return;
                }


                var playerdata = DictionaryManager.getDictionary();

                int sc           = playerdata[playername].getSc_();
                int contribution = playerdata[playername].getContribution_();
                int id           = playerdata[playername].getId_();


                TCreatePlayerData(playername, sc, contribution, id);
            }
        }