public override void AfterSelect(IUserIO handler, WidgetCfgSample <T> sample)
        {
            base.AfterSelect(handler, sample);

            if (sample.WidgetConfig.ClickAction.Type == ClickActionType.OpenOtherApp)
            {
                try
                {
                    var appAdapter = new OtherAppAdapter(AndroidHelpers.Tools.HelperContext);
                    int iApp       = AndroidHelpers.Tools.ShowSingleChoiseDlg(AndroidHelpers.Tools.HelperContext, "select", appAdapter).Result;
                    if (iApp < 0)
                    {
                        throw new Exception();
                    }
                    ApplicationInfo appInfo = appAdapter[iApp];

                    sample.WidgetConfig.ClickAction        = new ClickAction(ClickActionType.OpenOtherApp);
                    sample.WidgetConfig.ClickAction.Params = new string[] { "PackageName=" + appInfo.PackageName };
                    if (sample.WidgetConfig is WidgetCfg_ActionButton)
                    {
                        sample.WidgetConfig.WidgetTitle = appInfo.LoadLabel(Application.Context.PackageManager);
                    }
                }
                catch
                {
                    sample.WidgetConfig.ClickAction = new ClickAction(ClickActionType.OpenSettings);
                }
            }
        }
Exemple #2
0
        public WidgetCfgAssistant_ActionButton_OptionsBase(WidgetCfgSample <WidgetCfg_ActionButton> baseSample)
        {
            Title                 = localize.title_EditWidget;
            BaseSample            = baseSample;
            ShowPreviewImage      = false;
            ShowFirstPreviewImage = true;

            Samples.Add(new WidgetCfgSample <WidgetCfg_ActionButton>(localize.action_SaveAndQuit, BaseSample.GetConfigClone()));

            var cfg     = BaseSample.GetConfigClone();
            var cfgPrev = BaseSample.GetConfigClone();

            Samples.Add(new WidgetCfgSample <WidgetCfg_ActionButton>(localize.ActionButtonStyle, null, cfg, typeof(WidgetCfgAssistant_ActionButton_Icon), cfgPrev));

            cfg     = BaseSample.GetConfigClone();
            cfgPrev = BaseSample.GetConfigClone();
            cfgPrev.ColorTitleText = xColor.Pink;
            Samples.Add(new WidgetCfgSample <WidgetCfg_ActionButton>(localize.WidgetTitle, null, cfg, typeof(WidgetCfgAssistant_ActionButton_Title), cfgPrev));

            cfg     = BaseSample.GetConfigClone();
            cfgPrev = BaseSample.GetConfigClone();
            Samples.Add(new WidgetCfgSample <WidgetCfg_ActionButton>(localize.ClickAction, null, cfg, typeof(WidgetCfgAssistant_Universal_ClickAction <WidgetCfg_ActionButton>), cfgPrev));


            cfg     = BaseSample.GetConfigClone();
            cfgPrev = BaseSample.GetConfigClone();
            Samples.Add(new WidgetCfgSample <WidgetCfg_ActionButton>(localize.Theme, null, cfg, typeof(WidgetCfgAssistant_ActionButton_Theme), cfgPrev));

            NextStepAssistantType = null;
        }
