Beispiel #1
0
 /// <summary>
 /// Ouvre la fenêtre d'administration
 /// </summary>
 /// <param name="obj"></param>
 private void OnAdministration(object obj)
 {
     WindowClosedEvent.GetInstance().Handler += OnCloseWindowAdd;
     RefreshEvent.GetInstance().Handler      += OnRefresh;
     _wAdd = new WindowAdd();
     _wAdd.ShowDialog();
 }
Beispiel #2
0
 /// <summary>
 /// Ouvre la fenêtre de personnalisation de profil
 /// </summary>
 /// <param name="obj"></param>
 private void OnPersoProfil(object obj)
 {
     RefreshEvent.GetInstance().Handler      += OnRefresh;
     WindowClosedEvent.GetInstance().Handler += OnCloseWindowPersoProfil;
     _wPersoProfil = new WindowPersoProfil();
     _wPersoProfil.ShowDialog();
 }
Beispiel #3
0
        private void Window_Closed(object sender, EventArgs e)
        {
            Guid?session;

            if (gameVM != null)
            {
                session = (Guid)gameVM.Session;
            }
            else
            {
                session = null;
            }
            WindowClosedEvent?.Invoke(this, new ChatEventArgs()
            {
                contact = _contact,
                Session = session
            });
        }
        private void OnCloseWindow(IWindowResult result)
        {
            result.Window.CloseWindowEvent   -= OnCloseWindow;
            result.Window.DestroyWindowEvent -= OnDestroyWindow;

            var index            = _openedWindows.IndexOf(result.Window);
            var overlappedWindow = index > 0 ? _openedWindows.ElementAt(index - 1) : null;

            _openedWindows.Remove(result.Window);

            if (result.Window.IsInactiveOrDeactivated())
            {
                Destroy(result.Window.Canvas.gameObject);
            }
            else
            {
                result.Window.ActivatableStateChangedEvent += OnWindowDeactivateHandler;
            }

            if (overlappedWindow != null && overlappedWindow.IsInactiveOrDeactivated())
            {
                overlappedWindow.Activate();
            }

            _isUnique = false;
            WindowClosedEvent?.Invoke(result);

            _delayedWindows.ToList().ForEach(call =>
            {
                if (_isUnique || call.IsUnique && _openedWindows.Count > 0)
                {
                    return;
                }

                _delayedWindows.Remove(call);

                call.Window.Canvas.gameObject.SetActive(true);
                DoApplyWindow(call.Window, call.IsUnique, call.Overlap);
            });
        }
