public UnitTestAmazonCloud()
        {

            repositoryWPF = new WPFSettingRepository(tr, AEScipher);
            tr = repositoryWPF.getdata();                        
            st = new sAmazonS3(tr);        
        }
        public void saveData(ILocalSettings tr)
        {
            string settingsDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            List<ILocalCloudAccounts> cloudNew = new List<ILocalCloudAccounts>();
            
            foreach (ILocalCloudAccounts str in tr.icloudSettings)
            {
                 
                if (!string.IsNullOrEmpty(str.cloudKey1)) {str.cloudKey1 = _iCryption.encrypt(str.cloudKey1);}
                if (!string.IsNullOrEmpty(str.cloudKey2)) {str.cloudKey2 = _iCryption.encrypt(str.cloudKey2);}
                if (!string.IsNullOrEmpty(str.cloudKey3)){str.cloudKey3 = _iCryption.encrypt(str.cloudKey3);}
                if (!string.IsNullOrEmpty(str.cloudKey4)){str.cloudKey4 = _iCryption.encrypt(str.cloudKey4);}
                cloudNew.Add(str);
            }

            tr.icloudSettings = cloudNew;

            Type t = tr.GetType();
            DataContractSerializer serializer = new DataContractSerializer(t ,  new Type[] { typeof(LocalCloudAccounts) });            
            StringWriter sw = new StringWriter();
            XmlTextWriter xw = new XmlTextWriter(sw);
            serializer.WriteObject(xw, tr);
            string dw = sw.ToString();
            
            
            string path = Path.Combine(settingsDirectory, _folder);
            if (!Directory.Exists(path))
                Directory.CreateDirectory(path);
            path = Path.Combine(settingsDirectory, _folder,_ZALOHOVANISETTINGS);
            System.IO.File.WriteAllText(path, dw);
        }
示例#3
0
        public WhatsNewService(ILoggerService loggerService, ILocalSettings localSettings, IApplicationService applicationService, ContentDialog contentDialog)
        {
            try
            {
                _loggerService      = loggerService;
                _localSettings      = localSettings;
                _applicationService = applicationService;

                if (!_localSettings.Values.ContainsKey(_applicationService.GetAppVersion()))
                {
                    IsAppUpdated = true;
                }
                else
                {
                    IsAppUpdated = false;
                }
                _contentDialog = contentDialog;
                if (_contentDialog != null)
                {
                    _contentDialog.Closed += ContentDialog_Closed;
                }
            }
            catch (Exception e)
            {
                _loggerService.LogException(nameof(WhatsNewService), e);
            }
        }
        public SettingsViewModel(ILocalSettings localsettingService, ISettingRepository repositoryService)
        {

            OpenDialog = new RelayCommand(() => ExecuteOpenFileDialog());
            DeleteFile = new RelayCommand(() => DeleteSelectedFile());
            TakeBackupCommand = new RelayCommand(() => TakeBackup(), () => TakeBackupCanExecute());
            SaveSettingsCommand = new RelayCommand(() => SaveSettings(), () => SaveSettingsCanExecute());


            this._unitofWork = repositoryService;
            this._localsetting = this._unitofWork.getdata();
            this.ListOFCloudsSupported = new List<string>();
            initView();

            if (this._localsetting != null)
            {
                loaddata();

            }
            else
            {
                this._localsetting = localsettingService;
                this._localCloudAccounts = new List<ILocalCloudAccounts>();
                this.foldersToBackup = new ObservableCollection<string>();

            }

        }
 public MainPageViewModel(INavigationService navigationService, IResourceService resourceLoader,
                          ILoggerService loggerService, IApplicationService applicationService, ILocalSettings <ResizeSettings> localSettings) : base(loggerService)
 {
     _ResourceLoader     = resourceLoader;
     _NavigationService  = navigationService;
     _LoggerService      = loggerService;
     _applicationService = applicationService;
     _localSettings      = localSettings;
     Items = new List <MenuItem>()
     {
         //use symbols from namespace Windows.UI.Xaml.Controls.Symbol
         new MenuItem()
         {
             Name = resourceLoader.GetString("AppName"), Icon = "Folder", PageType = typeof(ResizePageViewModel)
         },
         new MenuItem()
         {
             Name = resourceLoader.GetString("Help"), Icon = "Help", PageType = typeof(HelpPageViewModel)
         },
         new MenuItem()
         {
             Name = resourceLoader.GetString("Contact"), Icon = "Contact", PageType = typeof(AboutPageViewModel)
         },
         new MenuItem()
         {
             Name = resourceLoader.GetString("Setting"), Icon = "Setting", PageType = typeof(SettingsPageViewModel)
         },
     };
     SelectedMenuItem  = Items.FirstOrDefault();
     NavigateToCommand = new DelegateCommand <MenuItem>(OnNavigateToCommand);
     _NavigationService.Navigate(SelectedMenuItem.PageType, null);
 }