Exemple #3
0
        public WidgetCfgAssistant_CalendarCircleWave_DayColors(WidgetCfgSample <WidgetCfg_CalendarCircleWave> baseSample)
        {
            Title       = localize.DayColors;
            AllowCustom = true;
            ShowColors  = true;
            BaseSample  = baseSample;

            var cfgTemplate = baseSample.GetConfigClone();

            int iClrs = cfgTemplate.DayBackgroundGradient.GradientS[0].CustomColors.Length;

            int   i1    = Math.Max(4 - iClrs, 0);
            int   i2    = Math.Min(4, i1 + iClrs - 1);
            float nLum1 = 0;
            float nLum2 = 0;

            if (iClrs == 1 && cfgTemplate.DayBackgroundGradient.GradientS[0].CustomColors.Length == 2)
            {
                if (cfgTemplate.DayBackgroundGradient.GradientS[0].CustomColors[0].Luminosity > cfgTemplate.DayBackgroundGradient.GradientS[0].CustomColors[1].Luminosity)
                {
                    nLum1 = .1F;
                    nLum2 = -.1F;
                }
                else
                {
                    nLum1 = -.1F;
                    nLum2 = .1F;
                }
            }

            int i = 0;

            foreach (var clrs in DynamicColors.SampleColorSetS)
            {
                i++;
                var           cfg   = (WidgetCfg_CalendarCircleWave)cfgTemplate.Clone();
                List <xColor> xclrs = new List <xColor>();

                for (int iClr = i1; iClr <= i2; iClr++)
                {
                    xclrs.Add(xColor.FromHex(clrs[iClr]));
                }
                if (iClrs == 1 && nLum1 != 0)
                {
                    var clr1 = xclrs[0].AddLuminosity(nLum1);
                    var clr2 = xclrs[0].AddLuminosity(nLum2);
                    xclrs.Clear();
                    xclrs.Add(clr1);
                    xclrs.Add(clr2);
                }
                cfg.DayBackgroundGradient = new DateGradient()
                {
                    GradientS = { new DynamicGradient(cfg.TimeUnit, xclrs.ToArray()) }
                };
                Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.text_Sample + " " + i, xclrs.ToArray(), cfg));
            }

            NextStepAssistantType = typeof(WidgetCfgAssistant_CalendarCircleWave_OptionsBase);
        }
Exemple #4
0
        public WidgetCfgAssistant_ActionButton_IconColor(WidgetCfgSample <WidgetCfg_ActionButton> baseSample)
        {
            Title       = localize.IconColor;
            BaseSample  = baseSample;
            AllowCustom = true;

            NextStepAssistantType = typeof(WidgetCfgAssistant_ActionButton_OptionsBase);
        }
Exemple #5
0
        public override void AfterSelect(IUserIO handler, WidgetCfgSample <WidgetCfg_CalendarCircleWave> sample)
        {
            base.AfterSelect(handler, sample);

            if (sample.WidgetConfig.DayBackgroundGradient.GradientS[0].CustomColors == null || sample.WidgetConfig.DayBackgroundGradient.GradientS[0].CustomColors.Length == 0)
            {
                NextStepAssistantType = typeof(WidgetCfgAssistant_CalendarCircleWave_OptionsBase);
            }
        }
Exemple #6
0
        public WidgetCfgAssistant_ActionButton_Title(WidgetCfgSample <WidgetCfg_ActionButton> baseSample)
        {
            Title      = localize.WidgetTitle;
            BaseSample = baseSample;

            var cfg = baseSample.GetConfigClone();

            NextStepAssistantType = typeof(WidgetCfgAssistant_ActionButton_OptionsBase);
        }
Exemple #7
0
        public WidgetCfgAssistant_CalendarCircleWave_Theme(WidgetCfgSample <WidgetCfg_CalendarCircleWave> baseSample)
        {
            Title = localize.Theme;

            foreach (var o in Enum.GetValues(typeof(WidgetTheme)))
            {
                var cfg = baseSample.GetConfigClone();
                cfg.SetTheme((WidgetTheme)o);
                Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(o.ToString(), cfg));
            }

            NextStepAssistantType = typeof(WidgetCfgAssistant_CalendarCircleWave_OptionsBase);
        }
Exemple #8
0
        public WidgetCfgAssistant_CalendarCircleWave_Length(WidgetCfgSample <WidgetCfg_CalendarCircleWave> baseSample)
        {
            Title      = localize.TimeSpan;
            BaseSample = baseSample;

            var cfg = baseSample.GetConfigClone();

            cfg.FirstDayType  = FirstDayType.WeekStart;
            cfg.TimeUnit      = TimeUnit.Week;
            cfg.TimeUnitCount = 2;
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.text_twoWeeks, cfg));

            cfg = baseSample.GetConfigClone();
            cfg.FirstDayType  = FirstDayType.WeekStart;
            cfg.TimeUnit      = TimeUnit.Week;
            cfg.TimeUnitCount = 3;
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.text_threeWeeks, cfg));

            cfg = baseSample.GetConfigClone();
            cfg.FirstDayType  = FirstDayType.MonthStart;
            cfg.TimeUnit      = TimeUnit.Month;
            cfg.TimeUnitCount = 1;
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.text_oneMonth, cfg));

            cfg = baseSample.GetConfigClone();
            cfg.FirstDayType  = FirstDayType.MonthStart;
            cfg.TimeUnit      = TimeUnit.Month;
            cfg.TimeUnitCount = 2;
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.text_twoMonths, cfg));

            cfg = baseSample.GetConfigClone();
            cfg.FirstDayType  = FirstDayType.MonthStart;
            cfg.TimeUnit      = TimeUnit.Month;
            cfg.TimeUnitCount = 3;
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.text_threeMonths, cfg));

            cfg = baseSample.GetConfigClone();
            cfg.FirstDayType  = FirstDayType.MonthStart;
            cfg.TimeUnit      = TimeUnit.Month;
            cfg.TimeUnitCount = WidgetCfgAssistantData_Calendar.CalendarModel.GetMonthsOfYear(WidgetCfgAssistantData_Calendar.CalendarModel.GetYearFromUtcDate(DateTime.Now).Year) / 2;
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(cfg.TimeUnitCount + " " + localize.Months, cfg));

            cfg = baseSample.GetConfigClone();
            cfg.FirstDayType  = FirstDayType.YearStart;
            cfg.TimeUnit      = TimeUnit.Year;
            cfg.TimeUnitCount = 1;
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.text_oneYear, cfg));

            NextStepAssistantType = typeof(WidgetCfgAssistant_CalendarCircleWave_OptionsBase);
        }
Exemple #9
0
        public override async void ExecCustom(IUserIO handler)
        {
            base.ExecCustom(handler);
            var clr = await handler.UserSelectColor(localize.IconColor);

            if (clr != null)
            {
                var cfg = BaseSample.GetConfigClone();
                cfg.IconColor = clr.Value;
                BaseSample    = new WidgetCfgSample <WidgetCfg_ActionButton>("custom", cfg);
            }

            handler.TriggerPositiveButtonClicked();
        }
Exemple #10
0
        public WidgetCfgAssistant_ActionButton_Theme(WidgetCfgSample <WidgetCfg_ActionButton> baseSample)
        {
            Title       = localize.Theme;
            BaseSample  = baseSample;
            AllowCustom = true;

            foreach (var o in Enum.GetValues(typeof(WidgetTheme)))
            {
                var cfg = baseSample.GetConfigClone();
                cfg.SetTheme((WidgetTheme)o);
                Samples.Add(new WidgetCfgSample <WidgetCfg_ActionButton>(o.ToString(), cfg));
            }

            NextStepAssistantType = typeof(WidgetCfgAssistant_ActionButton_OptionsBase);
        }
Exemple #11
0
        public WidgetCfgAssistant_ActionButton_AnimationRounds(WidgetCfgSample <WidgetCfg_ActionButton> baseSample)
        {
            Title            = localize.AnimationRounds;
            BaseSample       = baseSample;
            ShowPreviewImage = false;

            for (int i = 1; i <= (int)(baseSample.WidgetConfig.AnimationDuriation * 3); i++)
            {
                var cfg = baseSample.GetConfigClone();
                cfg.AnimationRounds = i;
                Samples.Add(new WidgetCfgSample <WidgetCfg_ActionButton>(string.Format(localize.nAnimationRounds, i), cfg));
            }

            NextStepAssistantType = typeof(WidgetCfgAssistant_ActionButton_OptionsBase);
        }
Exemple #12
0
        public override async void ExecCustom(IUserIO handler)
        {
            base.ExecCustom(handler);
            NextStepAssistantType = typeof(WidgetCfgAssistant_CalendarCircleWave_OptionsBase);
            var clr = await handler.UserSelectColor(localize.text_TodayColor);

            if (clr != null)
            {
                var cfg = BaseSample.GetConfigClone();
                cfg.ColorTodayBackground = clr.Value;
                BaseSample = new WidgetCfgSample <WidgetCfg_CalendarCircleWave>("custom", cfg);
            }

            NextStepAssistantType = typeof(WidgetCfgAssistant_CalendarCircleWave_OptionsBase);
            handler.TriggerPositiveButtonClicked();
        }
