Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.69 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication4
  7. {
  8.     class Program
  9.     {
  10.         enum statusPass { OK, NietOK, Onbekend};
  11.         enum statusMenu { Menu1, Menu2, Menu3, Menu4, Menu5, Menu6, Menu7, Menu8, Menu9, MyChoise };
  12.                  
  13.         static void Main(string[] args)
  14.         {
  15.             string userName;
  16.             string passWordUser;
  17.             statusPass InlogStatus;
  18.             InlogStatus = statusPass.Onbekend;
  19.             int poging = (0);
  20.             int maxPoging = (3);
  21.  
  22.                 Console.Write("Console Asks - Please Enter your Name: ");
  23.                 userName = Console.ReadLine();
  24.  
  25.                 Console.WriteLine("");
  26.  
  27.               while (InlogStatus != statusPass.OK)
  28.                 {
  29.                     Console.WriteLine("U heeft nog ({0}/{1}) over", poging, maxPoging);
  30.                     Console.WriteLine("************************************");
  31.                     Console.Write("Console Asks - Please Enter your Password: ");
  32.                     passWordUser = Console.ReadLine();
  33.  
  34.                     InlogStatus =  auth (passWordUser);
  35.                     switch (InlogStatus)
  36.                         {
  37.                             case statusPass.OK:
  38.                                 Console.WriteLine("************************************");
  39.                                 Console.WriteLine("Wacht Woord is Okey");
  40.                                 break;
  41.                        
  42.                             case statusPass.NietOK:
  43.                                 Console.WriteLine("************************************");
  44.                                 Console.WriteLine("Wacht Woord is niet goed");
  45.                                 poging++;
  46.                                     if (poging == 2)
  47.                                     {
  48.                                         Console.WriteLine("LET OP: Laatste poging!");
  49.                                     }
  50.                                 break;                    
  51.                         }
  52.                     if (poging == 3)
  53.                        break;
  54.  
  55.                 }
  56.  
  57.               if (InlogStatus == statusPass.OK)
  58.                   {
  59.                       Console.WriteLine("************************************");
  60.                       Console.Write("Welkom bij Sharpsound ({0})", userName);    
  61.                       ShowMenu();
  62.                   }
  63.               else
  64.                   {
  65.                       Console.Write("Max aantal pogingen begrijkt neem contact op met uw netwerk administrator");
  66.                       Console.ReadLine();
  67.                   }
  68.        
  69.         }
  70.  
  71.  
  72.         private static statusPass auth(string passWordUser)
  73.         {
  74.  
  75.             {
  76.                 string passWord = "1";
  77.                 statusPass InlogStatus;
  78.                 InlogStatus = statusPass.Onbekend;
  79.  
  80.                 if (passWordUser == passWord)
  81.                 {
  82.                     InlogStatus = statusPass.OK;
  83.                 }
  84.                 else
  85.                 {
  86.                     InlogStatus = statusPass.NietOK;
  87.                 }
  88.                 return (InlogStatus);
  89.             }
  90.         }
  91.  
  92.        
  93.         private static void ShowMenu()
  94.                
  95.         {
  96.             Console.WriteLine("My Options");
  97.             Console.WriteLine();
  98.             Console.WriteLine("1 - menu option 1");
  99.             Console.WriteLine("2 - menu option 2");
  100.             Console.WriteLine("3 - menu option 3");
  101.             Console.WriteLine("4 - menu option 4");
  102.             Console.WriteLine("5 - menu option 5");
  103.             Console.WriteLine("6 - menu option 6");
  104.             Console.WriteLine("7 - menu option 7");
  105.             Console.WriteLine("8 - menu option 8");
  106.             Console.WriteLine("9 - menu option 9");
  107.  
  108.             Console.Write("Choice (1,2,3,4,5,6,7,8,or 9): ");
  109.             string press = Console.ReadKey();
  110.             int choice = int.Parse(press);
  111.             showSelectedMenu(choice);
  112.  
  113.  
  114.         }
  115.  
  116.  
  117.         private static void showSelectedMenu (string MyChoice)
  118.         {
  119.            
  120.             switch (MyChoice)
  121.                         {
  122.                             case 1:
  123.                                 Console.WriteLine("test applicatie");
  124.                                 do
  125.                                 {
  126.                                     press = Console.ReadKey();
  127.                                    
  128.                                 } while (press.Key != ConsoleKey.Escape);
  129.                                 ShowMenu();
  130.                                 break;
  131.                         }
  132.  
  133.             return;
  134.         }
  135.  
  136.     }
  137. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement