Ejemplo n.º 1
0
 public static void SetScreens(Screens newScreens)
 {
     screens = newScreens;
 }
Ejemplo n.º 2
0
 public static void AddScreens(Screens screens)
 {
     _screens = screens;
 }
Ejemplo n.º 3
0
 public void SetupScreens(Screens screens)
 {
     _Screens = screens;
     Commands.SetScreens(screens);
 }
Ejemplo n.º 4
0
        public static void Main()
        {
            Logger.OutputInformation("Starting JH Book List Console Application.");
            Screens screens = new Screens();

            var context = Initialize.GetContext();

            BookListContextExtensions.AddScreens(screens);
            Login logIn;

            logIn = new Login();
            logIn.SetupScreens(screens);
            Login.SetContext(context);
            context.EnsureSeedDataForContext();

            string cmdString;

            do
            {
                cmdString = Login.GetConsoleString("JHConsoleBookListCmd");
                if (cmdString.Length > 0)
                {
                    switch (cmdString.ToUpper()[0])
                    {
                    case 'R':
                        Login.RegisterNewUser();
                        break;

                    case 'L':
                        Login.LoginUser();
                        User user;

                        if (Singleton.Instance.currentUserId >= 1)
                        {
                            user = context.Users.FirstOrDefault(u => u.UserId == Singleton.Instance.currentUserId);
                            Logger.OutputInformation("Welcome user " + user.UserName + " !");
                        }
                        break;

                    case 'E':
                        Login.EmailUserPassword();
                        break;

                    case 'C':
                        Login.ChangeUserPassword();
                        break;

                    case 'P':
                        Login.PrintBookEntry();
                        break;

                    case 'Q':
                        // Just Quit
                        break;

                    case 'D':
                        Login.DownPage();
                        break;

                    case 'U':
                        Login.UpPage();
                        break;

                    case '-':
                        Login.DownOne();
                        break;

                    case '+':
                        Login.UpOne();
                        break;

                    case 'H':
                        Login.Home();
                        break;

                    case 'N':
                        Login.End();
                        break;

                    case 'O':
                        Login.Order();
                        break;

                    case 'F':
                        Login.Filter();
                        break;

                    case 'V':
                        Login.ConvertWebPage();
                        break;

                    case 'I':
                        Login.Import();
                        break;

                    case 'X':
                        Login.XmlSave();
                        break;

                    case 'A':
                        Login.XmlLoad();
                        break;

                    case 'T':
                        Login.UpdateBook();
                        break;

                    case '1':
                        Login.DeleteBook();
                        break;

                    case '2':
                        Login.CreateBook();
                        break;

                    case '*':
                        Login.FillInEmptyTags();
                        break;

                    case '#':
                        Login.DisplayCounts();
                        break;

                    case 'M':
                        Login.DisplayVersion();
                        break;

                    case '?':
                        Logger.OutputInformation("(R)egister");
                        Logger.OutputInformation("(L)ogin");
                        Logger.OutputInformation("(E)mail New Password");
                        Logger.OutputInformation("(C)hange Password");
                        Logger.OutputInformation("(P)rint Book Details");
                        Logger.OutputInformation("Page (D)own");
                        Logger.OutputInformation("Page (U)p");
                        Logger.OutputInformation("(+) Line Up");
                        Logger.OutputInformation("(-) Line Down");
                        Logger.OutputInformation("(H)ome");
                        Logger.OutputInformation("e(N)d");
                        Logger.OutputInformation("(O)rder");
                        Logger.OutputInformation("(F)ilter");
                        Logger.OutputInformation("con(V)ert web page to import database file");
                        Logger.OutputInformation("(I)mport from list");
                        Logger.OutputInformation("(X)ml save to file");
                        Logger.OutputInformation("xml lo(A)d from file");
                        Logger.OutputInformation("1 - delete book");
                        Logger.OutputInformation("2 - create book");
                        Logger.OutputInformation("upda(T)e book");
                        Logger.OutputInformation("Fill in (*) empty tags");
                        Logger.OutputInformation("(#) Counts");
                        Logger.OutputInformation("(M)ajor/Minor Version Number");
                        Logger.OutputInformation("(?) Help");
                        Logger.OutputInformation("(Q)uit");
                        break;

                    default:
                        // Ignore
                        break;
                    }
                }
            }while (cmdString.Length == 0 || cmdString.ToUpper()[0] != 'Q');



            Logger.OutputInformation("Reached End");
            Console.ReadKey();
            Logger.OutputInformation("Exiting JH Book List Console Application.");
        }