Exemple #13
0
        public override void AfterSelect(IUserIO handler, WidgetCfgSample <WidgetCfg_ActionButton> sample)
        {
            base.AfterSelect(handler, sample);
            if (sample.WidgetConfig.Style == ActionButton_Style.iChronEye && sample.WidgetConfig.AnimateOnFirstClick)
            {
                NextStepAssistantType = typeof(WidgetCfgAssistant_ActionButton_AnimationDuriation);
            }

            if (sample.WidgetConfig.Style == ActionButton_Style.Icon)
            {
                if (!sample.WidgetConfig.IconName.Contains("_clrd"))
                {
                    NextStepAssistantType = typeof(WidgetCfgAssistant_ActionButton_IconColor);
                }
            }
        }
Exemple #14
0
        public WidgetCfgAssistant_CalendarCircleWave_OptionsBase(WidgetCfgSample <WidgetCfg_CalendarCircleWave> baseSample)
        {
            Title                 = localize.title_EditWidget;
            BaseSample            = baseSample;
            ShowPreviewImage      = false;
            ShowFirstPreviewImage = true;

            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.action_SaveAndQuit, BaseSample.GetConfigClone()));

            var cfg     = BaseSample.GetConfigClone();
            var cfgPrev = BaseSample.GetConfigClone();

            if (cfgPrev.TimeUnit == TimeUnit.Month)
            {
                cfgPrev.TimeUnit      = TimeUnit.Week;
                cfgPrev.TimeUnitCount = 3;
            }
            else
            {
                cfgPrev.TimeUnit      = TimeUnit.Month;
                cfgPrev.TimeUnitCount = 3;
            }
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.TimeSpan, null, cfg, typeof(WidgetCfgAssistant_CalendarCircleWave_Length), cfgPrev));

            cfg     = BaseSample.GetConfigClone();
            cfgPrev = BaseSample.GetConfigClone();
            var clrs = DynamicColors.SampleColorSetS[5];

            cfgPrev.DayBackgroundGradient = new DateGradient()
            {
                GradientS = { new DynamicGradient(cfg.TimeUnit, new xColor[] { xColor.HotPink }) }
            };
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.DayColorType, null, cfg, typeof(WidgetCfgAssistant_CalendarCircleWave_DayColorType), cfgPrev));

            cfg     = BaseSample.GetConfigClone();
            cfgPrev = BaseSample.GetConfigClone();
            cfgPrev.ColorTodayBackground = xColor.HotPink;
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.text_TodayColor, null, cfg, typeof(WidgetCfgAssistant_CalendarCircleWave_TodayDayColor), cfgPrev));

            cfg = BaseSample.GetConfigClone();
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.Theme, null, cfg, typeof(WidgetCfgAssistant_CalendarCircleWave_Theme)));

            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.TitleClickAction, null, BaseSample.GetConfigClone(), typeof(WidgetCfgAssistant_Universal_ClickAction <WidgetCfg_CalendarCircleWave>)));

            NextStepAssistantType = null;
        }
Exemple #15
0
        public WidgetCfgAssistant_Calendar_Start(WidgetCfgSample <WidgetCfg_Calendar> baseSample)
        {
            Title = localize.CalendarType;

            //if (baseSample.WidgetConfig != null)
            //  Samples.Add(new WidgetCfgSample<WidgetCfg_Calendar>(localize.current, baseSample.GetConfigClone()));
            string c = localize.WidgetTitleAgenda;

            c = localize.WidgetTitleCircleWave;
            c = localize.WidgetTitleMonthView;
            c = localize.current;
            Samples.Add(new WidgetCfgSample <WidgetCfg_Calendar>(localize.WidgetTitleAgenda, new WidgetCfg_CalendarTimetable()));
            Samples.Add(new WidgetCfgSample <WidgetCfg_Calendar>(localize.WidgetTitleCircleWave, new WidgetCfg_CalendarCircleWave()));
            Samples.Add(new WidgetCfgSample <WidgetCfg_Calendar>(localize.WidgetTitleMonthView, new WidgetCfg_CalendarMonthView()));
            //if (WidgetCfgAssistantData_Calendar.DeletedWidgets.Count > 0)
            //  Samples.Add(new WidgetCfgSample<WidgetCfg_Calendar>(localize.DeletedWidgets, null));

            NextStepAssistantType = typeof(WidgetCfgAssistant_Calendar_Theme);
        }
