コード例 #1
0
 public WindowController()
 {
     InitializeComponent();
     login           = new LoginUserControl();
     login.GoToPage += new LoginUserControl.ChangePageHandler(GoToPage);
     GoToPage(PagesTypes.Login);
 }
コード例 #2
0
        public MainWindow()
        {
            InitializeComponent();
            this._loginUserControl = new LoginUserControl();
            DataContext            = this._loginUserControl;

            //hey you
            //Member john = new Member(
            //    "john",
            //    "Watson",
            //    "01",
            //    GenderEnum.man,
            //    "Washington DC",
            //    true);

            //Administration marta = new Administration(
            //    "marta",
            //    "Dayson",
            //    "02",
            //    GenderEnum.woman,
            //    "Paris DC",
            //    new BankDetails("1", "2"),
            //    1230,
            //    DateTime.Now);

            //List<People> list = new List<People>();

            //list.Add(john);
            //list.Add(marta);

            //Data data = new Data();
            //data.Peoples = list;
            //data.WriteData();
            //data.LoadData();
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: ssang96/FtpFileSender
        /// <summary>
        /// User Control 생성
        /// </summary>
        private void InitControl()
        {
            _loggerUserControl      = new LoggerUserControl();
            _loginUserControl       = new LoginUserControl(_loggerUserControl);
            _loginStatusUserControl = new SiteManageUserControl(_loggerUserControl);

            this.pnlLogin.Controls.Add(_loginUserControl);
            this.pnlSiteManage.Controls.Add(_loginStatusUserControl);
            this.pnlCurrentStatus.Controls.Add(_loggerUserControl);
        }
コード例 #4
0
        public MainWindow()
        {
            InitializeComponent();

            #region Variables Initialization
            loggedIn              = false;
            CurrentVM             = new FallVM();
            userVM                = new UserVM();
            currentLang           = "Resources/ukFlagIcon.png";
            CurrentUser           = new user();
            CurrentUser.firstname = "Guest";
            main   = new MainUserControl();
            login  = new LoginUserControl(this);
            report = new ReportUserControl(this);
            #endregion

            #region Preparing the Source of the Falls Listbox
            userControlGrid.Children.Add(main);
            foreach (var fall in CurrentVM.Falls)
            {
                Pushpin pushpin = new Pushpin();
                pushpin.Name       = "pushpin" + fall.id.ToString();
                pushpin.Location   = new Location(fall.x, fall.y);
                pushpin.Background = System.Windows.Media.Brushes.Orange;
                main.fallsView.Children.Add(pushpin);
            }
            main.fallsListBox.ItemsSource = CurrentVM.Falls.OrderByDescending(fall => fall.date);
            #endregion

            #region Handling the previous "Recent" Reports
            // We want to make sure that, if recentFalls still reports from a previous day(s),
            // it will be cleared before we start storing reports on it today.
            XElement prevFallsRoot = XElement.Load("recentFalls.xml");
            if (prevFallsRoot.HasElements)
            {
                IEnumerable <XElement> prevFallsList = prevFallsRoot.Elements("Fall").ToList();
                DateTime lastReport = new DateTime(0);
                foreach (XElement fallRep in prevFallsList)
                {
                    DateTime leDate = DateTime.Now;
                    DateTime.TryParse(fallRep.Element("Date").Value, out leDate);
                    if (leDate.CompareTo(lastReport) > 0)
                    {
                        lastReport = leDate;
                    }
                }
                if (lastReport.Day != DateTime.Now.Day || lastReport.Month != DateTime.Now.Month || lastReport.Year != DateTime.Now.Year)
                {
                    // This is where we'd first save the previous days reports on a more permanent
                    // storage on the cloud, if we wanted to do that
                    File.WriteAllText(@"recentFalls.xml", string.Empty);
                }
            }
            #endregion
        }
コード例 #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Panel PanelRecoveryPass = (Panel)LoginUserControl.FindControl("PanelRecoveryPassword");
         if (PanelRecoveryPass != null)
         {
             PanelRecoveryPass.Attributes.Add("style", "display:none");
         }
     }
 }
コード例 #6
0
 private void DispatcherTimer_Tick(object sender, EventArgs e)
 {
     if (counter == 1)
     {
         dispatcherTimer.Stop();
         LoginViewModel loginViewModel = new LoginViewModel();
         LoginUserControl = new LoginUserControl(loginViewModel);
         mainViewModel.MyGrid.Children.Clear();
         mainViewModel.MyGrid.Children.Add(LoginUserControl);
     }
     ++counter;
 }
