Coding4Fun.Toolkit.Storage Samples

Sep 26, 2013 at 12:19 AM
Where I can find some samples of using the NuGet package Coding4Fun.Toolkit.Storage for Windows Phone?
Coordinator
Sep 26, 2013 at 4:49 AM
tester app checked in has samples.
private void LoadClick(object sender, RoutedEventArgs e)
        {
            var data = Serializer.Open<TestSerializeClass>(MyDataFileName);

            stringData.Text = (!string.IsNullOrEmpty(data.StringData)) ? data.StringData : string.Empty;
            intData.Text = data.IntData.ToString(CultureInfo.InvariantCulture);
            dateTimeData.Value = data.DateTimeData;
            timeSpanData.Value = data.TimeSpanData;
        }

        private void SaveClick(object sender, RoutedEventArgs e)
        {
            var data = new TestSerializeClass();

            data.StringData = stringData.Text;

            int tempInt;
            int.TryParse(intData.Text, out tempInt);
            data.IntData = tempInt;

            if (dateTimeData.Value != null) 
                data.DateTimeData = dateTimeData.Value.Value;

            if (timeSpanData.Value != null) 
                data.TimeSpanData = timeSpanData.Value.Value;

            Serializer.Save(MyDataFileName, data);

            var prompt = new MessagePrompt {Title = "Saved", Message = "data saved"};
            prompt.Show();
        }

        private void ClearClick(object sender, RoutedEventArgs e)
        {
            stringData.Text = "";
            intData.Text = "";
            dateTimeData.Value = null;
            timeSpanData.Value = null;
        }

        private void DeleteClick(object sender, RoutedEventArgs e)
        {
            PlatformFileAccess.DeleteFile(MyDataFileName);

            var prompt = new MessagePrompt { Title = "Deleted", Message = "data deleted" };
            prompt.Show();
        }