Beispiel #1
0
        public void DisplayParticipants()
        {
            MenuUtils.ClearList(_dynFields);

            var experimentName = _launchManager.ExperimentName;
            var s = _log.GetAllSessionsData(experimentName);

            session_ids     = Array.ConvertAll(s[0], int.Parse);
            participant_ids = s[1];

            for (var i = 0; i < session_ids.Length; i++)
            {
                var sid = session_ids[i];
                var pid = participant_ids[i];

                var gObject = GameObjectUtils.InstatiatePrefab("Prefabs/Menus/Lists/EvaluationEntry");
                gObject.transform.Find("DetailsButton").GetComponent <Button>().onClick.AddListener(() =>
                {
                    ShowParticipantDetails(sid);
                });
                gObject.transform.Find("RemoveButton").GetComponent <Button>().onClick.AddListener(() =>
                {
                    RemoveEvaluationEntry(sid, pid, gObject);
                });
                MenuUtils.PlaceElement(gObject, _dynFields);

                gObject.transform.Find("SessionId").GetComponent <Text>().text     = sid.ToString();
                gObject.transform.Find("ParticipantId").GetComponent <Text>().text = pid;
            }

            //creates a map on the second camera
            //_map.GetComponent<PopUpEvaluationMap>().SetupMaps(envs);
        }
Beispiel #2
0
        private static void CabinInfo()
        {
            // hitta alla stugor in i en array
            using (CampSleepawayContext context = new CampSleepawayContext())
            {
                var cabinQuery = (from cabins in context.Cabins
                                  select cabins).ToList();
                string[] cabinNames = new string[cabinQuery.Count];
                for (int i = 0; i < cabinQuery.Count; i++)
                {
                    cabinNames[i] = cabinQuery[i].Name;
                }
                // visa lista över alla stugor
                int choice = MenuLibrary.MenuUtils.AlternetivesMenu(
                    0,
                    cabinNames,
                    "Välj vilken kabin du vill se info om");
                // visa info om valda kabin
                Cabin cabinInfo = cabinQuery[choice];
                context.Entry(cabinInfo).Reference(c => c.Counselor).Load();
                context.Entry(cabinInfo).Collection(c => c.Campers).Load();

                Console.WriteLine($"\nLägerhusets namn: {cabinInfo.Name}");

                if (cabinInfo.Counselor != null)
                {
                    Console.WriteLine($"\nGruppledarens namn: {cabinInfo.Counselor.FirstName}");
                }
                if (cabinInfo.Campers != null)
                {
                    PrintCamperInfo(context, cabinInfo);
                }
            }
            MenuUtils.PauseUntilFeedback("Tryck en knapp för att fortsätta");
        }
Beispiel #3
0
    public void EmployeeMenu()
    {
        int? choice = MenuUtils.GetIntChoice(MenuUtils.EmployeeMenu(), 1, 4);

        switch (choice)
        {
            case 1:
                PrintFromDb<Employee>((EmployeeContext db) =>
                {
                    return db.Employees.AsNoTracking().ToList();
                });
                SalaryChargeMenu((EmployeeContext db) =>
                {
                    return db.Employees.AsNoTracking().Sum(x => x.Salary);
                }, EmployeeMenu);
                break;
            case 2:
                EmployeeMenuFiltered();
                break;
            case 3:
                EmployeeCudMenu();
                break;
            case 4:
                MainMenu();
                break;
            default:
                break;
        }
    }
