コード例 #1
0
ファイル: Toggles.cs プロジェクト: TimEneman/KH2Tracker
        private void AltToggle(object sender, RoutedEventArgs e)
        {
            // Mimicing radio buttons so you cant toggle a button off
            if (AltOption.IsChecked == false)
            {
                AltOption.IsChecked = true;
                return;
            }

            SimpleOption.IsChecked             = false;
            OrbOption.IsChecked                = false;
            Properties.Settings.Default.Simple = SimpleOption.IsChecked;
            Properties.Settings.Default.Orb    = OrbOption.IsChecked;
            Properties.Settings.Default.Alt    = AltOption.IsChecked;

            if (AltOption.IsChecked)
            {
                Report1.SetResourceReference(ContentProperty, "AnsemReportOld1");
                Report2.SetResourceReference(ContentProperty, "AnsemReportOld2");
                Report3.SetResourceReference(ContentProperty, "AnsemReportOld3");
                Report4.SetResourceReference(ContentProperty, "AnsemReportOld4");
                Report5.SetResourceReference(ContentProperty, "AnsemReportOld5");
                Report6.SetResourceReference(ContentProperty, "AnsemReportOld6");
                Report7.SetResourceReference(ContentProperty, "AnsemReportOld7");
                Report8.SetResourceReference(ContentProperty, "AnsemReportOld8");
                Report9.SetResourceReference(ContentProperty, "AnsemReportOld9");
                Report10.SetResourceReference(ContentProperty, "AnsemReportOld10");
                Report11.SetResourceReference(ContentProperty, "AnsemReportOld11");
                Report12.SetResourceReference(ContentProperty, "AnsemReportOld12");
                Report13.SetResourceReference(ContentProperty, "AnsemReportOld13");
                Fire1.SetResourceReference(ContentProperty, "FireOld");
                Fire2.SetResourceReference(ContentProperty, "FireOld");
                Fire3.SetResourceReference(ContentProperty, "FireOld");
                Blizzard1.SetResourceReference(ContentProperty, "BlizzardOld");
                Blizzard2.SetResourceReference(ContentProperty, "BlizzardOld");
                Blizzard3.SetResourceReference(ContentProperty, "BlizzardOld");
                Thunder1.SetResourceReference(ContentProperty, "ThunderOld");
                Thunder2.SetResourceReference(ContentProperty, "ThunderOld");
                Thunder3.SetResourceReference(ContentProperty, "ThunderOld");
                Cure1.SetResourceReference(ContentProperty, "CureOld");
                Cure2.SetResourceReference(ContentProperty, "CureOld");
                Cure3.SetResourceReference(ContentProperty, "CureOld");
                Reflect1.SetResourceReference(ContentProperty, "ReflectOld");
                Reflect2.SetResourceReference(ContentProperty, "ReflectOld");
                Reflect3.SetResourceReference(ContentProperty, "ReflectOld");
                Magnet1.SetResourceReference(ContentProperty, "MagnetOld");
                Magnet2.SetResourceReference(ContentProperty, "MagnetOld");
                Magnet3.SetResourceReference(ContentProperty, "MagnetOld");
                Valor.SetResourceReference(ContentProperty, "ValorOld");
                Wisdom.SetResourceReference(ContentProperty, "WisdomOld");
                Limit.SetResourceReference(ContentProperty, "LimitOld");
                Master.SetResourceReference(ContentProperty, "MasterOld");
                Final.SetResourceReference(ContentProperty, "FinalOld");
                TornPage1.SetResourceReference(ContentProperty, "TornPageOld");
                TornPage2.SetResourceReference(ContentProperty, "TornPageOld");
                TornPage3.SetResourceReference(ContentProperty, "TornPageOld");
                TornPage4.SetResourceReference(ContentProperty, "TornPageOld");
                TornPage5.SetResourceReference(ContentProperty, "TornPageOld");
                Lamp.SetResourceReference(ContentProperty, "GenieOld");
                Ukulele.SetResourceReference(ContentProperty, "StitchOld");
                Baseball.SetResourceReference(ContentProperty, "ChickenLittleOld");
                Feather.SetResourceReference(ContentProperty, "PeterPanOld");
                Nonexistence.SetResourceReference(ContentProperty, "ProofOfNonexistenceOld");
                Connection.SetResourceReference(ContentProperty, "ProofOfConnectionOld");
                Peace.SetResourceReference(ContentProperty, "ProofOfPeaceOld");
                PromiseCharm.SetResourceReference(ContentProperty, "PromiseCharmOld");

                broadcast.Report.SetResourceReference(ContentProperty, "AnsemReportOld");
                broadcast.Peace.SetResourceReference(ContentProperty, "ProofOfPeaceOld");
                broadcast.Nonexistence.SetResourceReference(ContentProperty, "ProofOfNonexistenceOld");
                broadcast.Connection.SetResourceReference(ContentProperty, "ProofOfConnectionOld");
                broadcast.PromiseCharm.SetResourceReference(ContentProperty, "PromiseCharmOld");
                broadcast.Fire.SetResourceReference(ContentProperty, "FireAlt");
                broadcast.Blizzard.SetResourceReference(ContentProperty, "BlizzardAlt");
                broadcast.Thunder.SetResourceReference(ContentProperty, "ThunderAlt");
                broadcast.Cure.SetResourceReference(ContentProperty, "CureAlt");
                broadcast.Reflect.SetResourceReference(ContentProperty, "ReflectAlt");
                broadcast.Magnet.SetResourceReference(ContentProperty, "MagnetAlt");
                broadcast.Valor.SetResourceReference(ContentProperty, "ValorAlt");
                broadcast.Wisdom.SetResourceReference(ContentProperty, "WisdomAlt");
                broadcast.Limit.SetResourceReference(ContentProperty, "LimitAlt");
                broadcast.Master.SetResourceReference(ContentProperty, "MasterAlt");
                broadcast.Final.SetResourceReference(ContentProperty, "FinalAlt");
                broadcast.Baseball.SetResourceReference(ContentProperty, "ChickenLittleAlt");
                broadcast.Lamp.SetResourceReference(ContentProperty, "GenieAlt");
                broadcast.Ukulele.SetResourceReference(ContentProperty, "StitchAlt");
                broadcast.Feather.SetResourceReference(ContentProperty, "PeterPanAlt");

                ((Grid)((Grid)broadcast.Fire.Parent).Parent).RowDefinitions[0].Height = new GridLength(0, GridUnitType.Star);
                ((Grid)((Grid)broadcast.Fire.Parent).Parent).RowDefinitions[2].Height = new GridLength(0, GridUnitType.Star);
                ((Grid)broadcast.Valor.Parent).RowDefinitions[1].Height = new GridLength(5, GridUnitType.Star);
                ((Grid)broadcast.Valor.Parent).RowDefinitions[2].Height = new GridLength(5, GridUnitType.Star);
                ((Grid)broadcast.Lamp.Parent).RowDefinitions[1].Height  = new GridLength(8, GridUnitType.Star);
            }
        }