Exemple #16
0
        public WidgetCfgAssistant_Calendar_WidgetTimeType(WidgetCfgSample <WidgetCfg_Calendar> baseSample)
        {
            Title                 = localize.HandColorTypes;
            BaseSample            = baseSample;
            ShowPreviewImage      = false;
            NextStepAssistantType = typeof(WidgetCfgAssistant_Calendar_OptionsBase);

            var cfg = BaseSample.GetConfigClone();

            cfg.WidgetTimeType = cfg.CurrentTimeType = TimeType.RealSunTime;
            Samples.Add(new WidgetCfgSample <WidgetCfg_Calendar>(localize.TimeType_RealSunTime, cfg));

            cfg = BaseSample.GetConfigClone();
            cfg.WidgetTimeType = cfg.CurrentTimeType = TimeType.MiddleSunTime;
            Samples.Add(new WidgetCfgSample <WidgetCfg_Calendar>(localize.TimeType_MiddleSunTime, cfg));

            cfg = BaseSample.GetConfigClone();
            cfg.WidgetTimeType = cfg.CurrentTimeType = TimeType.TimeZoneTime;
            Samples.Add(new WidgetCfgSample <WidgetCfg_Calendar>(localize.TimeType_TimeZoneTime, cfg));
        }
Exemple #17
0
        public WidgetCfgAssistant_CalendarCircleWave_CutomDayColorGradientTimeSpan(WidgetCfgSample <WidgetCfg_CalendarCircleWave> baseSample)
        {
            Title      = localize.DayColorsTimeSpan;
            BaseSample = baseSample;

            var cfg = baseSample.GetConfigClone();

            cfg.DayBackgroundGradient.GradientS[0].TimeUnit = TimeUnit.Week;
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.text_perWeek, cfg));

            cfg = baseSample.GetConfigClone();
            cfg.DayBackgroundGradient.GradientS[0].TimeUnit = TimeUnit.Month;
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.text_perMonth, cfg));

            cfg = baseSample.GetConfigClone();
            cfg.DayBackgroundGradient.GradientS[0].TimeUnit = TimeUnit.Year;
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.text_perYear, cfg));

            NextStepAssistantType = typeof(WidgetCfgAssistant_CalendarCircleWave_OptionsBase);
        }
Exemple #18
0
        public WidgetCfgAssistant_Calendar_OptionsBase(WidgetCfgSample <WidgetCfg_Calendar> baseSample)
        {
            Title                 = localize.title_EditWidget;
            BaseSample            = baseSample;
            ShowPreviewImage      = false;
            ShowFirstPreviewImage = true;

            Samples.Add(new WidgetCfgSample <WidgetCfg_Calendar>(localize.action_SaveAndQuit, BaseSample.GetConfigClone()));

            var cfg = BaseSample.GetConfigClone();

            Samples.Add(new WidgetCfgSample <WidgetCfg_Calendar>(localize.Theme, null, cfg, typeof(WidgetCfgAssistant_Calendar_Theme)));
            if (cfg.SupportsWidgetTimeType)
            {
                Samples.Add(new WidgetCfgSample <WidgetCfg_Calendar>(localize.TimeType, null, cfg, typeof(WidgetCfgAssistant_Calendar_WidgetTimeType)));
            }

            Samples.Add(new WidgetCfgSample <WidgetCfg_Calendar>(localize.TitleClickAction, null, BaseSample.GetConfigClone(), typeof(WidgetCfgAssistant_Universal_ClickAction <WidgetCfg_Calendar>)));

            NextStepAssistantType = null;
        }