Beispiel #4
0
    public void SalaryChargeMenu(Func<EmployeeContext, float> func, Action backMenu)
    {
        int? choice = MenuUtils.GetIntChoice(MenuUtils.SalaryChargeMenu(), 1, 2);

        switch (choice)
        {
            case 1:
                using (var db = new EmployeeContext())
                {
                    try
                    {
                        Console.WriteLine(func.Invoke(db) + "$");
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                }
                break;
            case 2:
                backMenu.Invoke();
                break;
            default:
                break;
        }
    }
Beispiel #5
0
        private static void CheckCampersCouncelour()
        {
            using (CampSleepawayContext context = new CampSleepawayContext())
            {
                //======
                // Ask for Next of kin info
                string bigfirstname = MenuUtils.AskForString("Vad heter målsmannen i förnamn?");
                string biglastname  = MenuUtils.AskForString("Vad heter målsmannen i efternamn?");
                // Query data from next of kin

                NextOfKin nextOfKin = (from nextOfKins in context.NextOfKins
                                       where nextOfKins.FirstName == bigfirstname &&
                                       nextOfKins.LastName == biglastname
                                       select nextOfKins).FirstOrDefault();
                context.Entry(nextOfKin).Collection(c => c.Campers).Load();

                int      campersCount     = nextOfKin.Campers.Count();
                string[] campersFirstName = new string[campersCount];
                string[] campersLastName  = new string[campersCount];
                int[]    camperIds        = new int[campersCount];
                int      i = 0;
                foreach (var campersInQuery in nextOfKin.Campers)
                {
                    campersFirstName[i] = campersInQuery.FirstName;
                    campersLastName[i]  = campersInQuery.LastName;
                    camperIds[i]        = campersInQuery.CamperId;
                    i++;
                }
                // Checks out and prints all the campers of the next of kin.
                int choice = MenuUtils.AlternetivesMenu(0, campersFirstName, "Vilken unge vill du hämta?");

                //var camperQuery = (from camper in context.Campers
                //                   where camper.LastName == campersLastName[choice] &&
                //                   camper.FirstName == campersFirstName[choice]
                //                   select camper.Cabin).ToList();
                string camperFirstName = campersFirstName[choice];
                string camperLastName  = campersLastName[choice];
                int    camperId        = camperIds[choice];
                //======

                string camperName  = MenuUtils.AskForString("Vad heter parveln i förnamn?");
                var    camperQuery = (from camper in context.Campers
                                      where camper.CamperId == camperId
                                      select camper.Cabin).ToList();


                // visa info om valda kabin
                Cabin cabinInfo = camperQuery[0];
                context.Entry(cabinInfo).Reference(c => c.Counselor).Load();
                if (cabinInfo.Counselor != null)
                {
                    Console.WriteLine($"\nGruppledarens namn: {cabinInfo.Counselor.FirstName}");
                }
                else
                {
                    Console.WriteLine("Hittade ingen råggivare till den kamparen");
                }
            }
            MenuUtils.PauseUntilFeedback("Tryck en knapp för att fortsätta");
        }
Beispiel #6
0
        bool ISubProgram.Init(MenuUtils menuUtils, ProgramConfig programConfig)
        {
            this.menuUtils = menuUtils;
            try {
                IDeserializer deserializer = new DeserializerBuilder()
                                             .WithTagMapping("tag:yaml.org,2002:directOnlineSourceConfig", typeof(DirectOnlineSourcesConfig))
                                             .WithTagMapping("tag:yaml.org,2002:queriedOnlineSourceConfig", typeof(QueriedOnlineSourceConfig))
                                             .WithTagMapping("tag:yaml.org,2002:storedMappingValue", typeof(StoredMappingValue))
                                             .WithTagMapping("tag:yaml.org,2002:fileUrlBasedMappingValue", typeof(FileUrlBasedMappingValue))
                                             .WithNodeDeserializer(
                    inner => new MenuObjectDeserializer(inner, new DefaultObjectFactory()),
                    s => s.InsteadOf <ObjectNodeDeserializer>()
                    )
                                             .Build();
                using (StreamReader reader = File.OpenText(configFilePath)) {
                    dataComparer = deserializer.Deserialize <DataComparerConfig>(reader);
                }

                dataComparer.Init(programConfig);
                return(true);
            } catch (Exception e) {
                Console.WriteLine("Encountered an exception during parsing of the config!");
                Console.WriteLine("Exception: " + e);
                Console.ReadKey(true);
                return(false);
            }
        }
        private static void CheckOut()
        {
            DbHandler handler   = new DbHandler();
            string    regNumber = MenuUtils.AskForStringWithoutSpecialChar("Vänligen skriv in reg-numret för fordonet som ska checkas ut.").ToUpper();

            CheckOut(handler, regNumber);
        }
        private static void MoveVehicle()
        {
            DbHandler handler   = new DbHandler();
            string    regNumber = MenuUtils.AskForStringWithoutSpecialChar("Vänligen skriv in reg-numret för fordonet som ska flyttas.").ToUpper();

            string[] freeParkingSpaces  = handler.FetchFreeParkingSpaces();
            int      parkingspaceChoice = MenuUtils.AlternetivesMenu(0, freeParkingSpaces, "Välj en plats att flytta fordonet");
            string   choosenSpot        = freeParkingSpaces[parkingspaceChoice];
            int      spaceMoveFrom      = handler.FetchVehicleSpot(regNumber);
            int      spaceMoveTo        = Convert.ToInt32(choosenSpot);

            bool result = handler.MoveVehicle(regNumber, spaceMoveTo);

            Console.Clear();
            if (result)
            {
                Console.WriteLine("Flytten lyckades!");


                Console.WriteLine($"Flytta fordonet med reg-nummer {regNumber} från plats {spaceMoveFrom} till plats {spaceMoveTo}");
                MenuUtils.PauseUntilFeedback(OrderMessage);
            }
            else
            {
                Console.WriteLine("Något gick fel!");
                MenuUtils.PauseUntilFeedback("Tryck på en knapp för att fortsätta");
            }
        }
    /**
     * LoadFromPlayerPrefs(String st)
     *  -> assign corresponding values to UI elements  from PlayerPrefs matching st selector
     * */
    void LoadFromPlayerPrefs(String st = "")
    {
        if (st.Equals("video") || st.Equals(""))
        {
            m_fullscreen = PlayerPrefs.GetInt("Fullscreen") == 1 ? true : false;
            m_ratio      = PlayerPrefs.GetInt("AspectRatio");
            quality      = PlayerPrefs.GetInt("QualityLevel");
            m_resolution = PlayerPrefs.GetInt("Resolution");
            QualitySettings.SetQualityLevel(quality, true);
            m_sound_effects_volume = PlayerPrefs.GetFloat("SoundVolume") * 10;
            m_music_volume         = PlayerPrefs.GetFloat("MusicVolume") * 10;
            m_vsync        = PlayerPrefs.GetInt("VSync");
            m_antialiasing = PlayerPrefs.GetInt("AntiAliasing");
        }
        else if (st.Equals("keybindings"))
        {
            MenuConfig.m_keybindings[0] = MenuUtils.GetStringFromKeycode((KeyCode)PlayerPrefs.GetInt("ForwardKey"));
            MenuConfig.m_keybindings[1] = MenuUtils.GetStringFromKeycode((KeyCode)PlayerPrefs.GetInt("BackwardKey"));
            MenuConfig.m_keybindings[2] = MenuUtils.GetStringFromKeycode((KeyCode)PlayerPrefs.GetInt("LeftKey"));
            MenuConfig.m_keybindings[3] = MenuUtils.GetStringFromKeycode((KeyCode)PlayerPrefs.GetInt("RightKey"));
            MenuConfig.m_keybindings[4] = MenuUtils.GetStringFromKeycode((KeyCode)PlayerPrefs.GetInt("OffensiveItemKey"));

            //MenuConfig.m_keybindings[5] = MenuUtils.GetStringFromKeycode((KeyCode)PlayerPrefs.GetInt("DefensiveItemKey"));
        }
    }
Beispiel #10
0
        /// <summary>
        /// Add elements to the available scenes list.
        /// </summary>
        public void UpdateAvailableScenes()
        {
            var path      = _launchManager.MenuManager.SceneFilePath;
            var filenames = Directory.GetFiles(path);

            if (!transform.Find("Panel").Find("KeepScenesButton").Find("Button").GetComponent <Toggle>().isOn)
            {
                MenuUtils.ClearList(_availableScenesList);
            }

            foreach (var filename in filenames)
            {
                //this block is a filter which filters files by the ".unity" or ".xml"-ending(questionnaires)
                var splittedFilename = filename.Split('.');
                var fileType         = splittedFilename[splittedFilename.Length - 1];
                if (!(fileType.Equals("unity") || fileType.Equals("xml")))
                {
                    continue;
                }

                //this block adds the data to the menu
                var filenameObj = GameObjectUtils.InstatiatePrefab("Prefabs/Menus/Lists/AvailableSceneEntry");
                MenuUtils.PlaceElement(filenameObj, _availableScenesList);

                var localFilename = filename;
                filenameObj.transform.Find("AddButton").GetComponent <Button>().onClick.AddListener(() => { AddToChoosenScenes(localFilename); });
                filenameObj.transform.Find("RemoveButton").GetComponent <Button>().onClick.AddListener(() => { Destroy(filenameObj); });
                filenameObj.transform.Find("SceneName").GetComponent <Text>().text = RemovePathPrefix(filename);
            }
        }
        private static void RunMenuLoop()
        {
            while (!exit)
            {
                Console.Clear();
                MenuUtils.PrintHeading();
                MenuUtils.PrintMenu();

                bool      userInputIsCorrect = false;
                MenuEntry?chosenEntry        = null;
                while (!userInputIsCorrect)
                {
                    Console.Write("Choose an operation: ");
                    chosenEntry = MenuUtils.ProcessUserInput();
                    if (chosenEntry == null)
                    {
                        Console.WriteLine("Incorrect input.");
                    }
                    else
                    {
                        userInputIsCorrect = true;
                    }
                }

                Console.Clear();
                ProcessMenuEntry(chosenEntry.Value);
            }
        }
Beispiel #12
0
        public void Action()
        {
            // Select a worker to check-out
            Console.WriteLine("Workers:");
            MenuUtils.PrintListAscending(_workersService.Workers);
            string userInput = ConsoleUtils.GetInputAfterOutput("Enter your number:");

            if (!MenuUtils.ValidateNumericMenuChoice(userInput, _workersService.Workers.Count, out int userChoice)
                )
            {
                return;
            }

            Worker  chosenWorker  = _workersService.Workers[userChoice - 1];
            Cashier workerCashier = _workersService.GetCashierByWorker(chosenWorker);

            // Checks if worker checked in yet
            if (!workerCashier.IsOpen)
            {
                Console.WriteLine($"\nWorker '{chosenWorker}' hasn't checked in yet!\n");
                return;
            }

            _workersService.CheckOuts[chosenWorker] = DateTime.Now;
            workerCashier.IsOpen = false;
            Console.WriteLine($"\nHave a good day, {chosenWorker}!\n");
        }
Beispiel #13
0
        public async void MainMenu()
        {
            int?choice = null;

            do
            {
                choice = MenuUtils.GetIntChoice(MenuUtils.BaseChoiceMenu(), 1, 4);
                switch (choice)
                {
                case 1:
                    EmployeeMenu();
                    break;

                case 2:
                    ServiceMenu();
                    break;

                case 3:
                    List <Employee> employees = await EmployeesWebService.Get();

                    Console.WriteLine(employees.Sum(x => x.Salary));
                    break;

                case 4:
                    Environment.Exit(0);
                    break;

                default:
                    break;
                }
            } while (true);
        }
Beispiel #14
0
  public void MainMenu()
 {
     int? choice = null;
     do
     {
         choice = MenuUtils.GetIntChoice(MenuUtils.BaseChoiceMenu(), 1, 4);
         switch (choice)
         {
             case 1:
                 EmployeeMenu();
                 break;
             case 2:
                 ServiceMenu();
                 break;
             case 3:
                 using (var db = new EmployeeContext())
                 {
                     Console.WriteLine(db.Employees.AsNoTracking().Sum(x => x.Salary));
                 }
                 break;
             case 4:
                 Environment.Exit(0);
                 break;
             default:
                 break;
         }
     } while (true);
 }
        private void ml_form_garrison_detachment_consequence(MenuCallbackArgs args, PatrolData dat)
        {
            List <InquiryElement> inq = MenuUtils.AssemblePatrolSizes(dat);

            InformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData(new TextObject("{=ml.patrol.size.select}Select Size").ToString(), new TextObject("{=ml.patrol.size.select.desc}Select the size of the patrol you want.").ToString(), inq, true, 1, "Name and purchase", "Cancel",
                                                                                       delegate(List <InquiryElement> selection)
            {
                if (selection != null)
                {
                    if (selection.Count != 0)
                    {
                        InformationManager.ShowTextInquiry(new TextInquiryData(new TextObject("{=ml.name.patrol}Select your patrol's name: ", null).ToString(), string.Empty, true, false, GameTexts.FindText("str_done", null).ToString(), null,
                                                                               delegate(string str)
                        {
                            TownPatrolData newPatrol = SpawnTownPatrol(str, selection[0].Title.ToLower(), dat, true);
                            this._mlTownPatrols[Settlement.CurrentSettlement.StringId].Add(newPatrol);
                            InformationManager.HideInquiry();
                        }, null, false, null, "", Settlement.CurrentSettlement.Name.ToString() + " " + dat.name));
                    }
                }
            },
                                                                                       delegate(List <InquiryElement> selection)
            {
                InformationManager.HideInquiry();
            }));
        }
