コード例 #1
0
    public static void SerializeDiaryEntryCollection(DiaryEntryCollection collection, string filename)
    {
        DataContractSerializer x = new DataContractSerializer(typeof(DiaryEntryCollection));

        FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.Write);
        x.WriteObject(fs, collection);

        fs.Close();
    }
コード例 #2
0
    public static void SerializeDiaryEntryCollection(DiaryEntryCollection collection, string filename)
    {
        DataContractSerializer x = new DataContractSerializer(typeof(DiaryEntryCollection));

        FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.Write);

        x.WriteObject(fs, collection);

        fs.Close();
    }
コード例 #3
0
    public static DiaryEntryCollection DeserializeDiaryEntryCollection(string filename)
    {
        if (!FileManager.Exists(filename))
        {
            // No collection exists - initialise a new one now
            return(new DiaryEntryCollection(DateTime.Now));
        }

        DataContractSerializer x = new DataContractSerializer(typeof(DiaryEntryCollection));

        FileStream           fs         = new FileStream(filename, FileMode.Open, FileAccess.Read);
        DiaryEntryCollection collection = x.ReadObject(fs) as DiaryEntryCollection;

        fs.Close();

        return(collection);
    }
コード例 #4
0
        private void InitDiary()
        {
            diaryConfig          = DiaryManager.ReadConfig();
            diaryEntryCollection = DiaryEntryCollection.Load();

            log.Write("Initialised Diary.");


            DateTime now   = DateTime.Now;
            DateTime start = diaryConfig.StartDate;

            bool configured = DiaryManager.ConfigExists();

            if (configured)
            {
                welcomeText(true);
            }


            if (now.DayOfYear - start.DayOfYear > 7)
            {
                // We're in week 2 now
                //button_nextWeek.Background = (SolidColorBrush)Resources["Colour6"];

                selectedWeek = 2;
            }
            else
            {
                // Still in week 1
                //button_prevWeek.Background = (SolidColorBrush)Resources["Colour6"];

                selectedWeek = 1;
            }

            // Update diary UI
            UpdateDiaryUI();

            //editingNote = false;
        }
コード例 #5
0
        private void InitDiary()
        {
            diaryConfig = DiaryManager.ReadConfig();
            diaryEntryCollection = DiaryEntryCollection.Load();

            log.Write("Initialised Diary.");
            

            DateTime now = DateTime.Now;
            DateTime start = diaryConfig.StartDate;

            bool configured = DiaryManager.ConfigExists();

            if (configured)
                welcomeText(true);
            

            if (now.DayOfYear - start.DayOfYear > 7)
            {
                // We're in week 2 now
                //button_nextWeek.Background = (SolidColorBrush)Resources["Colour6"];

                selectedWeek = 2;
            }
            else
            {
                // Still in week 1
                //button_prevWeek.Background = (SolidColorBrush)Resources["Colour6"];

                selectedWeek = 1;
            }

            // Update diary UI
            UpdateDiaryUI();

            //editingNote = false;
        }