예제 #1
0
파일: Program.cs 프로젝트: ksyme99/mgcstb
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     tabs = new FormTabs();
     Application.Run(tabs);
 }
예제 #2
0
        public static void returnToMain(FormTabs form)
        {
            if (form.TabOverall.SelectedTab == form.TabJoinConf)
            {
                form.LstJoinBuddy.Items.Clear();
                form.LstJoinFav.Items.Clear();
                form.AvatarList.Images.Clear();
                form.AvatarList.Images.Add(System.Drawing.Image.FromFile("Images//locked.jpg"));
                form.FirstJoinFav = true;
                GUI_Forms.FormTabs.removeJoinBackButton(Program.tabs);
                form.TabOverall.SelectedTab = form.TabMainMenu;
                form.ActiveControl = form.BtnMainJoinConf;
            }
            else if (form.TabOverall.SelectedTab == form.TabSettings)
            {
                form.TabOverall.SelectedTab = form.TabMainMenu;
                form.ActiveControl = form.BtnMainJoinConf;
            }
            else if (form.TabOverall.SelectedTab == form.TabCamera)
            {
                Program.multiLateration.closePort();
                Program.servoPort.closePort();
                form.webcam.Stop();
                form.TabOverall.SelectedTab = form.TabMainMenu;
                form.ActiveControl = form.BtnMainJoinConf;
            }
            /* not used, kept in case wanted
            else if (this.TabOverall.SelectedTab == TabResSet)
            {
                this.TabOverall.SelectedTab = this.TabSettings;
                this.ActiveControl = BtnSettingsCamera;
                if (initialSetup == true)
                {
                    // create a writer and open the file
                    TextWriter tw = new StreamWriter("C:\\VS MGC STB\\mgcstb\\GUI_Forms\\firstSetup.txt");

                    // write a line of text to the file
                    tw.WriteLine("Initialised = true");

                    // close the stream
                    tw.Close();
                }
            }*/
            else if (form.TabOverall.SelectedTab == form.TabCreate)
            {
                Program.servoPort.closePort();
                Program.multiLateration.closePort();
                form.TabOverall.SelectedTab = form.TabMainMenu;
                form.ActiveControl = form.BtnMainJoinConf;
            }
            else if (form.TabOverall.SelectedTab == form.TabCreatePrivate)
            {
                form.LstCreatePrivateInvite.Items.Clear();
                form.AvatarList.Images.Clear();
                form.AvatarList.Images.Add(System.Drawing.Image.FromFile("Locked.jpg"));
                form.TabOverall.SelectedTab = form.TabMainMenu;
                form.ActiveControl = form.BtnMainJoinConf;
            }
        }
예제 #3
0
        public static void InitResolution(FormTabs form)
        {
            // Check Resolution
            Int32[] Res = new Int32[2];
            int numModes = resolutionSettingsHelper.NumEnumModes(0);
            string[] modes = new String[numModes];
            modes = resolutionSettingsHelper.EnumModes(0);
            Int32[] GoodRes = new Int32[modes.Length];
            Int32 j = 0;
            Boolean Hz60 = false;

            for (int i = 0; i < numModes; i++)
            {
                if (modes[i] != null)
                {
                    Res = findResModeXXbitYYHz(modes[i], 32, 60);
                    if (Res[0] != 0 && Res[1] != 0)
                    {
                        GoodRes[j] = i;
                        j++;
                        Hz60 = true;
                    }
                }
            }

            if (Hz60 == false) // probably a SCART TV
            {
                for (int i = 0; i < numModes; i++)
                {
                    if (modes[i] != null)
                    {
                        Res = findResModeXXbitYYHz(modes[i], 32, 25);
                        if (Res[0] != 0 && Res[1] != 0)
                        {
                            GoodRes[j] = i;
                            j++;
                        }
                    }
                }
            }


            for (Int32 s = j; s < GoodRes.Length; s++)
            {
                if (GoodRes[s] == 0)
                    GoodRes[s] = -1;
            }

            Int32 modeToUse = 0;
            for (Int32 k = 0; k < GoodRes.Length; k++)
            {
                if (GoodRes[k] != -1)
                    modeToUse = GoodRes[k];
            }
            Console.WriteLine("Mode to use: " + modeToUse);

            if (Hz60)
            {
                Data.constants.WIDTH = findResModeXXbitYYHz(modes[modeToUse], 32, 60)[0];
                Data.constants.HEIGHT = findResModeXXbitYYHz(modes[modeToUse], 32, 60)[1];
            }
            else
            {
                Data.constants.WIDTH = findResModeXXbitYYHz(modes[modeToUse], 32, 25)[0];
                Data.constants.HEIGHT = findResModeXXbitYYHz(modes[modeToUse], 32, 25)[1];
            }
            Double AR = (Double)Data.constants.WIDTH / (Double)Data.constants.HEIGHT;
            if (AR > 1.35)
            {
                Data.constants.isWidescreen = true;
            }
            else
            {
                Data.constants.isWidescreen = false;
            }

            Data.constants.resMode = modeToUse;

            if (Data.constants.HEIGHT < 1024)
            {
                Data.constants.Font = "Small";
            }
            else if (Data.constants.HEIGHT >= 1024 && Data.constants.HEIGHT < 1200)
            {
                Data.constants.Font = "Medium";
            }
            else if (Data.constants.HEIGHT >= 1200)
            {
                Data.constants.Font = "Large";
            }
            changeResolution(form);
        }
