private void BindCommands()
 {
     _view.LoginCommand = new BaseCommand(new Action(() =>
     {
         if (_networkConnection.TryConnect(_networkPathInfo.GetNetworkPath(), _view.Model.Username, _view.Model.Password))
         {
             var permissions = new CredentialsDto()
             {
                 NetworkPath = _networkPathInfo.GetCredentialsName(),
                 Login       = _view.Model.Username,
                 Password    = _view.Model.Password
             };
             _userAccess.WriteCredentials(permissions);
             _view.CloseDialog();
         }
         else
         {
             MessageBox.Show("Fill all fields or enter the correct data");
         }
     }));
 }
Esempio n. 2
0
        private async Task DownloadAction()
        {
            try
            {
                var cred = _userAccessCredentials.ReadCredentials();
                if (cred == null)
                {
                    throw new Exception("Cannot to upload file");
                }
                _networkConnection.TryConnect(_networkPathInfo.GetNetworkPath(), cred.Login, cred.Password);

                var pathToSource = _view.Model.PathToSource;
                var checksum     = _view.Model.Checksum;
                var myForm       = _downloadSelectedVersionPresenter;
                myForm.Init(pathToSource, checksum);
                await myForm.Run();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }