Ejemplo n.º 1
0
        //-------------------------------------------------
        #region MainForm Region

        //-------------------------------------------------
        #region Initialize Region
        /// <summary>
        /// MainForm Initialize Component.
        /// </summary>
        private void MF_InitializeComponents()
        {
            try
            {
                // HttpListener _listener = new HttpListener();
                TcpClient     _tcp = new TcpClient();
                NetworkStream _stream;
                _tcp.Connect("localhost", 1228);
                _stream = _tcp.GetStream();
                byte[] _b      = new byte[512];
                var    _result = _stream.Read(_b);
                var    _str    = System.Text.Encoding.UTF8.GetString(_b).TrimEnd();
                Console.WriteLine("got something! :" + _str + " - " + _str.Length + " - " + _b.Length);
            }
            catch
            {
            }

#if BUTTON_TEST_1
            //---------------------------------------------
            //news:
            this.MyRes            = new WotoRes(typeof(GameClient));
            this.FirstFlatElement = new FlatElement(this, ElementMovements.HorizontalMovements);
            ButtonElement test = new ButtonElement(this);
            FlatElement   _f1  = new FlatElement(this, ElementMovements.VerticalHorizontalMovements);
            FlatElement   _f2  = new FlatElement(this, ElementMovements.HorizontalMovements);
            this.LoadMFBackGround();
            //---------------------------------------------
            //names:
            this.FirstFlatElement.SetLabelName(FirstLabelNameInRes);

            //fontAndTextAligns:
            this.FirstFlatElement.ChangeFont(this.FontManager.GetSprite(SAO_SFonts.sao_tt_regular, 19));
            test.ChangeFont(this.FontManager.GetSprite(SAO_SFonts.sao_tt_regular, 19));
            _f1.ChangeFont(this.FontManager.GetSprite(SAO_SFonts.sao_tt_regular, 19));
            _f2.ChangeFont(this.FontManager.GetSprite(SAO_SFonts.sao_tt_regular, 19));

            this.FirstFlatElement.ChangeAlignmation(StringAlignmation.MiddleCenter);
            test.ChangeAlignmation(StringAlignmation.MiddleCenter);
            _f1.ChangeAlignmation(StringAlignmation.MiddleCenter);
            _f2.ChangeAlignmation(StringAlignmation.MiddleCenter);
            //priorities:
            this.FirstFlatElement.ChangePriority(ElementPriority.Normal);
            _f1.ChangePriority(ElementPriority.Normal);
            _f2.ChangePriority(ElementPriority.VeryHigh);
            test.ChangePriority(ElementPriority.High);
            //sizes:
            this.FirstFlatElement.ChangeSize(this.Width / 6, this.Height / 6);
            test.ChangeSize(150, 46);
            _f1.ChangeSize(200, 300);
            _f2.ChangeSize(100, 100);
            //ownering:
            _f2.SetOwner(_f1);
            //locations:
            this.FirstFlatElement.ChangeLocation((Width - FirstFlatElement.Width) -
                                                 (2 * SandBoxBase.from_the_edge),
                                                 (Height - FirstFlatElement.Height) - SandBoxBase.from_the_edge);

            test.ChangeLocation(100f, 100f);
            _f1.ChangeLocation(300f, 200f);
            _f2.ChangeLocation(10f, 10f);
            //movements:
            this.FirstFlatElement.ChangeMovements(ElementMovements.VerticalMovements);
            _f1.ChangeMovements(ElementMovements.VerticalHorizontalMovements);
            //colors:
            // this.FirstFlatElement.ChangeBackColor(SColor.Red);
            this.FirstFlatElement.ChangeForeColor(SColor.DarkSeaGreen);
            test.ChangeBorder(WotoProvider.Enums.ButtonColors.WhiteSmoke);
            _f1.ChangeBackColor(new SColor(SColor.Orange, 0.5f));
            _f2.ChangeBackColor(SColor.Blue);
            _f2.ChangeForeColor(new SColor(SColor.Red, 0.7f));
            //test.ChangeForeColor(SColor.Red);
            //enableds:
            test.EnableMouseEnterEffect();
            //texts:
            this.FirstFlatElement.SetLabelText();
            test.SetLabelText("Test");
            //_f1.SetLabelText("F1");
            _f2.SetLabelText("Flat2");
            //images:
            this.FirstFlatElement.ChangeImage();


            //applyAndShow:
            this.FirstFlatElement.Apply();
            this.FirstFlatElement.Show();
            _f2.Apply();
            _f2.Show();
            _f1.Apply();
            _f1.Show();

            test.Apply();
            test.Show();
            //events:
            this.GameUniverse.WotoPlanet.MouseDown += WotoPlanet_MouseDown;
            this.GameUniverse.WotoPlanet.MouseUp   += WotoPlanet_MouseUp;
            this.Window.TextInput += Window_TextInput;
            //---------------------------------------------
            //addRanges:
            this.ElementManager.Add(this.FirstFlatElement);
            this.ElementManager.Add(test);
            this.ElementManager.Add(_f1);
            //---------------------------------------------
#endif
            //---------------------------------------------
            //news:
            this.MyRes            = new WotoRes(typeof(GameClient));
            this.FirstFlatElement = new FlatElement(this,
                                                    ElementMovements.VerticalHorizontalMovements);
            ProfileWrongSandBox test = new();
            this.LoadMFBackGround();
            //---------------------------------------------
            //names:
            this.FirstFlatElement.SetLabelName(FirstLabelNameInRes);
            //fontAndTextAligns:
            this.FirstFlatElement.ChangeFont(this.FontManager.GetSprite(SAO_SFonts.sao_tt_regular, 19));
            this.FirstFlatElement.ChangeAlignmation(StringAlignmation.MiddleCenter);
            //priorities:
            this.FirstFlatElement.ChangePriority(ElementPriority.Normal);
            //sizes:
            this.FirstFlatElement.ChangeSize(this.Width / 6, this.Height / 6);
            //ownering:
            //locations:
            this.FirstFlatElement.ChangeLocation((Width - FirstFlatElement.Width) -
                                                 (2 * SandBoxBase.from_the_edge),
                                                 (Height - FirstFlatElement.Height) - SandBoxBase.from_the_edge);
            //movements:
            //colors:
            this.FirstFlatElement.ChangeForeColor(SColor.DarkSeaGreen);
            //enableds:
            //texts:
            this.FirstFlatElement.SetLabelText();
            //images:
            this.FirstFlatElement.ChangeImage();
            //applyAndShow:
            this.FirstFlatElement.Apply();
            this.FirstFlatElement.Show();
            test.Apply();
            test.Show();
            //events:
            this.InitializeMainEvents();
            //---------------------------------------------
            //addRanges:
            this.ElementManager.AddRange(
                this.FirstFlatElement,
                test);
            //---------------------------------------------
            //finalBlow:
            //---------------------------------------------
        }