Beispiel #16
0
        private static void CheckInCamper()
        {
            using (CampSleepawayContext context = new CampSleepawayContext())
            {
                string bigfirstname = MenuUtils.AskForString("Vad heter målsmannen i förnamn?");
                string biglastname  = MenuUtils.AskForString("Vad heter målsmannen i efternamn?");


                bool          oneMore = true;
                List <Camper> family  = new List <Camper>();
                while (oneMore)
                {
                    string firstname = MenuUtils.AskForString("Vad heter kamparen i förnamn?");
                    string lastname  = MenuUtils.AskForString("Vad heter kamparen i efternamn?");

                    family.Add(new Camper {
                        FirstName = firstname, LastName = lastname
                    });

                    oneMore = MenuUtils.AlternetivesMenu(1, new string[] { "Ja", "Nej" }, "Var det alla?") == 0 ? false : true;
                }

                NextOfKin nextOfKin = new NextOfKin
                {
                    FirstName = bigfirstname,
                    LastName  = biglastname,
                    Campers   = family
                };
                context.NextOfKins.Add(nextOfKin);
                // Let user choose cabin for all campers.
                bool chooseCabin = MenuUtils.AlternetivesMenu(1, new string[] { "Ja, nu på en gång.", "Nej, det kan göras senare." }, "Vill du välja stugor själv?") == 0 ? true : false;
                if (chooseCabin)
                {
                    foreach (var camper in nextOfKin.Campers)
                    {
                        var cabins = (from emptyCabins in context.Cabins
                                      where emptyCabins.Campers.Count <= 3
                                      select emptyCabins).ToList();
                        // Will query for all empty cabins
                        string[] cabinText = new string[cabins.Count()];
                        int      y         = 0;
                        foreach (var cabin in cabins)
                        {
                            context.Entry(cabin).Collection(c => c.Campers).Load();
                            cabinText[y] = String.Format($"{cabin.Name}: {3 - cabin.Campers.Count}");
                        }
                        // Let user choose from cabins, and see remaining spots.

                        int cabinChoice = MenuUtils.AlternetivesMenu(0, cabinText, "välj cabin för " + camper.FirstName + ".");
                        y++;
                        camper.Cabin = cabins[cabinChoice];
                        cabins[cabinChoice].Campers.Add(camper);


                        // Loop until all campers has a cabin.
                    }
                }
                context.SaveChanges();
            }
        }
