Exemple #1
0
        //登录按钮点击事件
        private void login_btn_Click(object sender, EventArgs e)
        {
            if (username_txb.Text != "" && password_txb.Text != "")
            {
                //查询数据库admin表
                cmd             = new MySqlCommand();
                cmd.CommandText = string.Format("select count(*) from admin where binary username= '******' and binary password= '******' ");

                conn           = Program.ConDataBase();
                cmd.Connection = conn;

                //判断用户名和密码是否正确
                if (Convert.ToInt32(cmd.ExecuteScalar()) == 0)
                {
                    MessageBox.Show(LoadForm.TextList[5]);
                }
                else
                {
                    MessageBox.Show(LoadForm.TextList[6]);

                    cmd.Dispose();
                    conn.Close();

                    MainSurface mainSurface = new MainSurface();
                    mainSurface.Show();
                    this.Visible = false;
                }
            }
            else
            {
                MessageBox.Show(LoadForm.TextList[7]);
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (MainSurface != null)
            {
                MainSurface.Dispose();
                MainSurface = null;
            }

            if (OverviewSurface != null)
            {
                OverviewSurface.Dispose();
                OverviewSurface = null;
            }
        }
Exemple #3
0
        /// <summary>
        /// Lorsqu'un bouton souris est relâché
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainSurface_MouseUp(object sender, MouseEventArgs e)
        {
            if (_MouseDown)
            {
                //Mode de dessin
                if (EditorHelper.Instance.CurrentStageState >= Enums.StagePanelState.HotSpots && EditorHelper.Instance.CurrentDrawingTool != Enums.DrawingTools.Pointer)
                {
                    if (e.Button == System.Windows.Forms.MouseButtons.Right)
                    {
                        //On "fixe" le vecteur courant
                        UpdateAreaLocation(EditorHelper.Instance.SelectedHotSpot);

                        EditorHelper.Instance.SelectedHotSpot      = null;
                        EditorHelper.Instance.SelectedHotSpotPoint = -1;
                        if (EditorHelper.Instance.HotSpotEditionMode)
                        {
                            this.HotSpotEditionCompleted(this, new EventArgs());
                        }
                        EditorHelper.Instance.HotSpotEditionMode = false;
                        MainSurface.Refresh();
                        _MouseDown = false;
                    }
                    //Mode édition
                    if (EditorHelper.Instance.HotSpotEditionMode)
                    {
                        _MouseDown = false;
                    }
                    //Mode création
                    else if (EditorHelper.Instance.SelectedHotSpot != null)
                    {
                        Point mousePosition = _Service.GetDragStageCoords(this.PointToClient(Cursor.Position));
                        _Service.CreateNewPointToTheCurrentSelectedHotSpot(mousePosition, EditorHelper.Instance.SelectedHotSpot.Points.Length);
                        MainSurface.Refresh();
                    }
                }
                else
                {
                    if (_MouseMove)
                    {
                        RefreshStage();
                    }
                    _MouseDown = false;
                    _MouseMove = false;
                    ReloadItemChosen();
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// Lorsque la souris se déplace
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainSurface_MouseMove(object sender, MouseEventArgs e)
        {
            //Status Bar
            this.MouseChangePosition(_Service.GetDragStageCoords(new Point(e.X, e.Y)), new EventArgs());

            #region Dessins pour add ou suppression de vecteurs
            if (EditorHelper.Instance.CurrentStageState >= Enums.StagePanelState.HotSpots && EditorHelper.Instance.CurrentDrawingTool != Enums.DrawingTools.Pointer)
            {
                //Mode édition
                if (EditorHelper.Instance.HotSpotEditionMode)
                {
                    Point mousePosition = _Service.GetDragStageCoords(this.PointToClient(Cursor.Position));
                    if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
                    {
                        if (_Service.IsOnTheSelectedPolygon(mousePosition, false))
                        {
                            ChangeCursor(AddVectorCursor);
                        }
                        else
                        {
                            ChangeCursor(DrawingCursor);
                        }
                    }
                    else if ((Control.ModifierKeys & Keys.Alt) == Keys.Alt)
                    {
                        if (_Service.GetVectorPoint(mousePosition) != -1)
                        {
                            ChangeCursor(RemoveVectorCursor);
                        }
                        else
                        {
                            ChangeCursor(DrawingCursor);
                        }
                    }
                    else
                    {
                        ChangeCursor(DrawingCursor);
                    }
                }
            }
            #endregion

            #region Drap & Drop
            if (_MouseDown)
            {
                //Modes dessin
                if (EditorHelper.Instance.CurrentStageState >= Enums.StagePanelState.HotSpots && EditorHelper.Instance.CurrentDrawingTool != Enums.DrawingTools.Pointer)
                {
                    //Mode édition
                    if (EditorHelper.Instance.HotSpotEditionMode && EditorHelper.Instance.SelectedHotSpotPoint > -1)
                    {
                        //Mode mouvement édition
                        Point mousePosition = _Service.GetDragStageCoords(this.PointToClient(Cursor.Position));
                        _Service.MoveVectorPoint(mousePosition, EditorHelper.Instance.SelectedHotSpotPoint);
                        MainSurface.Refresh();
                    }
                    else if (EditorHelper.Instance.SelectedHotSpot != null)
                    {
                        MainSurface.Refresh();
                    }
                }
                //Modes image
                else
                {
                    _Service.MoveObjectDragDrop(e.Location);
                    _MouseMove = true;
                    RefreshSelection();
                }
            }
            #endregion
        }
Exemple #5
0
        /// <summary>
        /// Lorsqu'un bouton souris est pressé
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainSurface_MouseDown(object sender, MouseEventArgs e)
        {
            //Mode de dessin
            if (EditorHelper.Instance.CurrentStageState >= Enums.StagePanelState.HotSpots && EditorHelper.Instance.CurrentDrawingTool != Enums.DrawingTools.Pointer)
            {
                Point mousePosition = _Service.GetDragStageCoords(this.PointToClient(Cursor.Position));
                //Mode édition
                if (EditorHelper.Instance.SelectedHotSpot != null && EditorHelper.Instance.HotSpotEditionMode)
                {
                    if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
                    {
                        if (!_Service.IsOnTheSelectedPolygon(mousePosition, true))
                        {
                            _Service.CreateNewPointToTheCurrentSelectedHotSpot(mousePosition, EditorHelper.Instance.SelectedHotSpot.Points.Length);
                        }
                        MainSurface.Refresh();
                    }
                    else if ((Control.ModifierKeys & Keys.Alt) == Keys.Alt)
                    {
                        if (_Service.RemovePointOfTheCurrentSelectedHotSpot(mousePosition))
                        {
                            MainSurface.Refresh();
                        }
                    }
                    else
                    {
                        EditorHelper.Instance.SelectedHotSpotPoint = _Service.GetVectorPoint(mousePosition);
                        _MouseDown = true;
                    }
                }
                //Mode création
                else if (EditorHelper.Instance.SelectedHotSpot == null)
                {
                    DeselectStageObjects();
                    switch (EditorHelper.Instance.CurrentStageState)
                    {
                    case Enums.StagePanelState.HotSpots:
                        EditorHelper.Instance.SelectedHotSpot = _Service.CreateHotSpot(mousePosition);
                        break;

                    case Enums.StagePanelState.WalkableAreas:
                        EditorHelper.Instance.SelectedHotSpot = _Service.CreateWalkableArea(mousePosition);
                        break;

                    case Enums.StagePanelState.Regions:
                        EditorHelper.Instance.SelectedHotSpot = _Service.CreateRegion(mousePosition);
                        break;
                    }
                    if (EditorHelper.Instance.SelectedHotSpot != null)
                    {
                        _MouseDown = true;
                        EditorHelper.Instance.SelectedHotSpotPoint = 0;
                        MainSurface.Refresh();
                    }
                }
                else
                {
                    _MouseDown = true;
                }
            }

            //Mode sélection d'objets
            if (EditorHelper.Instance.SelectedObjects.Count > 0)
            {
                Point mousePosition = _Service.GetDragStageCoords(this.PointToClient(Cursor.Position));
                foreach (VO_StageObject vObject in EditorHelper.Instance.SelectedObjects)
                {
                    Rectangle rect = new Rectangle(vObject.Location, vObject.Size);
                    if (rect.IntersectsWith(new Rectangle(mousePosition, new Size(1, 1))))
                    {
                        _MouseDown = true;
                        _Service.StartObjectDrag(e.Location);
                        return;
                    }
                }
            }
        }
Exemple #6
0
 /// <summary>
 /// Rafraichi la sélection
 /// </summary>
 public void RefreshSelection()
 {
     MainSurface.Refresh();
 }
Exemple #7
0
 /// <summary>
 /// Déselectionne les objets
 /// </summary>
 public void DeselectStageObjects()
 {
     EditorHelper.Instance.SelectedObjects = new List <VO_StageObject>();
     MainSurface.Refresh();
 }