Example #1
0
 private void SetValuesW(IWeatherDto dto)
 {
     lblCity.Text        = dto.name;
     lblWeatherDesc.Text = $"Desc: {dto.weather.First().description}";
     lblTemp.Text        = $"Temp: {(dto.main.temp - 273.15).ToString()}°C";
     pcbWeather.Image    = Image.FromStream(CustomServiceContainer.GetService <IWeatherApi>().GetWeatherIcon(dto.weather.First().icon));
 }
Example #2
0
        public Statistics_form(int fSize, bool labelStyle)
        {
            InitializeComponent();

            _files = CustomServiceContainer.GetService <IFileManager>().GetAllFiles(resources.targetPath);

            ChartStyle(fSize, labelStyle);
            Initialize();
        }
Example #3
0
        public Downloads_form()
        {
            InitializeComponent();
            _files = new List <SavedFileModel>();
            _files = CustomServiceContainer.GetService <IFileManager>().GetAllFiles(resources.targetPath);

            _files            = _files.OrderBy(x => x.FileName);
            btnNameSort.Image = resources.up_arrow_sort_8px;
            alphOrder         = 1;

            Initialize();
        }
Example #4
0
        private async void SetWeather()
        {
            try
            {
                var data = await CustomServiceContainer.GetService <IWeatherApi>().GetWeatherData(resources.city, resources.weatherApiKey);

                var dto = CustomServiceContainer.GetService <IWeatherApi>().GetWeatherDto(data);
                SetValuesW(dto);
            }
            catch (Exception)
            {
                SetDefValuesW();
            }
        }
Example #5
0
        //private async void _fileWatcher_Created(object sender, FileSystemEventArgs e) { }

        private async void _fileWatcher_Changed(object sender, FileSystemEventArgs e)
        {
            var files = await CustomServiceContainer.GetService <IFileManager>().GetDirFiles(resources.sourcePath, resources.targetPath);

            foreach (var file in files)
            {
                var result = await CustomServiceContainer.GetService <IFileManager>().MoveFiles(file, resources.sourcePath, resources.targetPath);

                if (result)
                {
                    Notification_form ntf = new Notification_form(file.TargetPath);
                    var msg = file.FileName.Length > 10 ? file.FileName.Substring(0, 10) + "..." : file.FileName;
                    ntf.showAlert(msg + " has downloaded", file.Creation.ToString("h:mm tt"));
                }
            }
        }