示例#6
0
        public TextCommandListener(ILocalSettings settings)
        {
            var port = settings.SimulatorPort != 0 ? settings.SimulatorPort : 8081;

            // var address = new IPAddress(new byte[] { 127, 0, 0, 1 });
            var address  = IPAddress.Any;
            var listener = new TcpListener(address, port);

            listener.Start();
            listener.BeginAcceptSocket(AcceptCallback, listener);
            Log.Information("WebIO Simulator listening on {Address} port {Port}", address, port);
        }
 public SettingsPageViewModel(ILoggerService loggerService, ILocalSettings <ResizeSettings> localSettings, IFileService fileService) : base(loggerService)
 {
     try
     {
         _LoggerService = loggerService;
         _localSettings = localSettings;
         _fileService   = fileService;
         _LoggerService?.LogEvent(nameof(SettingsPageViewModel));
     }
     catch (Exception e)
     {
         _LoggerService?.LogException(nameof(AboutPageViewModel), e);
     }
 }
示例#8
0
        public App()
        {
            InitializeComponent();
            RegisterIoC();
            settings = FreshIOC.Container.Resolve <ILocalSettings>();

            if (settings.CurrentReturn == null)
            {
                settings.CurrentReturn = new Return();
            }

            // if (Device.RuntimePlatform == Device.iOS)
            ShowLoginPage();
            //else
            //    MainPage = new NavigationPage(new MainPage());
        }
        public ResizePageViewModel(IDragDropService dragDrop, IShareService shareService,
                                   IResizeService resizeService, IPageDialogService pageDialogService, IProgressBarDialogService progressBar,
                                   IFileSystemPermissionDialogService fileSystemPermissionDialogService, IApplicationService applicationService, IImageFileService imageFileService, ILocalSettings <ResizeSettings> localSettings,
                                   ILoggerService loggerService, ObservableCollection <ImageFile> selectedFiles,
                                   INavigationService navigationService, IResourceService resourceLoader, AppStartType appStartType) : base(loggerService)
        {
            try
            {
                _appStartType = appStartType;
                _fileSystemPermissionDialogService = fileSystemPermissionDialogService;
                _dragDropService = dragDrop;
                _shareService    = shareService;
                _resizeService   = resizeService;
                _localSettings   = localSettings;
                _localSettings.Settings.PropertyChanged += Settings_PropertyChanged;
                _pageDialogService        = pageDialogService;
                _progressBarDialogService = progressBar;
                _applicationService       = applicationService;
                _selectedFiles            = selectedFiles;
                _resourceLoader           = resourceLoader;
                _navigationService        = navigationService;
                _loggerService            = loggerService;
                _imageFileService         = imageFileService;
                ImageFiles = new ObservableCollection <ImageFile>();

                if (_selectedFiles != null)
                {
                    ImageFiles = _selectedFiles;
                }
                //get settings
                LoadSettings();

                if (IsShareTarget)
                {
                    OverwriteFiles = false;
                }

                //update preview
                ApplyPreviewDimensions();
                PropertyChanged += ResizePageViewModel_PropertyChanged;
                _loggerService?.LogEvent(nameof(ResizePageViewModel));
            }
            catch (Exception e)
            {
                _loggerService?.LogException(nameof(ResizePageViewModel), e);
            }
        }
示例#10
0
        public MainViewModel(INavigationService pageNavigationService, IRestClient restClient, IMessageDialog messageDialog, ITileManager tileManager, ILocalSettings localSettings) : base(pageNavigationService)
        {
            Caption = "Cotización en Argentina";

            _pageNavigationService = pageNavigationService;
            _restClient            = restClient;
            _messageDialog         = messageDialog;
            _tileManager           = tileManager;
            _localSettings         = localSettings;

            if (!DesignMode.DesignModeEnabled)
            {
                PopulateRatesAsync();

                RegisterBackGroundTaskAsync();

                UpdateTile();
            }
        }
        public sAmazonS3(ILocalSettings settings)
        {
           // Amazon.Runtime.BasicAWSCredentials credentials = new Amazon.Runtime.BasicAWSCredentials(settings.cloudKey1, settings.cloudKey2);
            _listofFoldersToBackup = settings.foldersToBackUp;
            _settings = settings.icloudSettings.FirstOrDefault(p => p.storageType == patrates.zalohovani.models.cloudTypes.Amazon); 
            AmazonS3Config S3Config = new AmazonS3Config()
            {
                ServiceURL = "s3.amazonaws.com",
                RegionEndpoint = Amazon.RegionEndpoint.USEast1
            };

            try
            {

                this.client = new AmazonS3Client(_settings.cloudKey1, _settings.cloudKey2, S3Config);
            }
            catch (AmazonS3Exception err)
            {

                throw new Exception(err.Message);
            }
            catch (Exception err)
            {

                throw new Exception(err.Message);
            }
            
            this.bucketname = _settings.cloudKey3;
            Boolean istrue = AmazonS3Util.DoesS3BucketExist(client, this.bucketname);
            
            if (!(istrue))
            {
                _CreateABucket(this.bucketname);
            }

            
        }
