示例#1
0
        public PreferencesViewModel()
        {
            ChangePageCommand = new AsyncRelayCommand(ChangePage);
            RemovePageCommand = new RelayCommand(RemovePage);
            AddPageCommand    = new RelayCommand <string>(async(path) => await AddPage(path));

            DefaultLanguages = App.AppSettings.DefaultLanguages;
            Terminals        = App.TerminalController.Model.Terminals;

            DateTimeOffset sampleDate1 = DateTime.Now;
            DateTimeOffset sampleDate2 = new DateTime(sampleDate1.Year - 5, 12, 31, 14, 30, 0);
            var            styles      = new TimeStyle[] { TimeStyle.Application, TimeStyle.System, TimeStyle.Universal };

            DateFormats = styles.Select(style => new DateFormatItem(style, sampleDate1, sampleDate2)).ToList();

            dispatcherQueue = DispatcherQueue.GetForCurrentThread();

            EditTerminalApplicationsCommand      = new AsyncRelayCommand(LaunchTerminalsConfigFile);
            OpenFilesAtStartupCommand            = new AsyncRelayCommand(OpenFilesAtStartup);
            App.TerminalController.ModelChanged += ReloadTerminals;

            if (UserSettingsService.PreferencesSettingsService.TabsOnStartupList != null)
            {
                PagesOnStartupList = new ObservableCollection <PageOnStartupViewModel>(UserSettingsService.PreferencesSettingsService.TabsOnStartupList.Select((p) => new PageOnStartupViewModel(p)));
            }
            else
            {
                PagesOnStartupList = new ObservableCollection <PageOnStartupViewModel>();
            }

            PagesOnStartupList.CollectionChanged += PagesOnStartupList_CollectionChanged;

            _ = InitStartupSettingsRecentFoldersFlyout();
            _ = DetectOpenFilesAtStartup();
        }
示例#2
0
        protected override void WriteKeys(Newtonsoft.Json.JsonWriter writer)
        {
            if (DateStyle != FieldDateTimeStyle.Unspecified)
            {
                writer.WritePropertyName("dateStyle");
                writer.WriteValue(DateStyle.ToString());
            }

            if (TimeStyle != FieldDateTimeStyle.Unspecified)
            {
                writer.WritePropertyName("timeStyle");
                writer.WriteValue(TimeStyle.ToString());
            }

            if (IsRelative.HasValue)
            {
                writer.WritePropertyName("isRelative");
                writer.WriteValue(IsRelative.Value);
            }

            if (IgnoresTimeZone.HasValue)
            {
                writer.WritePropertyName("ignoresTimeZone");
                writer.WriteValue(IgnoresTimeZone.Value);
            }
        }
示例#3
0
        //RITE.ID -> numBldgs -> <timestamp -> list of loss>

        //public GUInputGenerator(long conID, COLCollection _COLSet, TimeStyle _timestyle, LossStyle _lossstyle)
        //{
        //    PartitionDataAdpator PData = new PartitionDataAdpator(PD);
        //    expData = PData.GetExposureAdaptor(conID);
        //    subperils = _COLSet.GetSubperils();
        //    timestyle = _timestyle;
        //    lossstyle = _lossstyle;

        //}

        public GUInputGenerator(ExposureDataAdaptor _expData, HashSet <string> _subperils, TimeStyle _timestyle, LossStyle _lossstyle)
        {
            expData   = _expData;
            subperils = _subperils;
            timestyle = _timestyle;
            lossstyle = _lossstyle;
        }
示例#4
0
 public GUInputGeneratorFactory(PartitionData PD, HashSet <string> _subperils, SubSamplingAnalysisSetting subSmaplingSettings, TimeStyle _timestyle, LossStyle _lossstyle)
 {
     PData            = new PartitionDataAdpator(PD, subSmaplingSettings);
     NeedDisposePData = true;
     subperils        = _subperils;
     timestyle        = _timestyle;
     lossstyle        = _lossstyle;
 }
示例#5
0
 public GUInputGeneratorFactory(PartitionDataAdpator _PData, HashSet <string> _subperils, TimeStyle _timestyle, LossStyle _lossstyle)
 {
     PData            = _PData;
     NeedDisposePData = false;
     subperils        = _subperils;
     timestyle        = _timestyle;
     lossstyle        = _lossstyle;
 }