Beispiel #17
0
        static void Main(string[] args)
        {
            int opcaoDeslogado = 0;

            do
            {
                MenuUtils.MenuDeslogado();
                opcaoDeslogado = int.Parse(Console.ReadLine());
                switch (opcaoDeslogado)
                {
                case 1:
                    //Cadastro usuario
                    UsuarioViewController.CadastrarUsuario();
                    break;

                case 2:
                    //Login
                    UsuarioViewModel usuarioRecuperado = UsuarioViewController.Login();
                    if (usuarioRecuperado != null)
                    {
                        System.Console.WriteLine($"Seja Bem Vindo {usuarioRecuperado.Nome}");
                        System.Console.WriteLine("Pressione ENTER para continuar");
                        Console.ReadLine();
                    }
                    break;

                default:
                    System.Console.WriteLine("Digite uma opção válida");
                    break;
                }
            } while (opcaoDeslogado != 0);
        }
Beispiel #18
0
        public void Visit(LadderQuestion q)
        {
            var ladder = GameObjectUtils.InstatiatePrefab("Prefabs/Menus/Questionnaire/Content/LadderContent");

            _customContent = ladder.transform;
            MenuUtils.PlaceElement(ladder, _questionContent);

            _dynamicFieldsWithScrollbar.gameObject.SetActive(false);

            _customContent.Find("LadderLabel").gameObject.GetComponent <Text>().text = q.LadderText;
            var ladderButtons = _customContent.Find("LadderGroup").Find("Buttons");

            var qmb = _questionPlaceholder.GetComponent <QuestionMenuButtons>();

            for (var i = 9; i >= 0; i--)
            {
                var btn = ladderButtons.Find("ToggleButtons" + i).GetComponent <Toggle>();

                var iLocal = i;
                btn.onValueChanged.AddListener(isOn =>
                {
                    qmb.SetAnswerInt(iLocal, isOn ? 1 : 0);
                });
                btn.isOn = _oldAnswers != null && _oldAnswers.ContainsKey(i);
            }
        }
Beispiel #19
0
        public void Visit(TextQuestion q)
        {
            var qmb    = _questionPlaceholder.GetComponent <QuestionMenuButtons>();
            var length = 0;

            if (q.RowLabels != null)
            {
                length = MenuUtils.GetMaxTextLength(q.RowLabels.Select(l => l.Text).ToList());
            }

            var answernumber = 0;

            for (var index = 0; index < q.NRows; index++)
            {
                var iLocal = index;

                var text = q.RowLabels != null ? q.RowLabels[index].Text : "";

                var labelAndField = MenuUtils.AddLabelText("Questionnaire/Rows/LabelledTextField", text, _dynamicField, "Label", length);

                var inpt = labelAndField.transform.Find("InputField").GetComponent <InputField>();

                inpt.onEndEdit.AddListener(answer =>
                {
                    qmb.SetAnswerString(iLocal, answer);
                });
                if (_oldAnswers != null && _oldAnswers.ContainsKey(answernumber))
                {
                    inpt.text = _oldAnswers[answernumber];
                }
                answernumber++;
            }
        }
        private static void ViewParkingLot()
        {
            DbHandler handler = new DbHandler();

            Console.Clear();
            handler.ViewParkingLot();
            MenuUtils.PauseUntilFeedback("Tryck på en knapp för att återvända till menyn");
        }
 void OnGUI()
 {
     if (!active)
     {
         return;
     }
     GUI.Window(1337, MenuUtils.ResizeGUI(WindowRectangle), ShowPopUp, "Alert");
 }
Beispiel #22
0
        public void Render(DrawArgs drawArgs)
        {
            if (!m_Visible)
            {
                return;
            }

            MenuUtils.DrawBox(
                m_Location.X,
                m_Location.Y,
                m_Size.Width,
                m_Size.Height,
                0.0f,
                m_BackgroundColor.ToArgb(),
                drawArgs.device);

            if (m_Values == null || m_Values.Length == 0)
            {
                return;
            }

            float xIncr = (float)m_Size.Width / (float)m_Values.Length;

            m_Verts = new CustomVertex.TransformedColored[m_Values.Length];

            if (m_ResetVerts)
            {
                for (int i = 0; i < m_Values.Length; i++)
                {
                    if (m_Values[i] < m_Min)
                    {
                        m_Verts[i].Y = m_Location.Y + m_Size.Height;
                    }
                    else if (m_Values[i] > m_Max)
                    {
                        m_Verts[i].Y = m_Location.Y;
                    }
                    else
                    {
                        float p = (m_Values[i] - m_Min) / (m_Max - m_Min);
                        m_Verts[i].Y = m_Location.Y + m_Size.Height - (float)m_Size.Height * p;
                    }

                    m_Verts[i].X     = m_Location.X + i * xIncr;
                    m_Verts[i].Z     = 0.0f;
                    m_Verts[i].Color = m_LineColor.ToArgb();
                }
            }

            drawArgs.device.TextureState[0].ColorOperation = TextureOperation.Disable;
            drawArgs.device.VertexFormat = CustomVertex.TransformedColored.Format;

            drawArgs.device.VertexFormat = CustomVertex.TransformedColored.Format;
            drawArgs.device.DrawUserPrimitives(
                PrimitiveType.LineStrip,
                m_Verts.Length - 1,
                m_Verts);
        }
        private static void CheckOut(DbHandler handler, string regNumber)
        {
            string checkOutOrder = handler.CheckOutVehicle(regNumber);

            Console.Clear();
            //Console.WriteLine(checkOutOrder);

            MenuUtils.PauseUntilFeedback(checkOutOrder);
        }
        static void Main(string[] args)
        {
            int respostaLixo = 0;

            Console.WriteLine("Bem-vindo a C.A enterprises,a melhor empresa de reciclagem do Brasil");
            System.Console.WriteLine("Selecione qual lixo depositar:");
            MenuUtils.MenuPrincipal();
            respostaLixo = int.Parse(Console.ReadLine());
            switch (respostaLixo)
            {
            case 1:
                CaixaDeLeite caixaDeLeite = new CaixaDeLeite();
                caixaDeLeite.GetType().GetInterface("IPapel");
                caixaDeLeite.Papel();

                break;

            case 2:
                Latinha latinha = new Latinha();
                latinha.GetType().GetInterface("IMetal");
                latinha.Metal();
                break;

            case 3:
                GarrafaDeCachaça garrafaDeCachaça = new GarrafaDeCachaça();
                garrafaDeCachaça.GetType().GetInterface("IVidro");
                garrafaDeCachaça.Vidro();
                break;

            case 4:
                EmbalagaemSalgadinho embalagaemSalgadinho = new EmbalagaemSalgadinho();
                embalagaemSalgadinho.GetType().GetInterface("IPlastico");
                embalagaemSalgadinho.Plastico();
                break;

            case 5:
                GuardaChuva guardaChuva = new GuardaChuva();
                guardaChuva.GetType().GetInterface("IIndefinido");
                guardaChuva.Indefinido();
                break;

            case 6:
                Maçã maçã = new Maçã();
                maçã.GetType().GetInterface("IOrganico");
                maçã.Organico();
                break;

            case 0:
                System.Console.WriteLine("Saindo...");
                break;

            default:
                System.Console.WriteLine("Opção inválida,por favor inicie o programa novamente!");
                break;
            }
        }
