示例#1
0
        public async Task <bool> AddSiteFormSave()
        {
            ShowRunning();

            var listingItem = new KeepAliveListingItem {
                Description = AddSite_SiteAddress,
                ID          = Guid.NewGuid(),
                IsEnabled   = AddSite_Enable,
                LastReport  = DateTime.MinValue,
            };

            KeepAliveListing.Add(listingItem);

            var mainItem = new KeepAliveItem(listingItem)
            {
                AlertOnFailure = AddSite_EnableFailureAlert,
                ConsectutiveFailuresAllowed = AddSite_AllowableFailuresBeforeAlert,
                Interval = AddSite_Interval
            };

            var result = await _baseFileIO.WriteFile(ASSET_TYPES.KEEP_ALIVE_LISTING, KeepAliveListing.ToList());

            await _baseFileIO.WriteFile(ASSET_TYPES.KEEP_ALIVE_ITEM, mainItem, objectGUID : listingItem.ID);

            HideRunning();

            return(result.Value);
        }
示例#2
0
        public async Task <bool> LoadData(Guid objectGUID)
        {
            ShowRunning();

            var data = await _baseFileIO.GetFile <KeepAliveItem>(ASSET_TYPES.KEEP_ALIVE_ITEM, objectGUID : objectGUID);

            if (!data.HasError)
            {
                Item = data.Value;
            }

            HideRunning();

            return(data.Value != null);
        }