Exemple #19
0
        public WidgetCfgAssistant_CalendarCircleWave_TodayDayColor(WidgetCfgSample <WidgetCfg_CalendarCircleWave> baseSample)
        {
            Title       = localize.text_TodayColor;
            BaseSample  = baseSample;
            AllowCustom = true;

            var cfgTemplate = baseSample.GetConfigClone();

            cfgTemplate.ColorTodayBackground = xColor.Transparent; //??
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.NoHighlite, (WidgetCfg_CalendarCircleWave)cfgTemplate.Clone()));


            var cfg = (WidgetCfg_CalendarCircleWave)cfgTemplate.Clone();

            cfg.ColorTodayBackground = WidgetCfg.tcLight;
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(WidgetCfg.tcLight.HexString, cfg));

            cfg = (WidgetCfg_CalendarCircleWave)cfgTemplate.Clone();
            cfg.ColorTodayBackground = WidgetCfg.tcDark;
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(WidgetCfg.tcDark.HexString, cfg));

            List <string> doneClrS = new List <string>();
            int           i        = 0;

            foreach (var clrs in DynamicColors.SampleColorSetS)
            {
                i++;
                var clr = xColor.FromHex(clrs[0]);
                if (!doneClrS.Contains(clr.HexString))
                {
                    doneClrS.Add(clr.HexString);
                    cfg = (WidgetCfg_CalendarCircleWave)cfgTemplate.Clone();
                    cfg.ColorTodayBackground = clr;
                    Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(clr.HexString, cfg));
                }
            }

            NextStepAssistantType = typeof(WidgetCfgAssistant_CalendarCircleWave_OptionsBase);
        }
Exemple #20
0
        public override async void ExecCustom(IUserIO handler)
        {
            base.ExecCustom(handler);
            NextStepAssistantType = typeof(WidgetCfgAssistant_CalendarCircleWave_OptionsBase);
            if (await handler.UserShowYesNoMessage(localize.DayColorType, localize.DayColorTypeCustomInfo, localize.action_continue, localize.action_abort))
            {
                List <xColor> xclrs = new List <xColor>();
                int           iClr  = 0;
                while (true)
                {
                    iClr++;

                    var clr = await handler.UserSelectColor("Color number " + iClr);

                    if (clr == null)
                    {
                        break;
                    }
                    else
                    {
                        xclrs.Add(clr.Value);
                    }
                }
                if (xclrs.Count > 0)
                {
                    var cfg = BaseSample.GetConfigClone();
                    cfg.DayBackgroundGradient = new DateGradient()
                    {
                        GradientS = { new DynamicGradient(cfg.TimeUnit, xclrs.ToArray()) }
                    };
                    BaseSample = new WidgetCfgSample <WidgetCfg_CalendarCircleWave>("custom", xclrs.ToArray(), cfg);
                }

                NextStepAssistantType = typeof(WidgetCfgAssistant_CalendarCircleWave_CutomDayColorGradientTimeSpan);
                handler.TriggerPositiveButtonClicked();
            }
        }
Exemple #21
0
        public override void AfterSelect(IUserIO handler, WidgetCfgSample <WidgetCfg_Calendar> sample)
        {
            base.AfterSelect(handler, sample);

            NextStepAssistantType = (sample.Tag as Type);
        }
