Beispiel #1
0
        public AddClass(MyGlobal jumpinfo2)
        {
            this.jumpinfo = jumpinfo2;
            if (jumpinfo.user != "teacher")
            {
                MessageBox.Show("请用教师身份登录");
                this.Size = new Size(500, 0);
                return;
            }
            InitializeComponent();
            SqlConnection conn = new SqlConnection("server=" + MyGlobal.ip + ";database=dormitory;UID=sa;PWD=zyh@197068;Integrated Security=False");

            conn.Open();
            SqlCommand    sql    = new SqlCommand("select teachName from teacher", conn);
            SqlDataReader reader = sql.ExecuteReader();
            DataTable     dt     = new DataTable();

            while (reader.Read())
            {
                this.teacher.Items.Add(reader[0].ToString());
            }
            teacher.SelectedIndex = 0;
            //设置id值属性和文本属性
            reader.Close();
            conn.Close();
        }
Beispiel #2
0
 private void TransferProgressBoxForm_Load(object sender, EventArgs e)
 {
     detailsListView.Visible = false;
     this.Size   = new Size(513, 161);
     label2.Text = $"Copying {TotalNumberOfItems} items from {MyGlobal.ipToNickName(senderIP)}[{senderIP}] to {MyGlobal.ipToNickName(receiverIP)}[{receiverIP}]";
     detailsListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
 }
