Ejemplo n.º 1
0
        private void singUpB_Click(object sender, EventArgs e)
        {
            IClientRequests clientRequests = (IClientRequests)ServiceProvider.GetService(typeof(IClientRequests));

            clientRequests.DatabaseName = SelectDatabaseName;

            Guid workerId = SingUp(NameW, Login, Password);

            if (Guid.Empty != workerId)
            {
                ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).Worker.Id = workerId;
            }
        }
Ejemplo n.º 2
0
        private void singIn_Click(object sender, EventArgs e)
        {
            IClientRequests clientRequests = (IClientRequests)ServiceProvider.GetService(typeof(IClientRequests));

            clientRequests.DatabaseName = databaseNamesCB.SelectedItem.ToString();

            Guid workerId = ((ApplicationState)(ServiceProvider.GetService(typeof(ApplicationState)))).Worker.Id = SingIn(loginTB.Text, passwordTB.Text);

            if (!workerId.Equals(Guid.Empty))
            {
                Hide();
            }
        }
Ejemplo n.º 3
0
        private void SingUp()
        {
            IClientRequests clientRequests = (IClientRequests)ServiceProvider.GetService(typeof(IClientRequests));

            clientRequests.DatabaseName = SelectDatabaseName;

            Guid workerId = Guid.Empty;

            if (!(string.IsNullOrEmpty(NameW) || string.IsNullOrEmpty(Login) || string.IsNullOrEmpty(Password)))
            {
                try
                {
                    ClientRequests.WorkerIsExist(Login);
                    MessageService.ErrorMessage(Message.MessageResource.ExistWorker);
                }
                catch (Exception ex)
                {
                    workerId = CreateWorker(NameW, Login, Password);
                    MessageService.InfoMessage(Message.MessageResource.SuccessfullRegistration);

                    ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).Worker.Id = workerId;
                    DialogResult = DialogResult.OK;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(NameW))
                {
                    MessageService.ErrorMessage(Message.MessageResource.EmptyName);
                }
                else
                if (string.IsNullOrEmpty(Login))
                {
                    MessageService.ErrorMessage(Message.MessageResource.EmptyLogin);
                }
                else
                if (string.IsNullOrEmpty(Password))
                {
                    MessageService.ErrorMessage(Message.MessageResource.EmptyPassword);
                }
            }
        }
Ejemplo n.º 4
0
        public IFolderPropertiesUIPlugin GetFolderPropetiesPlugin(FolderType selectedFolderType)
        {
            if (selectedFolderType == null)
            {
                throw new ArgumentNullException(nameof(selectedFolderType));
            }

            IFolderPropertiesUIPlugin clientUIPlugin;

            if (!_existClientPlugin.TryGetValue(selectedFolderType.Id, out clientUIPlugin))
            {
                IClientRequests clientRequests = (IClientRequests)(ServiceProvider.GetService(typeof(IClientRequests)));

                string typeClientFolderPropertiesUI = clientRequests.GetFolderType(selectedFolderType.Id).TypeClientUI;
                clientUIPlugin = CreatePlugin <IFolderPropertiesUIPlugin>(typeClientFolderPropertiesUI);

                _existClientPlugin.Add(selectedFolderType.Id, clientUIPlugin);
            }
            return(clientUIPlugin);
        }
Ejemplo n.º 5
0
        public ILetterPropertiesUIPlugin GetLetterPropetiesPlugin(LetterType selectedLetterType)
        {
            if (selectedLetterType == null)
            {
                throw new ArgumentNullException(nameof(selectedLetterType));
            }

            ILetterPropertiesUIPlugin clientLetterPropertiesPlugin;

            if (_currentClientLetterPropertiesPlugin.Key != selectedLetterType.Id)
            {
                IClientRequests clientRequests = (IClientRequests)(ServiceProvider.GetService(typeof(IClientRequests)));

                string typeClientLetterPropertiesUI = clientRequests.GetLetterType(selectedLetterType.Id).TypeClientUI;
                _currentClientLetterPropertiesPlugin = new KeyValuePair <int, ILetterPropertiesUIPlugin>(selectedLetterType.Id, CreatePlugin <ILetterPropertiesUIPlugin>(typeClientLetterPropertiesUI));
                clientLetterPropertiesPlugin         = _currentClientLetterPropertiesPlugin.Value;
            }
            else
            {
                clientLetterPropertiesPlugin         = _currentClientLetterPropertiesPlugin.Value;
                _currentClientLetterPropertiesPlugin = new KeyValuePair <int, ILetterPropertiesUIPlugin>(0, null);
            }
            return(clientLetterPropertiesPlugin);
        }
Ejemplo n.º 6
0
 private void InitializeClientService()
 {
     _clientRequests = (IClientRequests)ServiceProvider.GetService(typeof(IClientRequests));
 }
Ejemplo n.º 7
0
        private string GetLetterPluginTypeName(int letterTypeId)
        {
            IClientRequests clientRequests = (IClientRequests)(ServiceProvider.GetService(typeof(IClientRequests)));

            return(clientRequests.GetLetterType(letterTypeId).TypeClientUI);
        }
Ejemplo n.º 8
0
 public MemeCreatorViewModel(IClientApp client, IClientRequests clientRequests)
 {
     this.client         = client;
     this.clientRequests = clientRequests;
 }
Ejemplo n.º 9
0
 public MemeLibraryViewModel(IClientApp client, IClientRequests clientRequests)
 {
     this.client         = client;
     this.clientRequests = clientRequests;
 }
Ejemplo n.º 10
0
 public LoginViewModel(IClientApp client, IClientRequests clientRequests)
 {
     this.client         = client;
     this.clientRequests = clientRequests;
 }
Ejemplo n.º 11
0
 public ClientController(IClientRequests repo)
 {
     this.repo = repo;
 }
Ejemplo n.º 12
0
 public RegisterViewModel(IClientApp client, IClientRequests clientRequests)
 {
     this.client         = client;
     this.clientRequests = clientRequests;
 }