Beispiel #5
0
 private void OnInscription(object obj)
 {
     if (GestionBDD.verifLogin(Pseudo))
     {
         MessageBox.Show("Ce nom de compte est déjà utilisé", "Erreur", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
     else
     {
         if (Password1 == Password2)
         {
             GestionBDD.inscription(Pseudo, Password1);
             if (SelectSexe != "Pas spécifié...")
             {
                 GestionBDD.updateSexe(SelectSexe, Pseudo);
             }
             MessageBox.Show("Inscription enregistrée", "Confirmation", MessageBoxButton.OK);
             WindowClosedEvent.GetInstance().OnWindowClosedHandler(EventArgs.Empty);
         }
         else
         {
             MessageBox.Show("Veuillez rentrer le même mot de passe", "Mot de passe incorrect", MessageBoxButton.OK, MessageBoxImage.Warning);
         }
     }
 }
Beispiel #6
0
 private void OnCloseWindowPersoProfil(object sender, EventArgs e)
 {
     _wPersoProfil.Close();
     WindowClosedEvent.GetInstance().Handler -= OnCloseWindowPersoProfil;
 }
Beispiel #7
0
 private void OnCloseWindowAdd(object sender, EventArgs e)
 {
     _wAdd.Close();
     WindowClosedEvent.GetInstance().Handler -= OnCloseWindowAdd;
 }
 public void Handle(WindowClosedEvent message)
 {
     ActivateAnotherWindowAfterCollapsingCurrentOne(message.ClosedWindow);
 }
Beispiel #9
0
 private void OnQuit(object obj)
 {
     WindowClosedEvent.GetInstance().OnWindowClosedHandler(EventArgs.Empty);
 }
Beispiel #10
0
        private void OnSauverModifProfil(object obj)
        {
            if (Description != user.Description)
            {
                user_courant.Description = Description;
                GestionBDD.updateDescription(Description, user_courant.Pseudo);
            }

            if (SelectSexe != "Pas spécifié...")
            {
                user_courant.Sexe = SelectSexe;
                GestionBDD.updateSexe(SelectSexe, user_courant.Pseudo);
            }

            if (SelectDate != user_courant.DateDeNaissance)
            {
                user_courant.DateDeNaissance = SelectDate;
                GestionBDD.updateDdn(SelectDate.ToString(), user_courant.Pseudo);
            }

            //GESTION SAUVEGARDE IMAGE
            if (_verif)
            {
                if (!File.Exists($@"{_path}\{_fileName}"))
                {
                    FileInfo f = new FileInfo(openFile.FileName);
                    if (f.Length > 512000)
                    {
                        MessageBox.Show("La taille de l'image de profil est trop grande (500 ko maximum)", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    else
                    {
                        File.Copy(openFile.FileName, Path.Combine(_path, _fileName));
                        GestionBDD.enregisterPhotoProfil(_fileName, user.Pseudo);
                        user.image = new BitmapImage(new Uri($@"{_path}\{_fileName}"));
                    }
                }
                else
                {
                    GestionBDD.enregisterPhotoProfil(_fileName, user.Pseudo);
                    user.image = new BitmapImage(new Uri($@"{_path}\{_fileName}"));
                }
            }

            if (_verifCouv)
            {
                if (!File.Exists($@"{_path}\{_fileNameCouverture}"))
                {
                    FileInfo f = new FileInfo(_openFileCouverture.FileName);
                    if (f.Length > 716800)
                    {
                        MessageBox.Show("La taille de l'image de couverture est trop grande (700 ko maximum)", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    else
                    {
                        File.Copy(_openFileCouverture.FileName, Path.Combine(_path, _fileNameCouverture));
                        GestionBDD.enregisterPhotoCouverture(_fileNameCouverture, user.Pseudo);
                        user.couverture = new BitmapImage(new Uri($@"{_path}\{_fileNameCouverture}"));
                    }
                }
                else
                {
                    GestionBDD.enregisterPhotoCouverture(_fileNameCouverture, user.Pseudo);
                    user.couverture = new BitmapImage(new Uri($@"{_path}\{_fileNameCouverture}"));
                }
            }
            MessageBox.Show("Modification enregistrée");
            RefreshEvent.GetInstance().OnRefreshAcceuilHandler(EventArgs.Empty);
            WindowClosedEvent.GetInstance().OnWindowClosedHandler(EventArgs.Empty);
        }
 private void OnCloseWInscription(object sender, EventArgs e)
 {
     _wInscription.Close();
     WindowClosedEvent.GetInstance().Handler -= OnCloseWInscription;
 }
 /// <summary>
 /// Ouvre la fenêtre d'inscription, tout en s'abonnant à l'événement pour sa fermeture
 /// </summary>
 /// <param name="obj"></param>
 private void OnInscription(object obj)
 {
     WindowClosedEvent.GetInstance().Handler += OnCloseWInscription;
     _wInscription = new WindowInscription();
     _wInscription.ShowDialog();
 }
Beispiel #13
0
 public static void WindowClosedEventFunction()
 {
     WindowClosedEvent?.Invoke(null, null);//触发事件,执行所有注册过的函数
 }
Beispiel #14
0
 protected virtual void OnWindowClosedEvent(object sender, WindowEventArgs args)
 {
     WindowClosedEvent?.Invoke(sender, args);
 }