Exemple #22
0
        public WidgetCfgAssistant_ActionButton_Icon(WidgetCfgSample <WidgetCfg_ActionButton> baseSample)
        {
            Title      = localize.text_Icon;
            BaseSample = baseSample;

            var cfg = baseSample.GetConfigClone();

            cfg.Style = ActionButton_Style.iChronEye;
            cfg.AnimateOnFirstClick = false;
            Samples.Add(new WidgetCfgSample <WidgetCfg_ActionButton>(localize.ActionButtonStyle_eye_static, cfg));

            cfg       = baseSample.GetConfigClone();
            cfg.Style = ActionButton_Style.iChronEye;
            cfg.AnimateOnFirstClick = true;
            Samples.Add(new WidgetCfgSample <WidgetCfg_ActionButton>(localize.ActionButtonStyle_eye_animated, cfg));

            cfg          = baseSample.GetConfigClone();
            cfg.Style    = ActionButton_Style.Icon;
            cfg.IconName = "sunface_junior";
            //Samples.Add(new WidgetCfgSample<WidgetCfg_ActionButton>("", cfg));

            string cIconPrefix = "";

            switch (cfg.ClickAction.Type)
            {
            case ClickActionType.OpenApp:
                //cIconPrefix = "icons8_calendar_plus";
                break;

            case ClickActionType.OpenClock:
                cIconPrefix = "icons8_alarm_clock";
                break;

            case ClickActionType.OpenCalendar:
                cIconPrefix = "icons8_calendar";
                break;

            case ClickActionType.OpenWorldTimeMap:
                cIconPrefix = "*_globe";
                break;

            case ClickActionType.CreateEvent:
                cIconPrefix = "icons8_calendar_plus_";
                break;

            case ClickActionType.CreateAlarm:
                cIconPrefix = "icons8_alarm";
                break;
                //case ClickActionType.TimeToTimeDialog:
                //  cIconPrefix = "icons8_map_marker";
                //break;
            }
            if (!string.IsNullOrEmpty(cIconPrefix))
            {
                foreach (var prop in sys.AllDrawables)
                {
                    if (prop.ToLower().StartsWith(cIconPrefix) && prop.Replace("_clrd", "").Length - 3 < cIconPrefix.Length ||
                        (cIconPrefix.StartsWith("*") && prop.ToLower().Contains(cIconPrefix.Substring(1)))
                        )
                    {
                        cfg          = baseSample.GetConfigClone();
                        cfg.Style    = ActionButton_Style.Icon;
                        cfg.IconName = prop;
                        Samples.Add(new WidgetCfgSample <WidgetCfg_ActionButton>(prop, cfg));
                    }
                }
            }

            NextStepAssistantType = typeof(WidgetCfgAssistant_ActionButton_OptionsBase);
        }
        public WidgetCfgAssistant_Universal_ClickAction(WidgetCfgSample <T> baseSample)
        {
            var t = baseSample.WidgetConfig;

            Title = localize.ClickAction;
            if (t is WidgetCfg_Calendar)
            {
                Title = localize.TitleClickAction;
            }
            BaseSample       = baseSample;
            ShowPreviewImage = false;

            foreach (ClickActionType ca in Enum.GetValues(typeof(ClickActionType)))
            {
                try
                {
                    if (ca == ClickActionType.CreateAlarm)
                    {
                        continue;
                    }
                    if (ca == ClickActionType.Animate && !(t is WidgetCfg_ActionButton))
                    {
                        continue;
                    }

                    string c   = ca.ToString();
                    var    res = typeof(localize).GetProperty("ClickActionType_" + c);
                    if (res != null)
                    {
                        c = (string)res.GetValue(null);
                    }

                    var cfg = baseSample.GetConfigClone();
                    cfg.ClickAction = new ClickAction(ca);
                    if (cfg is WidgetCfg_ActionButton)
                    {
                        if (ca == ClickActionType.Animate)
                        {
                            cfg.WidgetTitle = "";
                            (cfg as WidgetCfg_ActionButton).Style = ActionButton_Style.iChronEye;
                            (cfg as WidgetCfg_ActionButton).AnimateOnFirstClick = true;
                        }
                        else if (ca == ClickActionType.None)
                        {
                            cfg.WidgetTitle = "  ";
                        }
                        else if (ca != ClickActionType.OpenApp)
                        {
                            cfg.WidgetTitle = c;
                        }

                        if (!string.IsNullOrEmpty(cfg.WidgetTitle) && cfg.WidgetTitle.Contains("\'") && cfg.WidgetTitle.IndexOf("\'") != cfg.WidgetTitle.LastIndexOf("\'"))
                        {
                            cfg.WidgetTitle = cfg.WidgetTitle.Split('\'')[1];
                        }
                    }

                    Samples.Add(new WidgetCfgSample <T>(c, cfg));
                }
                catch (Exception ex)
                {
                    xLog.Error(ex);
                }
            }

            if (t is WidgetCfg_ActionButton)
            {
                NextStepAssistantType = typeof(WidgetCfgAssistant_ActionButton_Icon);
            }
            else if (t is WidgetCfg_Clock)
            {
                NextStepAssistantType = typeof(WidgetCfgAssistant_ClockAnalog_OptionsBase);
            }
            else if (t is WidgetCfg_CalendarCircleWave)
            {
                NextStepAssistantType = typeof(WidgetCfgAssistant_CalendarCircleWave_OptionsBase);
            }
            else if (t is WidgetCfg_Calendar)
            {
                NextStepAssistantType = typeof(WidgetCfgAssistant_Calendar_OptionsBase);
            }
        }
