private async void LocalStorageSettingsRetriever()
{
MessengerInstance.Send(new NotificationMessage("ProgressBarEnable"));
try
{
var applicationData = ApplicationData.Current;
var localsettings = applicationData.LocalSettings;
if (localsettings.Values == null) return;
if (localsettings.Values.ContainsKey("FirstContactName"))
FirstContactName = localsettings.Values["FirstContactName"] as string;
if (localsettings.Values.ContainsKey("SecondContactName"))
SecondContactName = localsettings.Values["SecondContactName"] as string;
if (localsettings.Values.ContainsKey("ThirdContactName"))
ThirdContactName = localsettings.Values["ThirdContactName"] as string;
if (localsettings.Values.ContainsKey("FacebookConnect"))
FacebookConnected = localsettings.Values["FacebookConnect"] as string;
if (localsettings.Values.ContainsKey("TwitterConnect"))
TwitterConnected = localsettings.Values["TwitterConnect"] as string;
if (localsettings.Values.ContainsKey("ThemeColorPrimary"))
_themeColorPrimary = localsettings.Values["ThemeColorPrimary"] as string;
if (localsettings.Values.ContainsKey("ThemeColorSecondary"))
_themeColorSecondary = localsettings.Values["ThemeColorSecondary"] as string;
if (localsettings.Values.ContainsKey("ToastNotification"))
_notificationStatus = localsettings.Values["ToastNotification"] as string;
else
{
localsettings.Values.Add("ToastNotification", "Off");
_notificationStatus = "Off";
}
if (localsettings.Values.ContainsKey("TimerTime"))
SliderValue = (double) localsettings.Values["TimerTime"];
if (localsettings.Values.ContainsKey("MessageToSend"))
MessageBox = localsettings.Values["MessageToSend"] as string;
IsAppFirstTimeOn1 = true;
if (_themeColorPrimary == "#237ba0")
{
ToggleSwitchIsOn = false;
}
else if (_themeColorPrimary == "#f25f5c")
{
ToggleSwitchIsOn = true;
IsAppFirstTimeOn = true;
}
const string taskName = "ActionCenterToastMaker";
var backgroundAccessStatus = await BackgroundExecutionManager.RequestAccessAsync();
if (backgroundAccessStatus != BackgroundAccessStatus.AllowedMayUseActiveRealTimeConnectivity &&
backgroundAccessStatus != BackgroundAccessStatus.AllowedWithAlwaysOnRealTimeConnectivity) return;
foreach (var task in BackgroundTaskRegistration.AllTasks)
{
ToastToggleSwitchIsOn = task.Value.Name == taskName;
if (ToastToggleSwitchIsOn)
{
_notificationStatus = "On";
break;
}
_notificationStatus = "Off";
}
if (_notificationStatus == "Off")
{
ToastToggleSwitchIsOn = false;
}
else if (_notificationStatus == "On")
{
ToastToggleSwitchIsOn = true;
}
MessageEditIconVisibility = Visibility.Visible;
MessageSaveIconVisibility = Visibility.Collapsed;
IsMessageBoxDisabled = true;
RaisePropertyChanged(() => FacebookPlusIconVisibility);
RaisePropertyChanged(() => FacebookRemoveIconVisibility);
RaisePropertyChanged(() => FirstContactName);
RaisePropertyChanged(() => SecondContactName);
RaisePropertyChanged(() => ThirdContactName);
RaisePropertyChanged(() => ToggleSwitchIsOn);
RaisePropertyChanged(() => ToastToggleSwitchIsOn);
RaisePropertyChanged(() => SliderValue);
RaisePropertyChanged(()=> MessageEditIconVisibility);
RaisePropertyChanged(()=>MessageSaveIconVisibility);
RaisePropertyChanged(()=>IsMessageBoxDisabled);
RaisePropertyChanged(()=> MessageBox);
}
catch (Exception e)
{
Debug.WriteLine(e);
}
MessengerInstance.Send(new NotificationMessage("ProgressBarDisable"));
}