Beispiel #3
0
        // Valida os controles do tab alterar email.
        public bool ValidaControles_TabAlterEmail()
        {
            if (txtNovoEmail.Text.Trim() == "" || !MyGlobal.ValidarEmail(txtNovoEmail.Text))
            {
                MessageBox.Show("Por favor digite um Email válido!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            else if (txtSenhaUsuario_tabAlterEmail.Text.Trim() == "")
            {
                MessageBox.Show("Por favor digite sua senha para válidar a alteração!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            else if (_UsLogado.Selecionar(txtNovoEmail.Text) != null)
            {
                MessageBox.Show("Esse email já está cadastrado no sistema!", "Email inválido", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            else
            {
                return(true);
            }
        }
 private void Adapter_OnItemClick(object sender, ArticalOverviewOffline item)
 {
     MyLog.Log(this, $"Adapter OnItemClick - websiteKey : {item.WebsiteKey} \t url : {item.LinkOfActualArtical}");
     MyLog.Log(this, $"starting artical offline activity url {item.LinkOfActualArtical}...");
     MyGlobal.StartActivityArtical(this.Context, item, item.WebsiteKey, true);
     MyLog.Log(this, $"starting artical offline activity url {item.LinkOfActualArtical}...Done");
 }
    /// <summary>
    ///
    /// </summary>
    /// <param name="right">Will shoot left if false</param>
    public bool TryShoot(bool right)
    {
        if (!CanShoot())
        {
            return(false);
        }
        float bulletStartY = transform.position.y + 0.35f;
        float bulletStartX = transform.position.x;
        float xOffset      = 0.6f;

        if (!right)
        {
            xOffset *= -1;
        }
        bulletStartX += xOffset;
        Vector3 bulletPos = new Vector3(bulletStartX, bulletStartY, transform.position.z);

        Vector3 direction = new Vector3(-1, 0, 0);

        if (right)
        {
            direction = new Vector3(1, 0, 0);
        }
        GameObject newBullet = Instantiate(bulletPrefab, bulletPos, Quaternion.identity);

        newBullet.GetComponent <BulletMove>().direction = direction;
        newBullet.transform.parent = GameObject.Find("Entities").transform;

        MyGlobal.PlayGlobalSound(shootNoise);

        offCooldown = false;
        Invoke("endCooldown", cooldownTime);
        return(true);
    }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            MyLog.Log(this, $"OnCreate...");

            SetContentView(Resource.Layout.Main);

            if (Intent.Extras != null && Intent.Extras.ContainsKey(PassWebsiteKey))
            {
                currentWebsiteKey = Intent.Extras.GetString(PassWebsiteKey);
            }
            else
            {
                Finish(); return;
            }

            var website = Config.GetWebsite(currentWebsiteKey);

            MyGlobal.ChangeStatusBarColor(Window, website.Color);
            toolBar       = FindViewById <SupportToolBar>(Resource.Id.mainToolbar);
            toolBar.Title = website.Name;
            toolBar.SetBackgroundColor(Android.Graphics.Color.ParseColor(website.Color));

            tabs = FindViewById <TabLayout>(Resource.Id.mainTabs);
            tabs.SetBackgroundColor(Android.Graphics.Color.ParseColor(website.Color));

            ViewPager viewPager = FindViewById <ViewPager>(Resource.Id.mainViewpager);

            SetUpViewPager(viewPager);

            tabs.SetupWithViewPager(viewPager);

            MyLog.Log(this, $"OnCreate...Done");
        }
Beispiel #7
0
        // Valida os controles do tab alterar login.
        public bool ValidaControles_TabAlterNick()
        {
            if (txtNovoNomeLogin.Text.Trim() == "" || !MyGlobal.ValidarNick(txtNovoNomeLogin.Text))
            {
                MessageBox.Show("Por favor digite um nome de login válido!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            else if (txtSenhaUsuario_tabAlterLogin.Text.Trim() == "")
            {
                MessageBox.Show("Por favor digite sua senha para válidar a alteração!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            else if (_UsLogado.getNick(txtNovoNomeLogin.Text) != null)
            {
                MessageBox.Show("Esse nome login já está cadastrado no sistema!", "login inválido", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            else
            {
                return(true);
            }
        }
 private void Adapter_OnItemClick(object sender, string websiteKey)
 {
     MyLog.Log(this, "Adapter OnItemClick - websiteKey : " + websiteKey);
     MyLog.Log(this, $"starting overview activity - websiteKey :  {websiteKey}...");
     MyGlobal.StartActivityOverview(this.Activity, websiteKey);
     MyLog.Log(this, $"starting overview activity - websiteKey :  {websiteKey}...Done");
 }
Beispiel #9
0
        private void btnCadastraUsuario_Click(object sender, EventArgs e)
        {
            try
            {
                if (validaControle())
                {
                    Usuario oUsuario = new Usuario();

                    oUsuario.NomeUsuario  = txtNomeUsuario.Text;
                    oUsuario.NomeLogin    = txtNomeLogin.Text;
                    oUsuario.EmailUsuario = txtEmailUsuario.Text;
                    oUsuario.SenhaUsuario = Criptografia.gerarHashMd5(txtSenhaUsuario.Text);
                    oUsuario.UsuarioAtivo = false;
                    _Control.Incluir(oUsuario);
                    LimpaControles();
                }
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException ex)
            {
                MessageBox.Show("Impossivel cadastrar! " + MyGlobal.MsgErro(ex), "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Cadastro Inválido!" + MyGlobal.MsgErro(ex), "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    private string getDisplayMessage()
    {
        if (currentScript == null || (currentScript.getNumLines() <= currentMessage))
        {
            return("");
        }
        string transStart  = "<color=#ffffff00>";
        string transEnd    = "</color>";
        string baseMessage = currentScript.getLines(currentMessage);
        int    numLetters  = Math.Min((int)textTimer, baseMessage.Length);

        if (numLetters > prevNumLetters)
        {
            if (true || altSound)
            {
                MyGlobal.PlayGlobalSound(TextBoop, 0.5f);
                altSound = false;
            }
            else
            {
                altSound = true;
            }
        }
        prevNumLetters = numLetters;
        return(baseMessage.Substring(0, numLetters) + transStart + baseMessage.Substring(numLetters, baseMessage.Length - (numLetters)) + transEnd);
    }
Beispiel #11
0
        public bool validaControle()
        {
            // guarda o valor do usuario e o email se não existe guarda null.
            var email = _Control.getEmail(txtEmailUsuario.Text);

            // verifica se os campos estão vazio se estiver retorna false.

            if (txtEmailUsuario.Text.Trim() == "")
            {
                MessageBox.Show("Por favor preencha o Email!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            else if (MyGlobal.ValidarEmail(txtEmailUsuario.Text) == false)
            {
                MessageBox.Show("Email inválido", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            else
            {
                // Validação de Email, se existe no banco retorna boolean = true ou false.

                if (email == null)
                {
                    MessageBox.Show("Email inválido", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtEmailUsuario.Focus();
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }
 private void PlaySound(GameObject other)
 {
     if (OtherHasCorrectTag(other))
     {
         MyGlobal.PlayGlobalSound(audioClip);
     }
 }
 private void AddBingo(GameObject other)
 {
     if (OtherHasCorrectTag(other))
     {
         MyGlobal.GetGameControllerObject().GetComponent <GameController>().AddBingoCard();
     }
 }
Beispiel #14
0
 public buildingManagerFrm2(MyGlobal jumpinfo2)
 {
     jumpinfo = jumpinfo2;
     InitializeComponent();
     LoadDormName();
     LoadDormInfo();
 }
Beispiel #15
0
 private void btnSalvar_Click(object sender, EventArgs e)
 {
     try
     {
         if (validaControle())
         {
             oUsuario.NomeUsuario    = txtNome.Text;
             oUsuario.DataNascimento = dtDataNascimento.Text;
             oUsuario.Formacao       = (int)cboFormacao.SelectedValue;
             oUsuario.Estado         = (int)cboEstado.SelectedValue;
             oUsuario.Cidade         = (int)cboCidade.SelectedValue;
             oUsuario.Bairro         = txtBairro.Text;
             oUsuario.ImgUsuario     = MyGlobal.imageToByteArray(imgPerfilUsuario.BackgroundImage);
             _UsLogado.Alterar(oUsuario);
             habilitaControles(false);
             carregaDados();
             MessageBox.Show("Seu dados foram alterados.", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             habilitaControles(false);
             carregaDados();
         }
     }
     catch (System.Data.Entity.Validation.DbEntityValidationException ex)
     {
         MessageBox.Show("Alteração Inválida!" + MyGlobal.MsgErro(ex), "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Alteração Inválido!" + MyGlobal.MsgErro(ex), "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
         carregaDados();
         habilitaControles(false);
     }
 }
    void OnGUI()
    {
        Vector3  screenPos = MyGlobal.WorldToScreen(transform.position);
        GUIStyle s         = new GUIStyle();

        s.normal.textColor = new Color(1.0f, 0.0f, 0.0f);
        //GUI.Label(new Rect(screenPos.x, Screen.height - screenPos.y, 100, 100), timeToSpawn.ToString() ,s);
    }
Beispiel #17
0
 // seta valores nos controles.
 public void carregaDados()
 {
     lblNickUsuario.Text = oUsuario.NomeLogin;
     if (oUsuario.ImgUsuario != null)
     {
         imgPerfilUsuario.BackgroundImage = MyGlobal.byteArrayToImage(oUsuario.ImgUsuario);
     }
 }
        private void SwipeRefreshLayout_Refresh(object sender, EventArgs e)
        {
            MyLog.Log(this, "Refreshing...");
            swipeRefreshLayout.Refreshing = true;

            MyLog.Log(this, "requesting db for GetAllOfflineArticalList as refreshing...");
            MyGlobal.database.GetAllOfflineArticalList(MyGlobal.UidGenerator(), this);
            MyLog.Log(this, "requesting db for GetAllOfflineArticalList as refreshing...Done");
        }
Beispiel #19
0
 private void onCheckPointTouch(GameObject other)
 {
     if (!isActive && other.tag.Equals("Player"))
     {
         isActive = true;
         //SceneManager.LoadScene("Scene2");
         GetComponent <SpriteRenderer>().sprite = touchedFlag;
         GameController.respawnPosition         = transform.position;
         MyGlobal.PlayGlobalSound(checkpointNoise);
     }
 }
    private void Shoot()
    {
        Vector3    direction       = new Vector3(xMoveDir, 0, 0);
        Vector3    bulletSourcePos = transform.position;
        GameObject newBullet       = MyGlobal.AddEntityToScene(bulletPrefab, bulletSourcePos);

        newBullet.GetComponent <BulletMove>().direction = direction;

        MyGlobal.PlayGlobalSoundIfOnScreen(shootNoise, 1.0f, gameObject);
        Invoke("Shoot", 3.0f);
    }
Beispiel #21
0
        private void carregaDados()
        {
            txtNome.Text = oUsuario.NomeUsuario;

            if (oUsuario.DataNascimento != null)
            {
                dtDataNascimento.Text = oUsuario.DataNascimento;
            }
            else
            {
                dtDataNascimento.Text = null;
            }

            if (oUsuario.Cidade != null)
            {
                cboCidade.SelectedValue = oUsuario.Cidade;
            }
            else
            {
                cboCidade.SelectedValue = "";
            }

            if (oUsuario.Estado != null)
            {
                cboEstado.SelectedValue = oUsuario.Estado;
            }
            else
            {
                cboEstado.SelectedValue = "";
            }

            if (oUsuario.Bairro != null)
            {
                txtBairro.Text = oUsuario.Bairro;
            }
            else
            {
                txtBairro.Text = "";
            }

            if (oUsuario.Formacao != null)
            {
                cboFormacao.SelectedValue = oUsuario.Formacao;
            }
            else
            {
                cboFormacao.SelectedValue = "";
            }

            if (oUsuario.ImgUsuario != null)
            {
                imgPerfilUsuario.BackgroundImage = MyGlobal.byteArrayToImage(oUsuario.ImgUsuario);
            }
        }
Beispiel #22
0
 private void txtEmailUsuario_Leave(object sender, EventArgs e)
 {
     if (MyGlobal.ValidarEmail(txtEmailUsuario.Text) == false && txtEmailUsuario.Text != "")
     {
         LblInfEmailUsuario.Text    = "Digite um Email válido!";
         LblInfEmailUsuario.Visible = true;
     }
     else
     {
         LblInfEmailUsuario.Visible = false;
     }
 }
Beispiel #23
0
 public AddStudent(MyGlobal jumpinfo2)
 {
     this.jumpinfo = jumpinfo2;
     if (jumpinfo.user != "teacher")
     {
         MessageBox.Show("请用教师身份登录");
         this.Size = new Size(500, 0);
         return;
     }
     InitializeComponent();
     initinfo();
 }
Beispiel #24
0
 private void txtNomeLogin_Leave(object sender, EventArgs e)
 {
     if (MyGlobal.ValidarNick(txtNomeLogin.Text) == false && txtNomeLogin.Text != "")
     {
         lblInfNomeLogin.Text    = "Nome Usuário inválido! Por favor segue padrão (a-z, A-Z, 0-9 e ., -, _).";
         lblInfNomeLogin.Visible = true;
     }
     else
     {
         lblInfNomeLogin.Visible = false;
     }
 }
Beispiel #25
0
 private void txtNomeUsuario_Leave(object sender, EventArgs e)
 {
     if (MyGlobal.ValidarNome(txtNomeUsuario.Text) == false && txtNomeUsuario.Text != "")
     {
         lblInfNomeUsuario.Text    = "Nome inválido por favor apenas Letras!";
         lblInfNomeUsuario.Visible = true;
     }
     else
     {
         lblInfNomeUsuario.Visible = false;
     }
 }
Beispiel #26
0
 private void txtEmailUsuario_Leave(object sender, EventArgs e)
 {   // Verificando o Email se estár no formato correto.
     if (MyGlobal.ValidarEmail(txtEmailUsuario.Text) == false && txtEmailUsuario.Text != "")
     {
         LblInfEmailUsuario.Text    = "Digite um Email válido!";
         LblInfEmailUsuario.Visible = true;
     }
     else
     {
         LblInfEmailUsuario.Visible = false;
     }
 }
    void FixedUpdate()
    {
        Transform transform = GetComponent <Transform>();
        bool      hitTile = false, hitTileY = false;
        Vector2   velocity = (new Vector2(direction.x, direction.y)) * bulletSpeed;

        transform.position = MyGlobal.GetValidPosition(transform.position, m_BoxCollider, velocity, ref hitTile, ref hitTileY);
        if (hitTile || hitTileY)
        {
            Destroy(this.gameObject);
        }
    }
Beispiel #28
0
        private Task HandleExceptionAsync(HttpContext context, Exception exception)
        {
            context.Response.ContentType = "application/json";
            context.Response.StatusCode  = (int)HttpStatusCode.InternalServerError;

            return(context.Response.WriteAsync(
                       new MyEntityResponse <ErrorViewModel>()
            {
                StatusCode = context.Response.StatusCode,
                Message = MyGlobal.RecursiveExecptionMsg(exception)
            }.ToString()));
        }
Beispiel #29
0
 public buildingManagerFrm2(MyGlobal jumpinfo2)
 {
     this.jumpinfo = jumpinfo2;
     if (this.jumpinfo.user == "student")
     {
         MessageBox.Show("请用教师身份登录");
         this.Size = new Size(500, 0);
         return;
     }
     InitializeComponent();
     LoadDormName();
     LoadDormInfo();
 }
Beispiel #30
0
 public ChangeTeachInfo(MyGlobal jumpinfo2)
 {
     this.jumpinfo = jumpinfo2;
     if (this.jumpinfo.user == "student")
     {
         MessageBox.Show("请用教师身份登录");
         this.Size = new Size(500, 0);
         return;
     }
     this.teachid = jumpinfo.teachId;
     InitializeComponent();
     Initdisp();
 }
Beispiel #31
0
    /*
     root --> 1 --> 2 --> 3
          --> 4
          --> 5 --> 6

     root --> 1 --> 2 -|-> 3
          --> 4
          -|-> 5 --> 6
     */
    static void Main(string[] args)
    {
        var global = new MyGlobal();

        var obj1 = global.Spawn("obj1");
        var obj2 = obj1.Spawn("obj2");
        var obj3 = obj2.Spawn("obj3");
        var obj4 = global.Spawn("obj4");
        var obj5 = global.Spawn("obj5");
        var obj6 = obj5.Spawn("obj6");

        obj3.Suicide();
        obj5.Suicide();

        global.GC();
    }