Ejemplo n.º 1
0
        public void DrawMenu(Rectangle bounds, SpriteBatch sb)
        {
            var height    = 34;
            var rectangle = new Rectangle(bounds.X + 2, bounds.Y + 12, bounds.Width / 2 - 4, height);

            DrawMessage("Universal Medical", true, sb, rectangle, theme_light, Color.Black);
            rectangle.Y     += height + 2;
            rectangle.Height = 20;
            DrawMessage("Records & Monitoring Services", false, sb, rectangle);
            var destinationRectangle1 = new Rectangle(bounds.X + bounds.Width / 2 + 10, bounds.Y + 12, bounds.Width / 4 - 12,
                                                      (int)(logo.Height / (double)logo.Width * (bounds.Width / 4.0)));

            sb.Draw(logo, destinationRectangle1, theme_light);
            var destinationRectangle2 = new Rectangle(rectangle.X + 10, rectangle.Y + 40, rectangle.Width - 20, 1);

            sb.Draw(Utils.white, destinationRectangle2, Utils.SlightlyDarkGray * 0.5f);
            destinationRectangle2.Y += 4;
            sb.Draw(Utils.white, destinationRectangle2, Utils.SlightlyDarkGray * 0.5f);
            rectangle.Y += 90;
            if (!(comp.adminIP == os.thisComputer.ip))
            {
                rectangle.Height = bounds.Y + bounds.Height - rectangle.Y;
                DrawNoAdminMenuSection(rectangle, sb);
            }
            else
            {
                rectangle.Height = 80;
                DrawMessageBot("Information", true, sb, rectangle, theme_light, Color.Black);
                rectangle.Y     += rectangle.Height + 2;
                rectangle.Height = 20;
                DrawMessage("Details and Administration", false, sb, rectangle);
                rectangle.Y += rectangle.Height + 2;
                if (Button.doButton(444402000, rectangle.X + 1, rectangle.Y, rectangle.Width, 24, "Info", theme_strong))
                {
                    state = MedicalDatabaseState.AboutScreen;
                    elapsedTimeThisState = 0.0f;
                }
                rectangle.Y     += 60;
                rectangle.Height = 80;
                DrawMessageBot("Database", true, sb, rectangle, theme_light, Color.Black);
                rectangle.Y     += rectangle.Height + 2;
                rectangle.Height = 20;
                DrawMessage("Records Lookup", false, sb, rectangle);
                rectangle.Y += rectangle.Height + 2;
                if (state == MedicalDatabaseState.MainMenu)
                {
                    if (Button.doButton(444402005, rectangle.X + 1, rectangle.Y, rectangle.Width, 24, "Search",
                                        theme_strong))
                    {
                        state = MedicalDatabaseState.Search;
                        elapsedTimeThisState = 0.0f;
                        GetStringUIControl.StartGetString("Patient_Name", os);
                    }
                    rectangle.Y += 26;
                    if (Button.doButton(444402007, rectangle.X + 1, rectangle.Y, rectangle.Width, 24, "Random Entry",
                                        theme_strong))
                    {
                        searchName           = recordsFolder.files[Utils.random.Next(recordsFolder.files.Count)].name;
                        elapsedTimeThisState = 0.0f;
                        state = MedicalDatabaseState.Searching;
                        totalTimeThisState = 1.6f;
                    }
                }
                else if (state == MedicalDatabaseState.Search)
                {
                    var num     = Utils.QuadraticOutCurve(Math.Min(1f, elapsedTimeThisState * 2f));
                    var bounds1 = new Rectangle(rectangle.X, rectangle.Y - 10, rectangle.Width, (int)(num * 72.0));
                    var destinationRectangle3 = new Rectangle(bounds1.X, rectangle.Y + 2, rectangle.Width,
                                                              (int)(num * 32.0));
                    sb.Draw(Utils.white, destinationRectangle3, os.darkBackgroundColor);
                    var stringControl = GetStringUIControl.DrawGetStringControl("Enter patient name :", bounds1, () =>
                    {
                        elapsedTimeThisState = 0.0f;
                        state        = MedicalDatabaseState.Error;
                        errorMessage = "Error in name input";
                    }, () =>
                    {
                        elapsedTimeThisState = 0.0f;
                        state = MedicalDatabaseState.MainMenu;
                        os.terminal.executeLine();
                    }, sb, os, theme_strong, theme_back, "", Color.Transparent);
                    if (stringControl != null)
                    {
                        searchName           = stringControl;
                        elapsedTimeThisState = 0.0f;
                        state = MedicalDatabaseState.Searching;
                        totalTimeThisState = 1.6f;
                    }
                }
                else if (state == MedicalDatabaseState.Searching)
                {
                    var destinationRectangle3 = new Rectangle(rectangle.X, rectangle.Y, rectangle.Width, 24);
                    sb.Draw(Utils.white, destinationRectangle3, theme_deep);
                    destinationRectangle3.Width =
                        (int)
                        (destinationRectangle3.Width *
                         (double)Utils.QuadraticOutCurve(elapsedTimeThisState / totalTimeThisState));
                    sb.Draw(Utils.white, destinationRectangle3, theme_light);
                    destinationRectangle3.Y     += destinationRectangle3.Height / 2 - 2;
                    destinationRectangle3.Height = 4;
                    sb.Draw(Utils.white, destinationRectangle3, theme_deep);
                }
                if (
                    !Button.doButton(444402800, rectangle.X + 1, bounds.Y + bounds.Height - 28, rectangle.Width, 24,
                                     "Exit Database View", os.lockedColor))
                {
                    return;
                }
                os.display.command = "connect";
            }
        }
