Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.03 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.             ConsoleKeyInfo press;
  97.             statusMenu MenuChoise; //wordt niet gebruikt geen hij een error hij gaat gewoon door no problem..
  98.             string MyChoise;  //wordt niet gebruikt geen hij een error.
  99.  
  100.             Console.WriteLine("My Options");
  101.             Console.WriteLine();
  102.             Console.WriteLine("1 - menu option 1");
  103.             Console.WriteLine("2 - menu option 2");
  104.             Console.WriteLine("3 - menu option 3");
  105.             Console.WriteLine("4 - menu option 4");
  106.             Console.WriteLine("5 - menu option 5");
  107.             Console.WriteLine("6 - menu option 6");
  108.             Console.WriteLine("7 - menu option 7");
  109.             Console.WriteLine("8 - menu option 8");
  110.             Console.WriteLine("9 - menu option 9");
  111.  
  112.             Console.Write("Choice (1,2,3,4,5,6,7,8,or 9): ");
  113.          
  114.             do
  115.             {
  116.                 press = Console.ReadKey();
  117.                 Console.WriteLine(press.Key.ToString());
  118.                                                
  119.             } while (press.Key != ConsoleKey.Escape);
  120.  
  121.  
  122.         }
  123.  
  124.  
  125.         private static void statusMenu (string MyChoise)
  126.         {
  127.             statusMenu MychoiseAnswer;
  128.             MychoiseAnswer = statusMenu.MyChoise; // hier loopt hij vast want hij zegt datie de string niet kan vinden die ik hier defineer omdat ik die string natuurlijk niet heb verwezen uit de andere functie
  129.            
  130.             switch (MychoiseAnswer)
  131.                         {
  132.                             case statusMenu.Menu1:
  133.                                 Console.WriteLine("test applicatie");
  134.                                
  135.                                 break;
  136.                         }
  137.  
  138.             return;
  139.         }
  140.  
  141.     }
  142. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement