public async void deleteConfig(ConfigurationViewItem listViewItem, bool confirmation) { try { if (confirmation == true) { ContentDialogResult result = await new CustomDialog("Information", "Are you sure you want to delete this configuration?", true).ShowAsync(); if (result != ContentDialogResult.Primary) { return; } } string fullPath = folderPath + @"\" + listViewItem.configName + ".config"; LoggerFactory.debug(this, "Deleting the file at: " + fullPath); if (File.Exists(fullPath)) { File.Delete(fullPath); } saveItemList.Remove(saveItemList.Where(var => var.viewItem.configName == listViewItem.configName).First()); windowRef.configView.Items.Remove(listViewItem); } catch (Exception ex) { LoggerFactory.debug(this, "Exception: " + ex.Message); } }
//Very inefficient public ConfigurationSaveItem getSaveItem(ConfigurationViewItem viewItem) { return(JsonConvert.DeserializeObject <ConfigurationSaveItem>(File.ReadAllText(folderPath + @"\" + viewItem.configName + ".config"))); }