Ejemplo n.º 2
0
        public void DrawSendReport(Rectangle bounds, SpriteBatch sb)
        {
            var rectangle = new Rectangle(bounds.X + 2, bounds.Y + 12, (int)(bounds.Width / 1.6) - 4, bounds.Height / 2);

            rectangle.Height = (int)(logo.Height / (double)logo.Width * rectangle.Height);
            sb.Draw(logo, rectangle, theme_deep * 0.4f);
            var num = rectangle.Width;

            rectangle.Y     += 100;
            rectangle.Height = 35;
            rectangle.Width  = (int)(num * (double)Utils.QuadraticOutCurve(Math.Min(elapsedTimeThisState * 2f, 1f)));
            DrawMessage("Send Record Copy", true, sb, rectangle, theme_deep, Color.White);
            rectangle.Y     += rectangle.Height + 2;
            rectangle.Height = 22;
            rectangle.Width  = (int)(num * (double)Utils.QuadraticOutCurve(Math.Min(elapsedTimeThisState * 1.5f, 1f)));
            DrawMessageBot("Record for " + currentRecord.Firstname + " " + currentRecord.Lastname, false, sb, rectangle,
                           theme_back, theme_light);
            rectangle.Width  = num;
            rectangle.Y     += rectangle.Height + 12;
            rectangle.Height = 35;
            rectangle.Width  = num;
            DrawMessage("Recipient Address", true, sb, rectangle, theme_deep, Color.White);
            rectangle.Y += rectangle.Height + 2;
            var upperPrompt = " ---------";

            rectangle.Height = 130;
            if (state == MedicalDatabaseState.SendReportSearch)
            {
                emailRecipientAddress = GetStringUIControl.DrawGetStringControl("Recipient Address (Case Sensitive): ",
                                                                                rectangle, () =>
                {
                    elapsedTimeThisState = 0.0f;
                    state        = MedicalDatabaseState.Error;
                    errorMessage = "Error getting recipient email";
                }, () => state = MedicalDatabaseState.SendReport, sb, os, theme_strong, os.lockedColor, upperPrompt,
                                                                                new Color?());
                rectangle.Y += 26;
                if (emailRecipientAddress != null)
                {
                    state = MedicalDatabaseState.SendReportSending;
                    elapsedTimeThisState = 1f;
                }
            }
            else
            {
                GetStringUIControl.DrawGetStringControlInactive("Recpient Address: ",
                                                                emailRecipientAddress == null ? "Undefined" : emailRecipientAddress, rectangle, sb, os, upperPrompt);
            }
            rectangle.Y     += rectangle.Height + 2;
            rectangle.Height = 24;
            if (state == MedicalDatabaseState.SendReport)
            {
                if (Button.doButton(444402023, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height,
                                    "Specify Address", theme_strong))
                {
                    GetStringUIControl.StartGetString("Recipient_Address", os);
                    state = MedicalDatabaseState.SendReportSearch;
                }
            }
            else if (state == MedicalDatabaseState.SendReportSending || state == MedicalDatabaseState.SendReportComplete)
            {
                var point = (float)((elapsedTimeThisState - 1.0) / 3.0);
                if (state == MedicalDatabaseState.SendReportComplete)
                {
                    point = 1f;
                }
                if (point >= 1.0 && state != MedicalDatabaseState.SendReportComplete)
                {
                    state = MedicalDatabaseState.SendReportComplete;
                    SendReportEmail(currentRecord, emailRecipientAddress);
                }
                sb.Draw(Utils.white, rectangle, theme_back);
                var destinationRectangle = rectangle;
                destinationRectangle.Width =
                    (int)(destinationRectangle.Width * (double)Utils.QuadraticOutCurve(point));
                sb.Draw(Utils.white, destinationRectangle, theme_light);
                sb.DrawString(GuiData.smallfont,
                              state == MedicalDatabaseState.SendReportComplete ? "COMPLETE" : "SENDING ...",
                              new Vector2(rectangle.X, rectangle.Y + 2), Color.Black);
            }
            rectangle.Y += rectangle.Height + 2;
            if (state == MedicalDatabaseState.SendReportComplete &&
                Button.doButton(444402001, rectangle.X, rectangle.Y, rectangle.Width, 24, "Send to different address",
                                theme_light))
            {
                state = MedicalDatabaseState.SendReport;
            }
            rectangle.Y += rectangle.Height + 2;
            if (!Button.doButton(444402002, rectangle.X, rectangle.Y, rectangle.Width, 24, "Back to menu", theme_strong))
            {
                return;
            }
            elapsedTimeThisState = 0.0f;
            state = MedicalDatabaseState.MainMenu;
        }