Exemplo n.º 1
0
        public void SaveData(DepartureTimeData data, DepartureTimeLanguage language)
        {
            XDocument document = GetElements();

            document.Root.Element(_BaliseWH).Value  = data.WorkingHours.ToString("hh\\:mm");
            document.Root.Element(_BaliseBGC).Value = ColorsHelper.ColorToString(data.BgColor);
            document.Root.Element(_BaliseTC).Value  = ColorsHelper.ColorToString(data.TxtColor);
            document.Root.Element(_BaliseLN).Value  = language.CurrentLanguage;
            document.Root.Element(_BaliseFT).Value  = data.SelectedFont;


            DependencyService.Get <IFileReadWrite>().WriteData(_fileConfigID, document.ToString());
        }
Exemplo n.º 2
0
        public DepartureTimeVM(IDataProvider data)
        {
            _data            = data.GetData();
            _currentLanguage = data.GetCurrentLanguage();
            _languages       = data.GetLanguages();
            _languageList    = _languages.AvailableLanguage;
            Language         = _languages.GetLanguageDic(LanguageLabel);



            SetNotification = new Command(() =>
            {
                CrossLocalNotifications.Current.Show("Departure Time - Minimum Time Reached", "You can Go now !!!", 101, BuildNotificationTime());
            });

            MyItemsSource = new ObservableCollection <View>()
            {
                new Main(),
                new Settings()
            };

            MyCommand = new Command(() =>
            {
                Debug.WriteLine("Position selected.");
            });

            InvertColor = new Command(() =>
            {
                Color TmpColor      = UserBackgroundColor;
                UserBackgroundColor = UserTextColor;
                UserTextColor       = TmpColor;
            });

            Save = new Command(() =>
            {
                data.SaveData(_data, _currentLanguage);
            });
        }
Exemplo n.º 3
0
        //Get application data from config file

        public DepartureTimeData GetData()
        {
            DepartureTimeData data     = new DepartureTimeData();
            FontTypeConverter fontType = new FontTypeConverter();

            VerifyDocuments();

            data.WorkingHours = TimeSpan.Parse((string)GetDataFromXML(_BaliseWH));
            data.BgColor      = ColorsHelper.StringToColor((string)GetDataFromXML(_BaliseBGC));
            data.TxtColor     = ColorsHelper.StringToColor((string)GetDataFromXML(_BaliseTC));
            string selectedFont = (string)GetDataFromXML(_BaliseFT);

            if (selectedFont == "Default")
            {
                data.SelectedFont = "";
            }
            else
            {
                data.SelectedFont = selectedFont;
            }

            return(data);
        }