Beispiel #25
0
        /// <summary>
        /// Displays all summary information that EVE currently knows.
        /// </summary>
        public void DisplayParticipantDetails()
        {
            MenuUtils.ClearList(_dynamicField);


            var envs    = _log.GetSceneNames(_launchManager.ExperimentName);// _log.GetListOfEnvironments(_sessionId).Distinct().ToArray(); ;
            var timeSec = new TimeSpan[envs.Length];


            _fields.Find("SessionInformation").Find("SessionId").GetComponent <Text>().text = _sessionId.ToString();

            for (var k = 0; k < envs.Length; k++)
            {
                var sceneDescription = GameObjectUtils.InstatiatePrefab("Prefabs/Menus/Lists/SceneEntry");
                MenuUtils.PlaceElement(sceneDescription, _dynamicField);

                sceneDescription.transform.Find("SceneInformation").Find("SceneLabel")
                .GetComponent <Text>().text = "Scene " + k + ":";
                sceneDescription.transform.Find("SceneInformation").Find("SceneValue")
                .GetComponent <Text>().text = envs[k].Name;
                timeSec[k] = TimeSpan.FromSeconds(0);
                var times = _log.GetSceneTime(k, _sessionId);
                if (times[0] != null && times[1] != null)
                {
                    timeSec[k] = TimeUtils.TimeSpanDifference(times[0], times[1]);
                }
                else if (times[0].Length > 0)
                {
                    timeSec[k] = TimeUtils.TimeSpanDifference(times[0], times[0]);
                }

                sceneDescription.transform.Find("Statistics").Find("TimeInformation").Find("TimeValue")
                .GetComponent <Text>().text = timeSec[k].TotalSeconds.ToString();

                var xyzTable = _log.GetPath(_sessionId, k);
                if (xyzTable[0].Count <= 0)
                {
                    continue;
                }
                var distance = MenuUtils.ComputeParticipantPathDistance(xyzTable);
                sceneDescription.transform.Find("Statistics").Find("DistanceInformation").Find("DistanceValue")
                .GetComponent <Text>().text = distance.ToString();

                //make replay button
                var replayButton   = sceneDescription.transform.Find("Buttons").Find("ReplayButton").GetComponent <Button>();
                var localSceneId   = k;
                var localSceneName = envs[k];
                var localSessionId = _sessionId;
                replayButton.onClick.AddListener(() => Replay(localSessionId, localSceneId, localSceneName.Name));

                //make show map button
                _map = gameObject.GetComponent <PopUpEvaluationMap>();
                var showMapButton = sceneDescription.transform.Find("Buttons").Find("ShowMapButton").GetComponent <Button>();
                showMapButton.onClick.AddListener(() => ShowMap(localSessionId, localSceneId, localSceneName.Name));
            }
        }
