コード例 #1
0
ファイル: Projection.cs プロジェクト: MilanNemeth/Solutions
        public Projection(Auditorium OwnerAuditorium, Movie OwnMovie)
        {
            #region debug message
#if DEBUG
            Program.LogThisCaller();
#endif
            #endregion
            this.OwnerAuditorium = OwnerAuditorium;
            this.OwnMovie        = OwnMovie;
            Name  = OwnMovie.Name;
            Seats = new Seat[OwnerAuditorium.Rows, OwnerAuditorium.Columns];
            InitSeats();
            if (!ObjectContainer.PDB.Contains(this))
            {
                ObjectContainer.PDB.Add(this);
            }
        }
コード例 #2
0
        bool ControlMenu(MenuItem[] MenuItems)
        {
            #region debug message
            #if DEBUG
            IO_Handler.LogItsCaller();
            #endif
            #endregion
            bool invalid = true;
            while (invalid)
            {
                ConsoleKey ck = Console.ReadKey(false).Key;
                switch (ck)
                {
                case ConsoleKey.UpArrow:
                    if (--index == -1)
                    {
                        index = MenuItems.Length - 1;
                    }
                    goto case ConsoleKey.Clear;

                case ConsoleKey.DownArrow:
                    if (++index == MenuItems.Length)
                    {
                        index = 0;
                    }
                    goto case ConsoleKey.Clear;

                case ConsoleKey.PageDown:
                    index = MenuItems.Length - 1;
                    goto case ConsoleKey.Clear;

                case ConsoleKey.PageUp:
                    index = 0;
                    goto case ConsoleKey.Clear;

                case ConsoleKey.Enter:
                    Console.Clear();
                    try
                    {
                        StackFrame sf          = new StackFrame(2);
                        string     caller_lvl2 = sf.GetMethod().Name;
                        if (caller_lvl2.Equals("InCinemaMenu"))
                        {
                            try
                            {
                                activeAuditorium = activeCinema.OwnAuditoriums[(byte)(index + 1)];
                                #region DEBUG
#if DEBUG
                                IO_Handler.SuccessMessage("ACTIVE AUDITORIUM GOT SET NOW!");
                                Thread.Sleep(800);
#endif
                                #endregion
                            }
                            catch (Exception e)
                            {
                                IO_Handler.ErrorMessage($"active auditorium not set:\nLOC-{(new StackFrame(1, true)).GetFileLineNumber()}\n" + e.Message);
                                Thread.Sleep(sleepTime);
                            }
                        }
                        if (caller_lvl2.Equals("InProjectionMenu"))
                        {
                            try
                            {
                                activeProjection = activeAuditorium.OwnProjections.Skip(index).First().Value;
                            }
                            catch (Exception e)
                            {
                                IO_Handler.ErrorMessage($"active projection not set:\nLOC-{(new StackFrame(1, true)).GetFileLineNumber()}\n" + e.Message);
                                Thread.Sleep(sleepTime);
                            }
                        }
                        GetThisMenuMethods()[index]();
                    }
                    catch (Exception e)
                    {
                        IO_Handler.ErrorMessage($"Error while opening this menu!\nLOC-{(new StackFrame(1, true)).GetFileLineNumber()}\n" + e.Message);
                        Thread.Sleep(sleepTime);
                    }
                    goto case ConsoleKey.Clear;

                case ConsoleKey.Escape:
                    index = 0;
                    return(false);

                case ConsoleKey.Clear:
                    return(true);

                default:
                    invalid = true;
                    break;
                }
            }
            return(true);
        }