示例#6
0
 public GUInputGeneratorFactory(PartitionDataAdpator _PData, COLCollection _COLSet, TimeStyle _timestyle, LossStyle _lossstyle)
 {
     PData            = _PData;
     NeedDisposePData = false;
     subperils        = _COLSet.GetSubperils();
     timestyle        = _timestyle;
     lossstyle        = _lossstyle;
 }
示例#7
0
        protected string GetPattern(TagModel model, DateTimeFormatInfo format)
        {
            DateType  type      = GetAs <DateType>(Type, model, DateType.Both).Value;
            DateStyle dateStyle = GetAs <DateStyle>(DateStyle, model, FormatTags.DateStyle.Default).Value;
            TimeStyle timeStyle = GetAs <TimeStyle>(TimeStyle, model, FormatTags.TimeStyle.Default).Value;

            return(GetAsString(Pattern, model) ?? ConstructPattern(type, dateStyle, timeStyle, format));
        }
示例#8
0
 public GUInputGeneratorFactory(PartitionData PD, COLCollection _COLSet, SubSamplingAnalysisSetting subSmaplingSettings, TimeStyle _timestyle, LossStyle _lossstyle)
 {
     PData            = new PartitionDataAdpator(PD, subSmaplingSettings);
     NeedDisposePData = true;
     subperils        = _COLSet.GetSubperils();
     timestyle        = _timestyle;
     lossstyle        = _lossstyle;
 }
示例#9
0
        //RITE.ID -> numBldgs -> <timestamp -> list of loss>

        public GUInputGenerator(PartitionData PD, long conID, COLCollection _COLSet, TimeStyle _timestyle, LossStyle _lossstyle)
        {
            PartitionDataAdpator PData = new PartitionDataAdpator(PD);

            expData   = PData.GetExposureAdaptor(conID);
            COLSet    = _COLSet;
            timestyle = _timestyle;
            lossstyle = _lossstyle;
            //    Dictionary<long, Dictionary<int, Tuple<int, List<float>>>> GULosses = new Dictionary<long, Dictionary<int, Tuple<int, List<float>>>>();
        }
示例#10
0
 public PeriodLossTable(int pid, COLCollection _COLSet, TimeStyle _timestyle, LossStyle _lossstyle, DateTime _start, DateTime _end)
 {
     PID       = pid;
     Start     = _start;
     End       = _end;
     COLSet    = _COLSet;
     timestyle = _timestyle;
     lossstyle = _lossstyle;
     PGULosses = new List <Dictionary <string, Dictionary <int, Dictionary <long, Tuple <double, uint, List <float> > > > > >();
 }
示例#11
0
        public PLTGenerator(PartitionData _PD, long _conID, int pid, COLCollection _COLSet, TimeStyle _timestyle, LossStyle _lossStyle, DateTime _start, DateTime _end)
        {
            PartitionDataAdpator PData = new PartitionDataAdpator(_PD);

            expData   = PData.GetExposureAdaptor(conID);
            PD        = _PD;
            conID     = _conID;
            COLSet    = _COLSet;
            timestyle = _timestyle;
            lossStyle = _lossStyle;
            PLT       = new PeriodLossTable(pid, _COLSet, _timestyle, _lossStyle, _start, _end);
        }
