private void RecentCommandReciever()
        {
            List <ManifestModel> collection;

            try
            {
                ManifestCollection.Clear();
                Loader.StartLoading();
                var RealmDb = Realm.GetInstance(RealmDbManager.GetRealmDbConfig());
                collection = RealmDb.All <ManifestModel>().Where(x => x.SubmittedDate == DateTimeOffset.UtcNow.Date && x.IsDraft == false && x.IsQueue == false).ToList();
                AssignColletionToManifest(collection);
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
            }
            finally
            {
                Loader.StopLoading();
                collection = null;
            }

            RecentTextColor       = "White";
            RecentBackgroundColor = "#4E6388";
            QueuedTextColor       = "#4E6388";
            QueuedBackgroundColor = "Transparent";
            DraftTextColor        = "#4E6388";
            DraftBackgroundColor  = "Transparent";
        }
        private void QueuedCommandReciever()
        {
            List <ManifestModel> collection;

            try
            {
                ManifestCollection.Clear();
                Loader.StartLoading();
                var RealmDb = Realm.GetInstance(RealmDbManager.GetRealmDbConfig());
                collection = RealmDb.All <ManifestModel>().Where(x => x.IsDraft == false && x.IsQueue == true).ToList();
                AssignColletionToManifest(collection);
            }
            catch (Exception ex)
            {
                Debug.Write(ex.Message);
            }
            finally
            {
                Loader.StopLoading();
                collection = null;
            }

            QueuedTextColor       = "White";
            QueuedBackgroundColor = "#4E6388";
            DraftTextColor        = "#4E6388";
            DraftBackgroundColor  = "Transparent";
            RecentTextColor       = "#4E6388";
            RecentBackgroundColor = "Transparent";
        }
Exemple #3
0
        public Task LoadManifestAsync(ManifestCollection manifest, string manifestPath)
        {
            var manifestInfo = new FileInfo(manifestPath);

            if (!manifestInfo.Exists)
            {
                return(Task.CompletedTask);
            }

            var jsonData = File.ReadAllText(manifestPath);
            var items    = JsonConvert.DeserializeObject <ManifestItem[]>(jsonData);

            manifest.Clear();
            manifest.AddRange(items);
            return(Task.CompletedTask);
        }
Exemple #4
0
        public async Task ReloadAsync()
        {
            //load from the file
            var manifestPath = Path.Combine(_configManager.SyncDirectory, Constants.ManifestFileName);

            await _semaphoreSlim.WaitAsync();

            try
            {
                //empty the collection before reloading
                _manifestCollection.Clear();
                await _manifestBuilder.LoadManifestAsync(_manifestCollection, manifestPath);
            }
            finally
            {
                _semaphoreSlim.Release();
            }
        }
        public Task LoadManifestAsync(ManifestCollection manifest, string manifestPath)
        {
            var manifestInfo = new FileInfo(manifestPath);

            if (!manifestInfo.Exists)
            {
                return(Task.CompletedTask);
            }

            using (Stream stream = File.Open(manifestPath, FileMode.Open))
            {
                var binaryFormatter = new BinaryFormatter();
                var temp            = (ManifestItem[])binaryFormatter.Deserialize(stream);
                manifest.Clear();
                manifest.AddRange(temp);
            }

            return(Task.CompletedTask);
        }
        internal void LoadDraftManifestAsync()
        {
            List <ManifestModel> collection;

            try
            {
                ManifestCollection.Clear();
                Loader.StartLoading();
                var RealmDb = Realm.GetInstance(RealmDbManager.GetRealmDbConfig());
                collection = RealmDb.All <ManifestModel>().Where(x => x.IsDraft == true && x.IsQueue == false).ToList();
                AssignColletionToManifest(collection);
            }
            catch (Exception ex)
            {
                Debug.Write(ex.Message);
            }
            finally
            {
                Loader.StopLoading();
                collection = null;
            }
        }