コード例 #1
0
        private async void AddPosition_Click(object sender, RoutedEventArgs e)
        {
            var settings = new MetroDialogSettings
            {
                ColorScheme = MetroDialogColorScheme.Theme,
                AnimateShow = true,
            };

            if (string.IsNullOrWhiteSpace(TextBoxPositionName.Text) || string.IsNullOrWhiteSpace(FacultyList.Text))
            {
                await this.ShowMessageAsync("Add new Position", "Please Specify Position Name ");
            }
            var result = await this.ShowMessageAsync("Add new Position", "are you sure you want to add ", MessageDialogStyle.AffirmativeAndNegative, settings);

            if (result != MessageDialogResult.Affirmative)
            {
                return;
            }
            CurrentPosition = new Position {
                Id = _positionId, PositionName = TextBoxPositionName.Text, RankId = Convert.ToInt32(RankList.SelectedValue), FacultyId = Convert.ToInt32(FacultyList.SelectedValue)
            };
            _electionConfigurationService = container.Resolve <IElectionConfigurationService>();
            await _electionConfigurationService.AddPositionAsync(CurrentPosition);

            await this.ShowMessageAsync("Add new Position", "success");

            AdminSetUpPositionPage_Loaded(this, e);
        }
コード例 #2
0
 public PresidentLoginWindow(IElectionConfigurationService electionConfigurationService, IVotingService votingService)
 {
     _electionConfigurationService = electionConfigurationService;
     _votingService = votingService;
     InitializeComponent();
     BtnLogin.Click += BtnLogin_Click;
     //Username.Focus();
 }
コード例 #3
0
        public AdminLoginWindow()
        {
            var container = new BootStrapper().BootStrap();

            _electionConfigurationService = container.Resolve <IElectionConfigurationService>();
            InitializeComponent();
            BtnLogin.IsDefault = true;
            //Username.Focus();
            BtnLogin.Click += BtnLogin_Click;
        }
コード例 #4
0
        private async void AdminSetUpPositionPage_Loaded(object sender, RoutedEventArgs e)
        {
            _electionConfigurationService = container.Resolve <IElectionConfigurationService>();
            FacultyList.ItemsSource       = await _electionConfigurationService.GetFacultiesAsync();

            PositionList.ItemsSource
                = await _electionConfigurationService.GetAllPositionsAsync(true);

            RankList.ItemsSource
                = await _electionConfigurationService.GetAllRanksAsync();
        }
コード例 #5
0
        public AdminDispensePasswordWindow()
        {
            var container = new BootStrapper().BootStrap();

            _electionConfigurationService = container.Resolve <IElectionConfigurationService>();
            InitializeComponent();
            Loaded += AdminDispensePasswordWindow_Loaded;
            StudentName.TextChanged             += StudentName_TextChanged;
            StudentsSearchList.MouseDoubleClick += StudentsSearchList_MouseDoubleClick;
            RefreshList.Click += RefreshList_Click;
        }
コード例 #6
0
        public EcChairmanLoginWindow(IElectionConfigurationService electionConfigurationService)
        {
            var container = new BootStrapper().BootStrap();

            _electionConfigurationService = electionConfigurationService;

            InitializeComponent();
            WindowState        = WindowState.Maximized;
            BtnLogin.IsDefault = true;
            BtnLogin.Click    += BtnLogin_Click;
            //Username.Focus();
        }
コード例 #7
0
        public AdminCreateAccountPage(IElectionConfigurationService electionConfigurationService)
        {
            var container = new BootStrapper().BootStrap();

            _electionConfigurationService = electionConfigurationService;
            InitializeComponent();
            BtnSave.Click       += BtnSave_Click;
            IsChairman.Checked  += IsChairman_Checked;
            IsPresident.Checked += IsPresident_Checked;
            //RepeatPassword.PasswordChanged += RepeatPassword_TextChanged;
            RepeatPassword.PasswordChanged += RepeatPassword_PasswordChanged;
        }
コード例 #8
0
        public ClientsLoginWindow()
        {
            InitializeComponent();
            container = new BootStrapper().BootStrap();

            _electionConfigurationService = container.Resolve <IElectionConfigurationService>();

            _positionsStack = new Stack <Position>();
            Loaded         += ClientsLoginWindow_Loaded;
            _voter          = new Voter();
            BtnGo.Click    += BtnGo_Click;
        }
コード例 #9
0
 public AdminAddVotersPage()
 {
     _container = new BootStrapper().BootStrap();
     _electionConfigurationService = _container.Resolve <IElectionConfigurationService>();
     _votingService = _container.Resolve <IVotingService>();
     InitializeComponent();
     _dataSet                      = new DataSet();
     voters                        = new List <Voter>();
     BtnSearch.Click              += BtnSearch_Click;
     BtnImportFile.Click          += BtnImportFile_Click;
     BtnSave.Click                += BtnSave_Click;
     TextBoxIndexNumber.LostFocus += TextBoxIndexNumber_LostFocus;
     Loaded                       += AdminAddVotersPage_Loaded;
 }
コード例 #10
0
 public App()
 {
     try
     {
         _container = new BootStrapper().BootStrap();
         _window    = _container.Resolve <ClientsLoginWindow>();
         _electionConfigurationService = _container.Resolve <IElectionConfigurationService>();
         BlobCache.ApplicationName     = $"VotingApplication";
         AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
     }
     catch (Exception e)
     {
         _container.Resolve <IDialogService>().ShowMessageAsync(_window, "Error", e.Message).Wait();
     }
 }
コード例 #11
0
        private async void SaveElection_Click(object sender, RoutedEventArgs e)
        {
            if (
                !string.IsNullOrWhiteSpace(TextBoxElectionName.Text) || !string.IsNullOrWhiteSpace(TextBoxElectionName.Text))
            {
                _electionConfigurationService = _container.Resolve <IElectionConfigurationService>();
                await _electionConfigurationService.AddElectionConfigurationsAsync(new ElectionConfiguration
                {
                    ElectionName     = TextBoxElectionName.Text,
                    ElectionSubTitle = TextBoxSubtitle.Text,
                    Colour           = string.Join(",", _chosencolor.R.ToString(), _chosencolor.G.ToString(), _chosencolor.B.ToString()),
                    Logo             = Util.ConvertToBytes(Logo)
                });

                Util.Clear(this);
            }
        }
コード例 #12
0
        public AdminSetUpCandidatesPage()
        {
            _candidateId = 0;
            InitializeComponent();
            SaveCandidate.Click += SaveCandidate_Click;
            #region RankGeneration
            //_rank = new List<int>();
            //for (int i = 1; i <= 10; ++i)
            //{
            //	_rank.Add(i);
            //}
            //RankCombo.ItemsSource = _rank;
            #endregion

            var container = new BootStrapper().BootStrap();
            _electionConfigurationService = container.Resolve <IElectionConfigurationService>();
        }
コード例 #13
0
 public MainWindowViewModel(IElectionConfigurationService service)
 {
     _service = service;
 }
コード例 #14
0
 public AddPositionViewModel(IElectionConfigurationService electionConfigurationService)
 {
     _electionConfigurationService = electionConfigurationService;
 }