示例#12
0
        public Personalization()
        {
            InitializeComponent();

            //Load Theme Style
            var _themeval = Enum.GetValues(typeof(ThemeStyle)).Cast <ThemeStyle>();

            ThemeChooser.ItemsSource = _themeval.ToList();

            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            if (localSettings.Values["theme"] != null)
            {
                ThemeStyle _selectedTheme = localSettings.Values["theme"].ToString().Equals("Default") ? ThemeStyle.System : Enum.Parse <ThemeStyle>(localSettings.Values["theme"].ToString());
                ThemeChooser.SelectedIndex = _themeval.ToList().IndexOf(_selectedTheme);
                ThemeChooser.Loaded       += (s, e) =>
                {
                    ThemeChooser.SelectionChanged += async(s1, e1) =>
                    {
                        localSettings.Values["theme"] = e1.AddedItems[0].Equals("System") ? "Default" : e1.AddedItems[0].ToString();
                        await RestartReminder.Fade(value : 1.0f, duration : 1500, delay : 0).StartAsync();

                        await RestartReminder.Fade(value : 0.0f, duration : 1500, delay : 0).StartAsync();
                    };
                };
            }

            //Load App Time Style
            var _dateformatval = Enum.GetValues(typeof(TimeStyle)).Cast <TimeStyle>();

            DateFormatChooser.ItemsSource = _dateformatval.ToList();

            if (localSettings.Values["datetimeformat"] != null)
            {
                TimeStyle _selectedFormat = Enum.Parse <TimeStyle>(localSettings.Values["datetimeformat"].ToString());
                DateFormatChooser.SelectedIndex = _dateformatval.ToList().IndexOf(_selectedFormat);
                DateFormatChooser.Loaded       += (s, e) =>
                {
                    DateFormatChooser.SelectionChanged += async(s1, e1) =>
                    {
                        localSettings.Values["datetimeformat"] = e1.AddedItems[0].ToString();
                        TimeFormatReminder.Visibility          = Visibility.Visible;
                        await TimeFormatReminder.Fade(value : 1.0f, duration : 1500, delay : 0).StartAsync();

                        await TimeFormatReminder.Fade(value : 0.0f, duration : 1500, delay : 0).StartAsync();
                    };
                };
            }
        }
示例#13
0
        private string ConstructPattern(DateType type, DateStyle dateStyle, TimeStyle timeStyle,
                                        DateTimeFormatInfo format)
        {
            var sb = new StringBuilder();

            if (type != DateType.Time)
            {
                sb.Append(dateStyle == FormatTags.DateStyle.Long ? format.LongDatePattern : format.ShortDatePattern);
            }
            if (type == DateType.Both)
            {
                sb.Append(" ");
            }
            if (type != DateType.Date)
            {
                sb.Append(timeStyle == FormatTags.TimeStyle.Long ? format.LongTimePattern : format.ShortTimePattern);
            }
            return(sb.ToString());
        }
示例#14
0
        /// <summary>
        /// ctr.
        /// </summary>
        /// <param name="start"></param>
        /// <param name="time"></param>
        /// <param name="interval"></param>
        /// <param name="timeStyle"></param>
        public TimeLine(DateTime start, DateTime time, IntervalParameter interval, TimeStyle timeStyle)
        {
            this.Start         = start;
            this.Time          = time;
            this.IntervalStyle = interval.Style;
            switch (interval.Style)
            {
            case eInterval.Hour:
                double hours = (time - start).TotalHours;
                this.Index = hours / interval.Value;
                break;

            case eInterval.Minute:
                double minutes = (time - start).TotalMinutes;
                this.Index = minutes / interval.Value;
                break;
            }

            this.TimeStyle = timeStyle;
        }