コード例 #2
0
        private void createReport(object sender, RoutedEventArgs e)
        {
            if (listViewProjects.SelectedItem == null)
            {
                myMessageQueue.Enqueue(rm.GetString("selectRowToTakeAction"), rm.GetString("ok"), () => HandleOKMethod());
                return;
            }

            int             counter2        = countCheckBoxForReport2();
            VarsProjectsAll varsProjectsAll = (VarsProjectsAll)listViewProjects.SelectedItem;

            if (localDbConnectionUnity.State == ConnectionState.Closed)
            {
                localDbConnectionUnity.Open();
            }

            try
            {
                SqlCommand reportCommand = new SqlCommand("INSERT INTO Reports VALUES (@date)", localDbConnectionUnity);
                reportCommand.Parameters.AddWithValue("@date", Convert.ToDateTime(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")));
                reportCommand.ExecuteNonQuery();

                SqlCommand commandProjectReport = new SqlCommand("SELECT dbo.countReports()", localDbConnectionUnity);
                reportDone.Content = (int)commandProjectReport.ExecuteScalar();
            }
            catch { }

            localDbConnectionUnity.Close();

            if (localDbConnection.State == ConnectionState.Closed)
            {
                localDbConnection.Open();
            }

            SqlCommand command = new SqlCommand("SELECT dbo.getProjectDeviceType(@id)", localDbConnection);

            command.Parameters.AddWithValue("@id", varsProjectsAll.id);
            int type = int.Parse(command.ExecuteScalar().ToString());

            localDbConnection.Close();

            if (type == 1)
            {
                switch (countCheckBoxForReport1())
                {
                case 0:
                    myMessageQueue.Enqueue(rm.GetString("selectDataToReport"), rm.GetString("ok"), () => HandleOKMethod());
                    break;

                case 1:
                    Report1 report1_1 = new Report1(varsProjectsAll.id, idList);
                    report1_1.Show();
                    break;

                case 2:
                    Report2 report1_2 = new Report2(varsProjectsAll.id, idList);
                    report1_2.Show();
                    break;

                case 3:
                    Report3 report1_3 = new Report3(varsProjectsAll.id, idList);
                    report1_3.Show();
                    break;

                case 4:
                    Report4 report1_4 = new Report4(varsProjectsAll.id, idList);
                    report1_4.Show();
                    break;

                case 5:
                    Report5 report1_5 = new Report5(varsProjectsAll.id, idList);
                    report1_5.Show();
                    break;

                case 6:
                    Report6 report1_6 = new Report6(varsProjectsAll.id, idList);
                    report1_6.Show();
                    break;

                case 7:
                    Report7 report1_7 = new Report7(varsProjectsAll.id, idList);
                    report1_7.Show();
                    break;

                case 8:
                    Report8 report1_8 = new Report8(varsProjectsAll.id, idList);
                    report1_8.Show();
                    break;

                case 9:
                    Report9 report1_9 = new Report9(varsProjectsAll.id, idList);
                    report1_9.Show();
                    break;

                case 10:
                    Report10 report1_10 = new Report10(varsProjectsAll.id, idList);
                    report1_10.Show();
                    break;

                case 11:
                    Report11 report1_11 = new Report11(varsProjectsAll.id, idList);
                    report1_11.Show();
                    break;
                }
            }
            else
            {
                switch (countCheckBoxForReport2())
                {
                case 0:
                    myMessageQueue.Enqueue(rm.GetString("selectDataToReport"), rm.GetString("ok"), () => HandleOKMethod());
                    break;

                case 1:
                    Report1 report1_1 = new Report1(varsProjectsAll.id, idList);
                    report1_1.Show();
                    break;

                case 2:
                    Report2 report1_2 = new Report2(varsProjectsAll.id, idList);
                    report1_2.Show();
                    break;

                case 3:
                    Report3 report1_3 = new Report3(varsProjectsAll.id, idList);
                    report1_3.Show();
                    break;

                case 4:
                    Report4 report1_4 = new Report4(varsProjectsAll.id, idList);
                    report1_4.Show();
                    break;

                case 5:
                    Report5 report1_5 = new Report5(varsProjectsAll.id, idList);
                    report1_5.Show();
                    break;

                case 6:
                    Report6 report1_6 = new Report6(varsProjectsAll.id, idList);
                    report1_6.Show();
                    break;

                case 7:
                    Report7 report1_7 = new Report7(varsProjectsAll.id, idList);
                    report1_7.Show();
                    break;

                case 8:
                    Report8 report1_8 = new Report8(varsProjectsAll.id, idList);
                    report1_8.Show();
                    break;

                case 9:
                    Report9 report1_9 = new Report9(varsProjectsAll.id, idList);
                    report1_9.Show();
                    break;

                case 10:
                    Report10 report1_10 = new Report10(varsProjectsAll.id, idList);
                    report1_10.Show();
                    break;

                case 11:
                    Report11 report1_11 = new Report11(varsProjectsAll.id, idList);
                    report1_11.Show();
                    break;

                case 12:
                    myMessageQueue.Enqueue(rm.GetString("maxRowToReport"), rm.GetString("ok"), () => HandleOKMethod());
                    break;

                case 13:
                    myMessageQueue.Enqueue(rm.GetString("maxRowToReport"), rm.GetString("ok"), () => HandleOKMethod());
                    break;

                case 14:
                    myMessageQueue.Enqueue(rm.GetString("maxRowToReport"), rm.GetString("ok"), () => HandleOKMethod());
                    break;

                case 15:
                    myMessageQueue.Enqueue(rm.GetString("maxRowToReport"), rm.GetString("ok"), () => HandleOKMethod());
                    break;

                case 16:
                    myMessageQueue.Enqueue(rm.GetString("maxRowToReport"), rm.GetString("ok"), () => HandleOKMethod());
                    break;
                }
            }
        }