コード例 #7
0
        private void Confirm_Click(object sender, RoutedEventArgs e)
        {
            int nb = 6;

            LoginUserControl.currentName = LoginUserControl.currentUser.Login; /// Ici la valeur du CurrentName prend la valeur de la saisie de l'utilisateur
            this.currentName             = LoginUserControl.currentName;       /// pour une visibilité plus claire, je mets cette variable dans une autre varaible pour la réutiliser
            selectName = LoginUserControl.SelectName(this.currentName);        /// je recherche si le nom existe en BDD
            if ((this.currentName is null) || (currentName.Length <= nb))
            {
                msg = "Votre Login doit contenir au moins " + nb + " caractères.";
                MessageBox.Show(msg);
                Application.Current.Windows.OfType <Window>().SingleOrDefault(x => x.IsActive).Content = new Inscription();
            }
コード例 #8
0
    protected void btnRecovery_Click(object sender, EventArgs e)
    {
        Panel PanelRecoveryPass = (Panel)LoginUserControl.FindControl("PanelRecoveryPassword");

        if (PanelRecoveryPass != null)
        {
            if (PanelRecoveryPass.Attributes.Count > 0)
            {
                PanelRecoveryPass.Attributes.Clear();
            }
            else
            {
                PanelRecoveryPass.Attributes.Add("style", "display:none");
            }
        }
    }
コード例 #9
0
 public void GoToPage(PagesTypes page)
 {
     switch (page)
     {
     case PagesTypes.Login:
         //Close last opened usercontrol,
         ....
         //open new usercontrol
         login = new LoginUserControl();
         contentpresenter.content = login;
         break;
         //other pages cases
         ....
     }
     currentOpenedPage = page;
 }
コード例 #10
0
 private void LoginButton_Click(object sender, RoutedEventArgs e)
 {
     if (MainWindow.CurrentUser.firstname != "Guest")
     {
         LoginUserControl.showAlreadyLoggedIn();
         return;
     }
     loginButton.BorderThickness  = new Thickness(0, 0, 0, 2);
     loginButton.FontWeight       = FontWeights.ExtraBold;
     mainButton.BorderThickness   = new Thickness(0, 0, 0, 0);
     mainButton.FontWeight        = FontWeights.Normal;
     updateButton.BorderThickness = new Thickness(0, 0, 0, 0);
     updateButton.FontWeight      = FontWeights.Normal;
     reportButton.BorderThickness = new Thickness(0, 0, 0, 0);
     reportButton.FontWeight      = FontWeights.Normal;
     userControlGrid.Children.RemoveAt(0);
     login = new LoginUserControl(this);
     userControlGrid.Children.Add(login);
 }
コード例 #11
0
        private void Confirm_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            LoginUserControl.currentName = LoginUserControl.currentUser.Login; /// Ici la valeur du CurrentName prend la valeur de la saisie de l'utilisateur
            currentName = LoginUserControl.currentName;                        /// pour une visibilité plus claire, je mets cette variable dans une autre varaible pour la réutiliser
            LoginUserControl.currentPassword = LoginUserControl.currentUser.Password;
            this.currentPassword             = LoginUserControl.currentPassword;
            selectName     = LoginUserControl.SelectName(currentName);
            selectPassword = LoginUserControl.SelectMdp(currentName, this.currentPassword);

            if (currentName is null)
            {
                message = "Aucun nom d'utilisateur n'a été saisi.";
                MessageBox.Show(message);
                Application.Current.Windows.OfType <Window>().SingleOrDefault(x => x.IsActive).Content = new FirstConnexion();
            }
            else if (currentName == selectName && currentPassword == selectPassword)
            {
                SelectIdChar();
                if (idCharacter == 0)
                {
                    Application.Current.Windows.OfType <Window>().SingleOrDefault(x => x.IsActive).Content = new Characters();
                }
                /// Ici l'utilkisateur n'a jamais créé de personnage
                else
                {
                    Application.Current.Windows.OfType <Window>().SingleOrDefault(x => x.IsActive).Content = new Home();
                }
                /// Si l'utilisateur a déjà créé un personnage il arrivera directement sur la page d'accueil
            }
            else
            {
                message = "L'utilisateur est inconnu ou le mot de passe est erroné.";
                MessageBox.Show(message);
                Application.Current.Windows.OfType <Window>().SingleOrDefault(x => x.IsActive).Content = new FirstConnexion();
            }
        }