示例#15
0
        public Appearance()
        {
            InitializeComponent();

            //Load Theme Style
            var _themeval = Enum.GetValues(typeof(ThemeStyle)).Cast <ThemeStyle>();

            ThemeChooser.ItemsSource = _themeval.ToList();
            ThemeStyle _selectedTheme = App.AppSettings.ThemeValue;

            ThemeChooser.SelectedIndex = _themeval.ToList().IndexOf(_selectedTheme);
            ThemeChooser.Loaded       += (s, e) =>
            {
                ThemeChooser.SelectionChanged += async(s1, e1) =>
                {
                    switch (e1.AddedItems[0].ToString())
                    {
                    case "System":
                        App.AppSettings.ThemeValue = ThemeStyle.System;
                        break;

                    case "Light":
                        App.AppSettings.ThemeValue = ThemeStyle.Light;
                        break;

                    case "Dark":
                        App.AppSettings.ThemeValue = ThemeStyle.Dark;
                        break;
                    }

                    //await RestartReminder.Fade(value: 1.0f, duration: 1500, delay: 0).StartAsync();
                    //await RestartReminder.Fade(value: 0.0f, duration: 1500, delay: 0).StartAsync();
                };
            };

            //Load App Time Style
            var _dateformatval = Enum.GetValues(typeof(TimeStyle)).Cast <TimeStyle>();

            DateFormatChooser.ItemsSource = _dateformatval.ToList();

            TimeStyle _selectedFormat = App.AppSettings.DisplayedTimeStyle;

            DateFormatChooser.SelectedIndex = _dateformatval.ToList().IndexOf(_selectedFormat);
            DateFormatChooser.Loaded       += (s, e) =>
            {
                DateFormatChooser.SelectionChanged += async(s1, e1) =>
                {
                    switch (e1.AddedItems[0].ToString())
                    {
                    case "Application":
                        App.AppSettings.DisplayedTimeStyle = TimeStyle.Application;
                        break;

                    case "System":
                        App.AppSettings.DisplayedTimeStyle = TimeStyle.System;
                        break;
                    }

                    //await TimeFormatReminder.Fade(value: 1.0f, duration: 1500, delay: 0).StartAsync();
                    //await TimeFormatReminder.Fade(value: 0.0f, duration: 1500, delay: 0).StartAsync();
                };
            };


            AcrylicSidebarSwitch.IsOn = App.AppSettings.SidebarThemeMode.Equals(SidebarOpacity.Opaque) ? false : true;

            AcrylicSidebarSwitch.Loaded += (sender, args) =>
            {
                AcrylicSidebarSwitch.Toggled += (o, eventArgs) =>
                {
                    if (((ToggleSwitch)o).IsOn)
                    {
                        App.AppSettings.SidebarThemeMode = SidebarOpacity.AcrylicEnabled;
                    }
                    else
                    {
                        App.AppSettings.SidebarThemeMode = SidebarOpacity.Opaque;
                    }
                };
            };
        }