예제 #4
0
 private static void removeJoinBackButton(FormTabs form)
 {
     foreach (Control backButton in form.TblJoin.Controls)
     { 
         if(backButton.Text == "Back")
         {
             form.TblJoin.Controls.Remove(backButton);
             backButton.Dispose();
         }
     }
 }
예제 #5
0
        // Set All Control Font Sizes
        private static void setFontSizes(float TitleSize, float PrimarySize, float SecondarySize, FormTabs form)
        {
            string fontName = "Impact";
            FontStyle fontStyle = FontStyle.Bold;

            // Title Fonts            
            form.LblSplash.Font = new Font(fontName, TitleSize, fontStyle);
            form.LblJoinTitle.Font = new Font(fontName, TitleSize, fontStyle);
            form.LblCameraTitle.Font = new Font(fontName, TitleSize, fontStyle);
            form.LblResSet.Font = new Font(fontName, TitleSize, fontStyle);
            form.LblSettings.Font = new Font(fontName, TitleSize, fontStyle);
            
            // Primary Fonts
            form.BtnMainJoinConf.Font = new Font(fontName, PrimarySize, fontStyle);
            form.BtnMainCreate.Font = new Font(fontName, PrimarySize, fontStyle);
            form.BtnMainSettings.Font = new Font(fontName, PrimarySize, fontStyle);
            form.BtnCreatePub.Font = new Font(fontName, PrimarySize, fontStyle);
            form.BtnCreatePriv.Font = new Font(fontName, PrimarySize, fontStyle);
            form.BtnResSetSCARTTV.Font = new Font(fontName, PrimarySize, fontStyle);
            form.BtnResSetMONITOR.Font = new Font(fontName, PrimarySize, fontStyle);
            form.BtnResSetLCDTV.Font = new Font(fontName, PrimarySize, fontStyle);
            form.BtnSettingsChangeRes.Font = new Font(fontName, PrimarySize, fontStyle);
            form.LblSettingsFontSize.Font = new Font(fontName, PrimarySize, fontStyle);
            form.BtnSettingsCamera.Font = new Font(fontName, PrimarySize, fontStyle);

                        
            // Secondary Fonts
            form.BtnMainExit.Font = new Font(fontName, SecondarySize, fontStyle);
            form.LblCameraPositioning.Font = new Font(fontName, SecondarySize, fontStyle);
            form.BtnCreateExit.Font = new Font(fontName, SecondarySize, fontStyle);
            form.BtnCameraExit.Font = new Font(fontName, SecondarySize, fontStyle);
            form.BtnResSetFont.Font = new Font(fontName, SecondarySize, fontStyle);
            form.BtnResSetMain.Font = new Font(fontName, SecondarySize, fontStyle);
            form.BtnInConfLeave.Font = new Font(fontName, SecondarySize, fontStyle);
            form.LblInConfConfInfo.Font = new Font(fontName, SecondarySize, fontStyle);
            form.BtnCreatePrivCont.Font = new Font(fontName, SecondarySize, fontStyle);
            form.BtnSettingsBack.Font = new Font(fontName, SecondarySize, fontStyle);
            form.LblJoinStatus.Font = new Font(fontName, SecondarySize, fontStyle);
            form.LblCreatePriv.Font = new Font(fontName, SecondarySize, fontStyle);
            form.LblCreatePublic.Font = new Font(fontName, SecondarySize, fontStyle);            
        }
예제 #6
0
 private static void resizeScreen(int Width, int Height, FormTabs form)
 {
     form.Location = new Point(0, 0);
     form.Size = new Size(Width, Height);
     form.TabOverall.Size = new Size(Width + 10, Height + 10);
     form.TabOverall.Location = new Point(-5, -5);
 }        
예제 #7
0
 private static void changeResolution(FormTabs form)
 {
     resolutionSettingsHelper.setRes(0, Data.constants.resMode);
     resizeScreen(Data.constants.WIDTH, Data.constants.HEIGHT, form);
     if (Data.constants.Font == "Small") 
     {
         setFontSizes(Data.constants.FontSmall[0], Data.constants.FontSmall[1], Data.constants.FontSmall[2], form);
     }
     else if (Data.constants.Font == "Medium")
     {
         setFontSizes(Data.constants.FontMed[0], Data.constants.FontMed[1], Data.constants.FontMed[2], form);
     }
     else if (Data.constants.Font == "Large")
     {
         setFontSizes(Data.constants.FontLarge[0], Data.constants.FontLarge[1], Data.constants.FontLarge[2], form);
     }
     
     Cursor.Position = new Point(Data.constants.WIDTH, (Int32)(0.8 * (Double)Data.constants.HEIGHT));
 }