Exemple #24
0
        public WidgetCfgAssistant_CalendarCircleWave_DayColorType(WidgetCfgSample <WidgetCfg_CalendarCircleWave> baseSample)
        {
            Title       = localize.DayColorType;
            AllowCustom = true;
            BaseSample  = baseSample;

            var clr = xColor.FromHex(DynamicColors.SampleColorSetS[5][2]);

            var cfg = baseSample.GetConfigClone();

            cfg.DayBackgroundGradient = new DateGradient()
            {
                GradientS = { new DynamicGradient(cfg.TimeUnit, Core.DynamicCalendar.GradientType.StaticColor)
                              {
                                  CustomColors = new xColor[] { clr }
                              } }
            };
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.text_SingleColor, cfg));

            var clr1 = clr.AddLuminosity(.1);
            var clr2 = clr.AddLuminosity(-.1);

            cfg = baseSample.GetConfigClone();
            cfg.DayBackgroundGradient = new DateGradient()
            {
                GradientS = { new DynamicGradient(cfg.TimeUnit, new xColor[] { clr1, clr2 }) }
            };
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.DarkToLight, cfg));

            clr1 = clr.AddLuminosity(-.1);
            clr2 = clr.AddLuminosity(.1);

            cfg = baseSample.GetConfigClone();
            cfg.DayBackgroundGradient = new DateGradient()
            {
                GradientS = { new DynamicGradient(cfg.TimeUnit, new xColor[] { clr1, clr2 }) }
            };
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.LightToDark, cfg));

            var clrs = DynamicColors.SampleColorSetS[5];

            cfg = baseSample.GetConfigClone();
            cfg.DayBackgroundGradient = new DateGradient()
            {
                GradientS = { new DynamicGradient(cfg.TimeUnit, new xColor[] { clrs[0], clrs[1] }) }
            };
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.text_twoColors, cfg));

            cfg = baseSample.GetConfigClone();
            cfg.DayBackgroundGradient = new DateGradient()
            {
                GradientS = { new DynamicGradient(cfg.TimeUnit, new xColor[] { clrs[0], clrs[1], clrs[2] }) }
            };
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.text_threeColors, cfg));

            cfg = baseSample.GetConfigClone();
            cfg.DayBackgroundGradient = new DateGradient()
            {
                GradientS = { new DynamicGradient(cfg.TimeUnit, new xColor[] { clrs[0], clrs[1], clrs[2], clrs[3] }) }
            };
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.fourColors, cfg));

            cfg = baseSample.GetConfigClone();
            cfg.DayBackgroundGradient = new DateGradient()
            {
                GradientS = { new DynamicGradient(cfg.TimeUnit, new xColor[] { clrs[0], clrs[1], clrs[2], clrs[3], clrs[4] }) }
            };
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.fiveColors, cfg));

            cfg = baseSample.GetConfigClone();
            cfg.DayBackgroundGradient = new DateGradient()
            {
                GradientS = { new DynamicGradient(TimeUnit.Month, Core.DynamicCalendar.GradientType.Rainbow) }
            };
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.aRainbowPerMonth, cfg));

            cfg = baseSample.GetConfigClone();
            cfg.DayBackgroundGradient = new DateGradient()
            {
                GradientS = { new DynamicGradient(TimeUnit.Year, Core.DynamicCalendar.GradientType.Rainbow) }
            };
            Samples.Add(new WidgetCfgSample <WidgetCfg_CalendarCircleWave>(localize.aRainbowPerYear, cfg));

            NextStepAssistantType = typeof(WidgetCfgAssistant_CalendarCircleWave_DayColors);
        }