示例#16
0
        public VectorGUInputGeneratorFactory(PartitionData PD, HashSet <string> _subperils, TimeStyle _timestyle, LossStyle _lossstyle, bool UseAggregatedRITEs, SubSamplingAnalysisSetting subSamplingSettings)
        {
            subperils = _subperils;
            bool subperilsSupported = subperils.All(sp => subperilConfig.GetSubPerilList().Contains(sp));

            if (!subperilsSupported)
            {
                throw new InvalidOperationException("Subperils specified cannot be supported at this time");
            }

            pData            = new PartitionDataAdpator(PD, subSamplingSettings);
            GeneratorFactory = new GUInputGeneratorFactory(pData, subperils, _timestyle, _lossstyle);
        }
 public IDateTimeFormatter GetDateTimeFormatter(TimeStyle timeStyle) => timeStyle switch
 {
示例#18
0
 public IntlDateTime(DateStyle date, TimeStyle time = TimeStyle.Undefined) : base(IntlFormat.DateTime)
 {
     Date = date;
     Time = time;
 }
示例#19
0
 public PLTGenertorFactory(PartitionData PD, COLCollection _COLSet, SubSamplingAnalysisSetting subSamplingSettings, DateTime _start, TimeStyle _timestyle, LossStyle _lossstyle)
 {
     Start            = _start;
     End              = _start.AddYears(6);
     pData            = new PartitionDataAdpator(PD, subSamplingSettings);
     GeneratorFactory = new GUInputGeneratorFactory(pData, _COLSet, _timestyle, _lossstyle);
 }
示例#20
0
        public Appearance()
        {
            InitializeComponent();

            List <string> _themeval = new List <string>();

            _themeval.Add("SystemTheme".GetLocalized());
            _themeval.Add("LightTheme".GetLocalized());
            _themeval.Add("DarkTheme".GetLocalized());
            ThemeChooser.ItemsSource = _themeval;

            ThemeChooser.SelectedIndex = (int)Enum.Parse(typeof(ElementTheme), ThemeHelper.RootTheme.ToString());
            ThemeChooser.Loaded       += (s, e) =>
            {
                ThemeChooser.SelectionChanged += (s1, e1) =>
                {
                    var themeComboBox = s1 as ComboBox;

                    switch (themeComboBox.SelectedIndex)
                    {
                    case 0:
                        ThemeHelper.RootTheme = ElementTheme.Default;
                        break;

                    case 1:
                        ThemeHelper.RootTheme = ElementTheme.Light;
                        break;

                    case 2:
                        ThemeHelper.RootTheme = ElementTheme.Dark;
                        break;
                    }
                };
            };

            //Load App Time Style
            List <string> _dateformatval = new List <string>();

            _dateformatval.Add("ApplicationTimeStye".GetLocalized());
            _dateformatval.Add("SystemTimeStye".GetLocalized());
            DateFormatChooser.ItemsSource = _dateformatval;

            TimeStyle _selectedFormat = AppSettings.DisplayedTimeStyle;

            DateFormatChooser.SelectedIndex = (int)Enum.Parse(typeof(TimeStyle), _selectedFormat.ToString());
            DateFormatChooser.Loaded       += (s, e) =>
            {
                DateFormatChooser.SelectionChanged += (s1, e1) =>
                {
                    var timeStyleComboBox = s1 as ComboBox;

                    switch (timeStyleComboBox.SelectedIndex)
                    {
                    case 0:
                        AppSettings.DisplayedTimeStyle = TimeStyle.Application;
                        break;

                    case 1:
                        AppSettings.DisplayedTimeStyle = TimeStyle.System;
                        break;
                    }

                    //await TimeFormatReminder.Fade(value: 1.0f, duration: 1500, delay: 0).StartAsync();
                    //await TimeFormatReminder.Fade(value: 0.0f, duration: 1500, delay: 0).StartAsync();
                };
            };
        }
示例#21
0
 public PLTGenertorFactory(PartitionData PD, HashSet <string> _subperils, SubSamplingAnalysisSetting subSamplingSettings, DateTime _start, TimeStyle _timestyle, LossStyle _lossstyle)
 {
     Start            = _start;
     End              = _start.AddYears(6);
     pData            = new PartitionDataAdpator(PD, subSamplingSettings);
     GeneratorFactory = new GUInputGeneratorFactory(pData, _subperils, _timestyle, _lossstyle);
 }
示例#22
0
        public Appearance()
        {
            InitializeComponent();

            //Load Theme Style
            var _themeval = Enum.GetValues(typeof(ThemeStyle)).Cast <ThemeStyle>();

            ThemeChooser.ItemsSource = _themeval.ToList();
            ThemeStyle _selectedTheme = App.AppSettings.ThemeValue;

            ThemeChooser.SelectedIndex = _themeval.ToList().IndexOf(_selectedTheme);
            ThemeChooser.Loaded       += (s, e) =>
            {
                ThemeChooser.SelectionChanged += async(s1, e1) =>
                {
                    switch (e1.AddedItems[0].ToString())
                    {
                    case "System":
                        App.AppSettings.ThemeValue = ThemeStyle.System;
                        break;

                    case "Light":
                        App.AppSettings.ThemeValue = ThemeStyle.Light;
                        break;

                    case "Dark":
                        App.AppSettings.ThemeValue = ThemeStyle.Dark;
                        break;
                    }

                    //await RestartReminder.Fade(value: 1.0f, duration: 1500, delay: 0).StartAsync();
                    //await RestartReminder.Fade(value: 0.0f, duration: 1500, delay: 0).StartAsync();
                };
            };

            //Load App Time Style
            var _dateformatval = Enum.GetValues(typeof(TimeStyle)).Cast <TimeStyle>();

            DateFormatChooser.ItemsSource = _dateformatval.ToList();

            TimeStyle _selectedFormat = App.AppSettings.DisplayedTimeStyle;

            DateFormatChooser.SelectedIndex = _dateformatval.ToList().IndexOf(_selectedFormat);
            DateFormatChooser.Loaded       += (s, e) =>
            {
                DateFormatChooser.SelectionChanged += async(s1, e1) =>
                {
                    switch (e1.AddedItems[0].ToString())
                    {
                    case "Application":
                        App.AppSettings.DisplayedTimeStyle = TimeStyle.Application;
                        break;

                    case "System":
                        App.AppSettings.DisplayedTimeStyle = TimeStyle.System;
                        break;
                    }

                    //await TimeFormatReminder.Fade(value: 1.0f, duration: 1500, delay: 0).StartAsync();
                    //await TimeFormatReminder.Fade(value: 0.0f, duration: 1500, delay: 0).StartAsync();
                };
            };
        }