Ejemplo n.º 1
0
        public void Start()
        {
            Console.Title = "BlueMoon - Settings - Change Theme Color";

            Console.Clear();
            AsciiClass ac = new AsciiClass();

            ac.BlueMoon(3);

            int left = 37;
            int top  = 14;

            Console.SetCursorPosition(left, top);
            Console.WriteLine("PERSONAL ASSISTANT APPLICATION");

            top++;
            Console.SetCursorPosition(37, top);
            Console.WriteLine("Press the letter in brackets to select Theme Color");

            top += 3;
            int topCyan = top;

            Console.SetCursorPosition(39, top);
            String textCyan = "(C). Theme Cyan (default)";

            Console.WriteLine(textCyan);

            top += 2;
            int topGreen = top;

            Console.SetCursorPosition(39, top);
            string textGreen = "(G). Theme Green";

            Console.WriteLine(textGreen);

            top += 2;
            int topBlue = top;

            Console.SetCursorPosition(39, top);
            string textBlue = "(B). Theme Blue ";

            Console.WriteLine(textBlue);

            top += 2;
            int topMagenta = top;

            Console.SetCursorPosition(39, top);
            string textMagenta = "(M). Theme Magenta ";

            Console.WriteLine(textMagenta);

            top += 2;
            int topGray = top;

            Console.SetCursorPosition(39, top);
            string textGray = "(A). Theme Gray ";

            Console.WriteLine(textGray);

            top += 2;
            int topYellow = top;

            Console.SetCursorPosition(39, top);
            string textYellow = "(Y). Theme Yellow";

            Console.WriteLine(textYellow);

            top += 2;
            int topRed = top;

            Console.SetCursorPosition(39, top);
            string textRed = "(R). Theme Red";

            Console.WriteLine(textRed);

            top += 2;
            int topX = top;

            Console.SetCursorPosition(39, top);
            string textX = "(X). Exit this page ";

            Console.WriteLine(textX);


            Station.StartTimeThread();

            Console.CursorVisible = false;
            ConsoleKeyInfo key;

            key = Console.ReadKey(true);

            if (key.Key == ConsoleKey.C)
            {
                Station.StopTimeThread();
                Station.BeepClick();
                Station.Highlight(39, topCyan, textCyan);

                //
                Station.writerClearedRow(39, 34, "Theme Cyan Selected.");

                Station.writerClearedRow(39, 35, "Press any key to save and return to settings");

                SaveToSettingsFile("Cyan");

                SettingsLoginDetails sld = new SettingsLoginDetails();
                sld.Start();
            }
            else if (key.Key == ConsoleKey.G)
            {
                Station.StopTimeThread();
                Station.BeepClick();
                Station.Highlight(39, topGreen, textGreen);

                Station.writerClearedRow(39, 34, "Theme Green Selected.");

                Station.writerClearedRow(39, 35, "Press any key to save and return to settings");

                SaveToSettingsFile("Green");

                SettingsLoginDetails sld = new SettingsLoginDetails();
                sld.Start();
            }

            else if (key.Key == ConsoleKey.B)
            {
                Station.StopTimeThread();
                Station.BeepClick();
                Station.Highlight(39, topBlue, textBlue);

                Station.writerClearedRow(39, 34, "Theme Blue Selected.");

                Station.writerClearedRow(39, 35, "Press any key to save and return to settings");

                SaveToSettingsFile("Blue");

                SettingsLoginDetails sld = new SettingsLoginDetails();
                sld.Start();
            }

            else if (key.Key == ConsoleKey.M)
            {
                Station.StopTimeThread();
                Station.BeepClick();
                Station.Highlight(39, topMagenta, textMagenta);

                Station.writerClearedRow(39, 34, "Theme Magenta Selected.");

                Station.writerClearedRow(39, 35, "Press any key to save and return to settings");

                SaveToSettingsFile("Magenta");

                SettingsLoginDetails sld = new SettingsLoginDetails();
                sld.Start();
            }

            else if (key.Key == ConsoleKey.A)
            {
                Station.StopTimeThread();
                Station.BeepClick();
                Station.Highlight(39, topGray, textGray);

                Station.writerClearedRow(39, 34, "Theme Gray Selected.");

                Station.writerClearedRow(39, 35, "Press any key to save and return to settings");

                SaveToSettingsFile("Gray");

                SettingsLoginDetails sld = new SettingsLoginDetails();
                sld.Start();
            }

            else if (key.Key == ConsoleKey.Y)
            {
                Station.StopTimeThread();
                Station.BeepClick();
                Station.Highlight(39, topYellow, textYellow);

                Station.writerClearedRow(39, 34, "Theme Yellow Selected.");

                Station.writerClearedRow(39, 35, "Press any key to save and return to settings");

                SaveToSettingsFile("Yellow");

                SettingsLoginDetails sld = new SettingsLoginDetails();
                sld.Start();
            }

            else if (key.Key == ConsoleKey.R)
            {
                Station.StopTimeThread();
                Station.BeepClick();
                Station.Highlight(39, topRed, textRed);

                Station.writerClearedRow(39, 34, "Theme Red Selected.");

                Station.writerClearedRow(39, 35, "Press any key to save and return to settings");

                SaveToSettingsFile("Red");

                SettingsLoginDetails sld = new SettingsLoginDetails();
                sld.Start();
            }

            else if (key.Key == ConsoleKey.X)
            {
                Station.StopTimeThread();
                Station.BeepClick();
                Station.Highlight(39, topX, textX);
                SettingsLoginDetails sld = new SettingsLoginDetails();
                sld.Start();
            }
            else
            {
                Station.StopTimeThread();
                top += 4;
                Station.BeepError();
                Console.SetCursorPosition(39, top);
                Console.WriteLine("Invalid Key.");
                Thread.Sleep(200);
                Console.Clear();
                Start();
            }
        }