Beispiel #26
0
    private void EmployeeCudMenu()
    {
        int? choice = MenuUtils.GetIntChoice(MenuUtils.CudMenu(), 1, 4);

        switch (choice)
        {
            case 1:
                using (var db = new EmployeeContext())
                {
                    db.Employees.Add(MenuUtils.BuildEmployeeWithService(db));
                    db.SaveChanges();
                }
                break;
            case 2:
                PrintFromDb<Employee>((EmployeeContext db) =>
                {
                    return db.Employees.AsNoTracking().ToList();
                });
                using (var db = new EmployeeContext())
                {
                    Employee empToUpdate = null;
                    do
                    {
                        empToUpdate = db.Employees.Find(MenuUtils.GetIntChoice("Select employee to update by id", 1, int.MaxValue));
                    } while (empToUpdate == null);

                    Employee newValues = MenuUtils.BuildEmployeeWithService(db);
                    newValues.EmployeeId = empToUpdate.EmployeeId;
                    db.Entry(empToUpdate).CurrentValues.SetValues(newValues);
                    db.SaveChanges();
                }
                break;
            case 3:
                PrintFromDb<Employee>((EmployeeContext db) =>
                {
                    return db.Employees.AsNoTracking().ToList();
                });
                using (var db = new EmployeeContext())
                {
                    Employee empToDelete = null;
                    do
                    {
                        empToDelete = db.Employees.Find(MenuUtils.GetIntChoice("Select employee to delete by id", 1, int.MaxValue));
                    } while (empToDelete == null);

                    db.Entry(empToDelete).State = EntityState.Deleted;
                    db.SaveChanges();
                }
                break;
            case 4:
                EmployeeMenu();
                break;
            default:
                break;
        }
    }
Beispiel #27
0
        private void Hooks_On_AddMenuButtons(Hooks.Orig_AddMenuButtons orig, Main main, int selectedMenu, string[] buttonNames, float[] buttonScales, ref int offY, ref int spacing, ref int buttonIndex, ref int numButtons)
        {
            MenuUtils.AddButton(Language.GetTextValue("UI.Achievements"), delegate
            {
                Main.MenuUI.SetState(AchievementsMenu);
                Main.menuMode = 888;
            }, selectedMenu, buttonNames, ref buttonIndex, ref numButtons);

            orig(main, selectedMenu, buttonNames, buttonScales, ref offY, ref spacing, ref buttonIndex, ref numButtons);
        }
        static void Main(string[] args)
        {
            bool querSair = false;

            do
            {
                System.Console.WriteLine("Estas são as coisas descartadas por você até agora:");
                int codigo = MenuUtils <LixoEnum> .ExibirMenuPadrao();
            } while (true);
        }
        private void CheckOutFree()
        {
            DbHandler handler       = new DbHandler();
            string    regNumber     = MenuUtils.AskForStringWithoutSpecialChar("Vänligen skriv in reg-numret för fordonet som ska checkas ut.").ToUpper();
            string    checkOutOrder = handler.CheckOutVehicleForFree(regNumber);

            Console.Clear();
            Console.WriteLine(checkOutOrder);

            MenuUtils.PauseUntilFeedback(OrderMessage);
        }
        private static void SearchForVehicle()
        {
            DbHandler handler       = new DbHandler();
            string    regNum        = MenuUtils.AskForStringWithoutSpecialChar("Skriv in fordonets reg-nummer").ToUpper();
            string    searchMessage = handler.FetchVehicleInfo(regNum);

            Console.Clear();
            Console.WriteLine(searchMessage);

            MenuUtils.PauseUntilFeedback("Tryck på en knapp för att återvända till menyn");
        }