コード例 #12
0
        public static void SetMainControl(ERMTControl view)
        {
            ERMTUserControl currentUserControl = new ERMTUserControl {
                Name = "new"
            };

            switch (view)
            {
            case ERMTControl.About:
            {
                About about = new About();
                about.ShowDialog();
                break;
            }

            case ERMTControl.EditRegion:
            {
                EditRegion editRegion = new EditRegion();
                currentUserControl = editRegion;
                SetMainControl(editRegion);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.ElectoralCycle:
            {
                IndexUserControl indexUserControl = new IndexUserControl
                {
                    IndexContentType = IndexContentType.ElectoralCycle
                };
                currentUserControl = indexUserControl;
                SetMainControl(indexUserControl);
                ApplicationPrincipalForm.LoadLeftButtons("electoralcycle");
                indexUserControl.ShowHtml();
                break;
            }

            case ERMTControl.ElectoralCycleModifyPhase:
            {
                ElectoralCycleModifyPhase electoralCycleModifyPhase = new ElectoralCycleModifyPhase();
                currentUserControl = electoralCycleModifyPhase;
                SetMainControl(electoralCycleModifyPhase);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.FactorModify:
            {
                FactorModify modifyFactor = new FactorModify();
                currentUserControl = modifyFactor;
                SetMainControl(modifyFactor);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.FactorNew:
            {
                FactorNew newFactor = new FactorNew();
                currentUserControl = newFactor;
                SetMainControl(newFactor);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.FactorReorder:
            {
                FactorsReorder reorderFactors = new FactorsReorder();
                currentUserControl = reorderFactors;
                SetMainControl(reorderFactors);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.KnowledgeResources:
            {
                IndexUserControl indexUserControl = new IndexUserControl
                {
                    IndexContentType = IndexContentType.KnowledgeResources
                };
                currentUserControl = indexUserControl;
                SetMainControl(indexUserControl);
                ApplicationPrincipalForm.LoadLeftButtons("KnowledgeResources");
                indexUserControl.ShowHtml();
                break;
            }

            case ERMTControl.Login:
            {
                LoginUserControl loginUserControl = new LoginUserControl();
                currentUserControl = loginUserControl;
                SetMainControl(loginUserControl);
                break;
            }

            case ERMTControl.MarkerTypeCRUD:
            {
                MarkerTypeCRUD markerTypeControl = new MarkerTypeCRUD();
                currentUserControl = markerTypeControl;
                SetMainControl(markerTypeControl);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.ModelEdit:
            {
                ModelEdit modelEdit = new ModelEdit();
                currentUserControl = modelEdit;
                SetMainControl(modelEdit);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.ModelNew:
            {
                ModelNew modelNew = new ModelNew();
                currentUserControl = modelNew;
                SetMainControl(modelNew);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.ModelReorderFactors:
            {
                ModelReorderFactors modelReorderFactors = new ModelReorderFactors();
                currentUserControl = modelReorderFactors;
                SetMainControl(modelReorderFactors);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.RiskActionRegister:
            {
                RiskAndActionRegister riskActionRegister = new RiskAndActionRegister(true);
                currentUserControl = riskActionRegister;
                SetMainControl(riskActionRegister);
                ApplicationPrincipalForm.LoadLeftButtons("riskandaction");
                break;
            }

            case ERMTControl.RiskMapping:
            {
                //RiskMapping riskMapping = new RiskMapping();
                //currentUserControl = riskMapping;
                //SetMainControl(riskMapping);
                currentUserControl = ControlCache.RiskMappingInstance;
                SetMainControl(ControlCache.RiskMappingInstance);
                ApplicationPrincipalForm.LoadLeftButtons("map");
                break;
            }

            case ERMTControl.Start:
            {
                SetMainControl(ControlCache.StartInstance);
                currentUserControl = ControlCache.StartInstance;
                ApplicationPrincipalForm.LoadLeftButtons("Start");
                break;
            }

            case ERMTControl.TestUserControl:
            {
                TestUserControl testUserControl = new TestUserControl();
                SetMainControl(testUserControl);
                break;
            }

            case ERMTControl.UserModify:
            {
                UserModify userModify = new UserModify();
                currentUserControl = userModify;
                SetMainControl(userModify);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.UserNew:
            {
                UserNew userNew = new UserNew();
                currentUserControl = userNew;
                SetMainControl(userNew);
                ApplicationPrincipalForm.LoadLeftButtons();
                break;
            }

            case ERMTControl.UserResetPassword:
            {
                UserChangePassword ucp = new UserChangePassword();
                ucp.ShowDialog();

                break;
            }
            }
            if (currentUserControl.Name != "new")
            {
                currentUserControl.ShowTitle();
            }
        }