public async void LoadIterations(string directory)
        {
            LocalStorageProvider provider = new LocalStorageProvider();

            StorageResult result = await provider.LoadStoredIterationsAsync(directory);

            if((result.Status == StorageStatus.Success || result.Status == StorageStatus.Warning) && result.Result != null)
            {
                BrowsedIterations = new ObservableCollection<BrowsedIteration>((List<BrowsedIteration>)result.Result);
            }
        }
        public async void LoadIterations(string directory)
        {
            LocalStorageProvider provider = new LocalStorageProvider();

            StorageResult result = await provider.LoadStoredIterationsAsync(directory, CheckSubFolder);


            if(result.Status == StorageStatus.Success || result.Status == StorageStatus.Warning)
            {
                BrowsedIterations = new ObservableCollection<BrowsedIteration>((List<BrowsedIteration>)result.Result);

                // Generate statistics
                GenerateBasicStatistics();
            }
        }
Example #3
0
        private async void LoadKeywords()
        {
            LocalStorageProvider storage = new LocalStorageProvider();

            var directory = Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Iterations", "Common"));

            StorageResult = await storage.LoadKeywords(directory.FullName);

            if (StorageResult.Result != null)
            {
                string val = StorageResult.Result.ToString();
                ObservableCollection<string> col = new ObservableCollection<string>();
                string[] tmp = val.Split(',');

                foreach (string kword in tmp)
                    col.Add(kword.Trim());

                AvailableKeywords = col;
            }
        }
Example #4
0
        private async void LoadDutyGroups()
        {
            LocalStorageProvider storage = new LocalStorageProvider();

            var directory = Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Iterations", "Common"));

            StorageResult = await storage.LoadGroups(directory.FullName);

            if (StorageResult.Result != null)
            {
                string json = (string)StorageResult.Result;

                List<DutyGroup> lst = JsonConvert.DeserializeObject<List<DutyGroup>>(json);
                if (lst != null && lst.Count > 0)
                {
                    AvailableGroups = new ObservableCollection<DutyGroup>(lst);
                }
                else
                {
                    InitDummyGroups();
                }
            }
            else
            {
                InitDummyGroups();
            }
        }
Example #5
0
        private async void SyncDutyGroups()
        {
            var directory = Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Iterations", "Common"));

            //TODO: add proper factory infrastructure
            LocalStorageProvider storage = new LocalStorageProvider();

            StorageResult = await storage.StoreGroups(AvailableGroups.ToList(), directory.FullName);
        }
Example #6
0
        private async void FinishIterationAndStoreIt()
        {
            _Provider.EndIteration();

            SetPrettyIterationPrint();

            var directory = Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Iterations"));

            //TODO: add proper factory infrastructure
            LocalStorageProvider storage = new LocalStorageProvider();
            StorageResult = await storage.StoreIteration(_Provider.Iteration, directory.FullName);

            _Provider.StartNewIteration();

            NotifyPropertyChanged(() => CurrentDuty);
            NotifyPropertyChanged(() => CurrentDutyGroup);
            ResetAndStopTimer();

            var directoryTemp = Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Iterations", "Common"));
            await storage.DeleteTempIteration(directoryTemp.FullName);
        }
Example #7
0
        private async void StoreTempIteration()
        {
            var directory = Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Iterations", "Common"));

            LocalStorageProvider provider = new LocalStorageProvider();

            string json = JsonConvert.SerializeObject(Provider.Iteration);

            StorageResult result = await provider.StoreTempIteration(json, directory.FullName);
        }
Example #8
0
        private async void LoadTempIteration()
        {
            var directory = Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Iterations", "Common"));

            LocalStorageProvider provider = new LocalStorageProvider();
            StorageResult result = await provider.LoadTempIteration(directory.FullName);

            if (result.Result != null)
            {
                Iteration iteration = JsonConvert.DeserializeObject<Iteration>((string)result.Result);

                if (iteration != null && iteration.Duties != null && iteration.Duties.Count > 0)
                {
                    Provider.SetIteration(iteration);
                    NotifyPropertyChanged(() => CurrentDuty);
                    NotifyPropertyChanged(() => CurrentDutyGroup);

                    _LoadedFromTemp = true;

                    SetAndStartTimer();
                }
            }
        }