Ejemplo n.º 2
0
        public static void LoadPage()
        {
            //Console.OutputEncoding = System.Text.Encoding.GetEncoding(28591);

            Console.CursorVisible = false;

            Console.SetCursorPosition(50, 25);

            Console.WriteLine("  Loading.....");

            // loading position row= -3 and col = +2
            Console.SetCursorPosition(47, 27);

            int leftCheck     = 3;
            int topCheck      = 38;
            int topLoad       = 47;
            int sleepValueI3  = 500;
            int sleepValueI31 = 173;

            for (int i = 0; i < 20; i++)
            {
                // loading position row= -3 and col = +2
                Console.SetCursorPosition(topLoad, 27);
                topLoad++;
                Console.Write((char)166);


                if (i == 0)
                {
                    Thread.Sleep(sleepValueI3);
                }



                else if (i == 1)
                {
                    Thread.Sleep(sleepValueI31);
                    Station.writerClearedRow(leftCheck, topCheck, "Checking app state.");
                    Thread.Sleep(sleepValueI31);
                    Station.writerClearedRow(leftCheck, topCheck, "Checking app state..");
                    Thread.Sleep(sleepValueI31);
                    Station.writerClearedRow(leftCheck, topCheck, "Checked");
                }


                else if (i == 2)
                {
                    Thread.Sleep(sleepValueI3);
                }



                else if (i == 3)
                {
                    DateTime last = Directory.GetLastAccessTime("BlueMoon.exe");
                    Station.writerClearedRow(leftCheck, topCheck, "application last access : " + last);
                    Thread.Sleep(sleepValueI3);
                }



                else if (i == 4)
                {
                    Thread.Sleep(sleepValueI3);
                }



                else if (i == 5)
                {
                    string curDir = Directory.GetCurrentDirectory();
                    Station.writerClearedRow(leftCheck, topCheck, "application current directory : " + curDir);
                    Thread.Sleep(sleepValueI3);
                }



                else if (i == 6)
                {
                    Station.writerClearedRow(leftCheck, topCheck, "Checking Schedule.ebase");
                    Thread.Sleep(sleepValueI3);
                }

                else if (i == 7)
                {
                    if (!File.Exists("Schedule.ebase"))
                    {
                        MessageBox.Show("The Schedule file does not exist.\nIf this is first time use of application, this is normal other wise" +
                                        " the Schedule file has been tampered with. \nA new Schedule file would be created for you.", "ebase file Missing",
                                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        Thread.Sleep(sleepValueI3);
                        Station.writerClearedRow(leftCheck, topCheck, "Checking Schedule.ebase : passed");
                    }
                }

                else if (i == 8)
                {
                    if (!File.Exists("Schedule.ebase"))
                    {
                        File.Create("Schedule.ebase");

                        Thread.Sleep(sleepValueI3);
                        Thread.Sleep(sleepValueI3);

                        string[] writer = { "test~2018~6~27~15~47~Niit" };

                        File.WriteAllLines("Schedule.ebase", writer);
                        Thread.Sleep(sleepValueI3);

                        Station.writerClearedRow(leftCheck, topCheck, "Checking Schedule.ebase : Created");
                    }

                    Thread.Sleep(sleepValueI3);
                }

                else if (i == 9)
                {
                    Thread.Sleep(sleepValueI3);
                }


                else if (i == 10)
                {
                    DateTime lastWrite = Directory.GetLastWriteTime(".");
                    Station.writerClearedRow(leftCheck, topCheck, "This directory was last written to on : " + lastWrite);
                    Thread.Sleep(sleepValueI3);
                }


                else if (i == 11)
                {
                    Thread.Sleep(sleepValueI3);
                }


                else if (i == 12)
                {
                    Station.writerClearedRow(leftCheck, topCheck, "Checking Contacts.ebase");
                    Thread.Sleep(sleepValueI3);
                }


                else if (i == 13)
                {
                    if (!File.Exists("Contacts.ebase"))
                    {
                        MessageBox.Show("The Contacts file does not exist.\nIf this is first time use of application, this is normal other wise" +
                                        " the Contacts file has been tampered with. \nA new Contacts file would be created for you.", "ebase file Missing",
                                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        Thread.Sleep(sleepValueI3);
                        Station.writerClearedRow(leftCheck, topCheck, "Checking Contacts.ebase : passed");
                    }
                }



                else if (i == 14)
                {
                    if (!File.Exists("Contacts.ebase"))
                    {
                        File.Create("Contacts.ebase");
                        Station.writerClearedRow(leftCheck, topCheck, "Checking Contacts.ebase : Created");
                    }

                    Thread.Sleep(sleepValueI3);
                }


                else if (i == 15)
                {
                    Thread.Sleep(sleepValueI3);
                }



                else if (i == 16)
                {
                    Station.writerClearedRow(leftCheck, topCheck, "Checking Settings.ebase");
                    Thread.Sleep(sleepValueI3);
                }



                else if (i == 17)
                {
                    if (!File.Exists("Settings.ebase"))
                    {
                        MessageBox.Show("The Settings file does not exist.\nIf this is first time use of application, this is normal other wise" +
                                        " the Settings file has been tampered with. \nA new Settings file would be created for you.", "ebase file Missing",
                                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        Station.SetterFile();

                        Station.writerClearedRow(leftCheck, topCheck, "Checking Settings.ebase : passed");
                    }
                }



                else if (i == 18)
                {
                    bool fileExists = File.Exists("Settings.ebase");

                    if (!fileExists)
                    {
                        Station.SetterDefault();

                        Thread.Sleep(sleepValueI3);
                        Station.writerClearedRow(leftCheck, topCheck, "Checking Settings.ebase : Created");
                        Thread.Sleep(sleepValueI3);
                    }
                    Thread.Sleep(sleepValueI3);
                }


                else if (i == 19)
                {
                    Station.writerClearedRow(leftCheck, topCheck, "Loading Completed.....");
                    Thread.Sleep(sleepValueI3);
                    Station.SetColor();
                    Thread.Sleep(sleepValueI3);
                }
            }


            Login l = new Login();

            l.DisplayPassword();
        }