示例#12
0
 public DragDropService(IImageFileService imageFileService, ILoggerService loggerService, ILocalSettings localSettings)
     : this(imageFileService)
 {
     _fileService = new FileService(loggerService);
 }
示例#13
0
 public DopplerAPI(IConfigurationSettings configuration, ILocalSettings localSettings)
 {
     _configuration = configuration;
     _localSettings = localSettings;
 }
        private void CreateRepository()
        {

            this.unitofwork = ServiceLocator.Current.GetInstance<ISettingRepository>();
            this.localsettings = unitofwork.getdata();
            this.repository = new cloudRepository(this.localsettings);

        }
        public RestoreViewModel(ILocalSettings tr,IcloudRepository repository)
        {
            var canSearch = this.WhenAny(x => x.FilterPattern, x => !String.IsNullOrWhiteSpace(x.Value));
            Search =  ReactiveCommand.Create(canSearch,System.Reactive.Concurrency.DispatcherScheduler.Current);
            Search.CanExecute(canSearch);
            Search.Subscribe(x => CreateTreeView(this.FilterPattern));
            this.WhenAnyValue(x => x.FilterPattern)
             .Throttle(TimeSpan.FromSeconds(1), RxApp.MainThreadScheduler);
            


            RestoreFiles = new RelayCommand(() => ExecuteRestoreFiles());
            OpenDialog = new RelayCommand(() => ExecuteOpenFileDialog());
            RefreshData = new RelayCommand(() => RefreshCurrentData());
            this.repository = repository;
            this.localsettings = tr;

            
            CreateTreeView();
           

        }
        private void SaveSettings()
        {
            this._localsetting.customerName = this._customerName;
            this._localsetting.customerKey = this._customerKey;
            Boolean foundCloud = false;
            foreach (var item in this._localCloudAccounts)
            {
                if ((int)item.storageType == this._icloudService)
                {
                    item.cloudKey1 = this.cloudKey1;
                    item.cloudKey2 = this.cloudKey2;
                    item.cloudKey3 = this.cloudKey3;
                    item.isactive = true;
                    foundCloud = true;
                }

            }

            if (!foundCloud && !string.IsNullOrWhiteSpace(this._cloudKey1) && !string.IsNullOrWhiteSpace(this._cloudKey2))
            {
                ILocalCloudAccounts newAccount = ServiceLocator.Current.GetInstance<ILocalCloudAccounts>();
                newAccount.cloudKey1 = this._cloudKey1;
                newAccount.cloudKey2 = this._cloudKey2;
                newAccount.cloudKey3 = null;
                newAccount.cloudKey4 = null;
                newAccount.isactive = true;
                newAccount.storageType = (cloudTypes)this._icloudService;
                this._localCloudAccounts.Add(newAccount);
            }


            this._localsetting.icloudSettings = this._localCloudAccounts;
            this._localsetting.foldersToBackUp = this.foldersToBackup.ToList();
            this._localsetting.automate = this._automate;
            this._localsetting.frequeny = this._frequeny;
            this._localsetting.monWeek = this._monWeek;
            this._localsetting.tueWeek = this._tueWeek;
            this._localsetting.wedWeek = this._wedWeek;
            this._localsetting.thuWeek = this._thuWeek;
            this._localsetting.friWeek = this._friWeek;
            this._localsetting.satWeek = this._satWeek;
            this._localsetting.sunWeek = this._sunWeek;
            this._localsetting.timeofRun = this._timeRun;
            this._unitofWork.saveData(this._localsetting);
            this._localsetting = this._unitofWork.getdata();
            loaddata();
            displayMessage("Settings Saved !!");

        }
 public NavigationService(ILocalSettings settingsService)
 {
     _settingsService = settingsService;
 }
 public void saveData(ILocalSettings tr)
 {
     throw new NotImplementedException();
 }
 public DummyRepository(ILocalSettings tr, ICryption cryption)
 {
     this._localSetting = tr;
     this.iCryption = cryption;
     this.settingsDirectory = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
 }
示例#20
0
 public AuthenticationService(ILocalSettings localSettings, IDopplerAPI dopplerApi)
 {
     _localSettings = localSettings;
     _dopplerApi    = dopplerApi;
 }
示例#21
0
 public CampaignRecipientService(ILocalSettings localSettings, IDopplerAPI dopplerApi)
 {
     _localSettings = localSettings;
     _dopplerApi    = dopplerApi;
 }
 public cloudRepository(ILocalSettings tr)
 {
     this._lcloudList = new List<iCloud>();
     this._settings = tr;
 }