private void InitializeSetting() { items = new List <ColorItem>(); items.Add(new ColorItem() { Text = AppResources.ColorChrome, Color = ColorItem.ConvertColor(0xFF1F1F1F), Desc = AppResources.ColorChrome }); items.Add(new ColorItem() { Text = AppResources.ColorLightGray, Color = ColorItem.ConvertColor(0xFFD3D3D3) /*, Desc = AppResources.ColorLightGray*/ }); items.Add(new ColorItem() { Text = AppResources.AccentColor, Color = (Color)App.Current.Resources["PhoneAccentColor"] /*, Desc = AppResources.AccentColor*/ }); for (int i = 0; i < ColorItem.UintColors.Length; i++) { if (!((Color)App.Current.Resources["PhoneAccentColor"]).Equals(ColorItem.ConvertColor(ColorItem.UintColors[i]))) { items.Add(new ColorItem() { Color = ColorItem.ConvertColor(ColorItem.UintColors[i]) }); } } ; }
private void UpgradeVersion() { if (!IsolatedStorageSettings.ApplicationSettings.Contains("MigratedScheduler") && ScheduledActionService.Find("PeriodicAgent") as PeriodicTask != null) { //1.0.x대의 스케쥴러 삭제 RemoveAgent("PeriodicAgent"); IsolatedStorageSettings.ApplicationSettings["MigratedScheduler"] = true; //새로운 스케쥴러 등록 StartPeriodicAgent(); } //2.4 버전 색상값 변경 관련 if (SettingHelper.ContainsKey(Constants.LOCKSCREEN_BACKGROUND_COLOR)) { ColorItem colorItem = SettingHelper.Get(Constants.LOCKSCREEN_BACKGROUND_COLOR) as ColorItem; if (colorItem.Color == Colors.Transparent) { SettingHelper.Set(Constants.LOCKSCREEN_BACKGROUND_COLOR, new ColorItem() { Text = AppResources.ColorChrome, Color = ColorItem.ConvertColor(0xFF1F1F1F) }, false); SettingHelper.Set(Constants.LOCKSCREEN_BACKGROUND_OPACITY, 0, false); SettingHelper.Save(); } } }
private void InitializeLivetileSetting() { UseRandomLivetileColor.IsChecked = (bool)SettingHelper.Get(Constants.LIVETILE_RANDOM_BACKGROUND_COLOR); UseRandomLivetileColor.Checked += OnCheckedUseItem; UseRandomLivetileColor.Unchecked += OnUncheckedUseItem; List <ColorItem> itemList = items.ToList <ColorItem>(); itemList.Insert(0, new ColorItem() { Text = AppResources.ColorTransparent, Color = ColorItem.ConvertColor(0x00FFFFFF), Desc = AppResources.ColorTransparent }); LivetileCalendarColorPicker.ItemsSource = itemList; LivetileCalendarColorPicker.SelectedItem = FindSelectedColorItem(itemList, Constants.LIVETILE_CALENDAR_BACKGROUND_COLOR); LivetileCalendarColorPicker.SelectionChanged += OnSelectionChangedColortPicker; LivetileWeatherColorPicker.ItemsSource = itemList; LivetileWeatherColorPicker.SelectedItem = FindSelectedColorItem(itemList, Constants.LIVETILE_WEATHER_BACKGROUND_COLOR); LivetileWeatherColorPicker.SelectionChanged += OnSelectionChangedColortPicker; LivetileBatteryColorPicker.ItemsSource = itemList; LivetileBatteryColorPicker.SelectedItem = FindSelectedColorItem(itemList, Constants.LIVETILE_BATTERY_BACKGROUND_COLOR); LivetileBatteryColorPicker.SelectionChanged += OnSelectionChangedColortPicker; //글자 굵기 피커 데이터 설정 FontWeight[] fontWeights = new FontWeight[] { FontWeights.ExtraBlack, FontWeights.Black, FontWeights.ExtraBold, FontWeights.Bold, FontWeights.SemiBold, FontWeights.Medium }; List <PickerItem> fontWeightList = new List <PickerItem>(); Object selectItem = null; foreach (FontWeight fw in fontWeights) { PickerItem item = new PickerItem() { Key = fw.ToString(), Name = fw.ToString() }; fontWeightList.Add(item); if ((string)item.Key == SettingHelper.GetString(Constants.LIVETILE_FONT_WEIGHT)) { selectItem = item; } } LivetileFontWeightPicker.ItemsSource = fontWeightList; LivetileFontWeightPicker.SelectedItem = selectItem == null?fontWeightList.FirstOrDefault(x => x.Name == FontWeights.SemiBold.ToString()) : selectItem; LivetileFontWeightPicker.SelectionChanged += LivetileFontWeightPicker_SelectionChanged; List <PickerItem> fontSizePicer = new List <PickerItem>(); LivetileWeatherFontSizePicker.ItemsSource = fontSizePicer; fontSizePicer.Add(new PickerItem() { Key = 1.0, Name = string.Format(AppResources.Percent, 1.0 * 100) }); fontSizePicer.Add(new PickerItem() { Key = 1.1, Name = string.Format(AppResources.Percent, 1.1 * 100) }); fontSizePicer.Add(new PickerItem() { Key = 1.2, Name = string.Format(AppResources.Percent, 1.2 * 100) }); fontSizePicer.Add(new PickerItem() { Key = 1.3, Name = string.Format(AppResources.Percent, 1.3 * 100) }); fontSizePicer.Add(new PickerItem() { Key = 1.4, Name = string.Format(AppResources.Percent, 1.4 * 100) }); fontSizePicer.Add(new PickerItem() { Key = 1.5, Name = string.Format(AppResources.Percent, 1.5 * 100) }); LivetileWeatherFontSizePicker.SelectedItem = fontSizePicer.Find(x => x.Key.Equals((SettingHelper.Get(Constants.LIVETILE_WEATHER_FONT_SIZE) as PickerItem).Key)); LivetileWeatherFontSizePicker.SelectionChanged += OnSelectionChangeWeatherFontSizePicker; List <PickerItem> batteryFullPicker = new List <PickerItem>(); LivetileBatteryFullPicker.ItemsSource = batteryFullPicker; batteryFullPicker.Add(new PickerItem() { Key = 99, Name = AppResources.BatteryFullWPDefault }); batteryFullPicker.Add(new PickerItem() { Key = 100, Name = AppResources.BatteryFull }); LivetileBatteryFullPicker.SelectedItem = batteryFullPicker.Find(x => x.Key.Equals((SettingHelper.Get(Constants.LIVETILE_BATTERY_FULL_INDICATION) as PickerItem).Key)); LivetileBatteryFullPicker.SelectionChanged += OnSelectionChangeBatteryFullPicker; List <PickerItem> intervalList = new List <PickerItem>(); intervalList.Add(new PickerItem() { Key = 30, Name = 30 + AppResources.Minutes }); intervalList.Add(new PickerItem() { Key = 60, Name = 1 + AppResources.Hour }); intervalList.Add(new PickerItem() { Key = 120, Name = 2 + AppResources.Hours }); intervalList.Add(new PickerItem() { Key = 180, Name = 3 + AppResources.Hours }); intervalList.Add(new PickerItem() { Key = 360, Name = 6 + AppResources.Hours }); intervalList.Add(new PickerItem() { Key = 720, Name = 12 + AppResources.Hours }); intervalList.Add(new PickerItem() { Key = 1440, Name = 1 + AppResources.Day }); int interval = scheduleSettings.LivetileUpdateInterval; for (int i = 0; i < intervalList.Count; i++) { if ((int)intervalList[i].Key == interval) { interval = i; break; } } UpdateIntervalLivetilePicker.ItemsSource = intervalList; UpdateIntervalLivetilePicker.SelectedIndex = interval; UpdateIntervalLivetilePicker.SelectionChanged += OnSelectionChangedUpdateInterval; //랜덤 색상을 사용중이면 이하 색상 피커 비활성화 if (UseRandomLivetileColor.IsChecked == true) { LivetileWeatherColorPicker.IsEnabled = false; LivetileCalendarColorPicker.IsEnabled = false; LivetileBatteryColorPicker.IsEnabled = false; } }
public static void CreateDefaultValues() { ScheduleSettings scheduleSetting = MutexedIsoStorageFile.Read <ScheduleSettings>("ScheduleSettings", Constants.MUTEX_DATA); //락스크린의 템플릿 SetDefaultSetting(Constants.LOCKSCREEN_BACKGROUND_TEMPLATE, new LockscreenTemplateItem() { LockscreenItemInfos = new LockscreenItemInfo[] { new LockscreenItemInfo { LockscreenItem = LiveItems.Weather, Column = 0, Row = 0, ColSpan = 1, RowSpan = 3 }, new LockscreenItemInfo { LockscreenItem = LiveItems.Calendar, Column = 1, Row = 0, ColSpan = 1, RowSpan = 3 } } }); //락스크린의 뒷배경 분할 SetDefaultSetting(Constants.LOCKSCREEN_BACKGROUND_USE_SEPARATION, false); //락스크린의 배경 색상 SetDefaultSetting(Constants.LOCKSCREEN_BACKGROUND_COLOR, new ColorItem() { Text = AppResources.ColorChrome, Color = ColorItem.ConvertColor(0xFF1F1F1F) }); //락스크린의 배경 투명도 SetDefaultSetting(Constants.LOCKSCREEN_BACKGROUND_OPACITY, Constants.LOCKSCREEN_BACKGROUND_DEFAULT_OPACITY); //락스크린의 글자 굵기 SetDefaultSetting(Constants.LOCKSCREEN_FONT_WEIGHT, FontWeights.Bold.ToString()); //락스크린의 업데이트 주기 if (scheduleSetting.LockscreenUpdateInterval == 0) { scheduleSetting.LockscreenUpdateInterval = 180; MutexedIsoStorageFile.Write <ScheduleSettings>(scheduleSetting, "ScheduleSettings", Constants.MUTEX_DATA); } //라이브타일 랜덤색상 사용여부 SetDefaultSetting(Constants.LIVETILE_RANDOM_BACKGROUND_COLOR, true); ColorItem accentColorItem = new ColorItem() { Color = (Color)Application.Current.Resources["PhoneAccentColor"] }; if (string.IsNullOrEmpty(accentColorItem.Text)) { accentColorItem.Text = AppResources.AccentColor; } //메인 라이브타일의 배경색상 SetDefaultSetting(Constants.LIVETILE_CALENDAR_BACKGROUND_COLOR, accentColorItem); //보조 라이브타일의 템플릿... SetDefaultSetting(Constants.LIVETILE_WEATHER_BACKGROUND_COLOR, accentColorItem); //배터리 라이브타일의 템플릿... SetDefaultSetting(Constants.LIVETILE_BATTERY_BACKGROUND_COLOR, accentColorItem); //날씨 타일 폰트 크기 SetDefaultSetting(Constants.LIVETILE_WEATHER_FONT_SIZE, new PickerItem() { Key = 1.1, Name = string.Format(AppResources.Percent, 1.1 * 100) }); //날씨 및 달력의 글자 굵기 SetDefaultSetting(Constants.LIVETILE_FONT_WEIGHT, FontWeights.SemiBold.ToString()); //배터리 완충 상태 표시 SetDefaultSetting(Constants.LIVETILE_BATTERY_FULL_INDICATION, new PickerItem() { Key = 100, Name = AppResources.BatteryFull }); //라이브타일의 업데이트 주기 if (scheduleSetting.LivetileUpdateInterval == 0) { scheduleSetting.LivetileUpdateInterval = 60; MutexedIsoStorageFile.Write <ScheduleSettings>(scheduleSetting, "ScheduleSettings", Constants.MUTEX_DATA); } //보호색 사용여부 SetDefaultSetting(Constants.CHAMELEON_USE_PROTECTIVE_COLOR, true); //보호이미지 사용여부 SetDefaultSetting(Constants.CHAMELEON_USE_PROTECTIVE_IMAGE, false); SetDefaultSetting(Constants.CHAMELEON_SKIN_BACKGROUND_COLOR, new ColorItem() { Color = ColorItem.GetColorByName("Green") }); //날씨 위치 서비스 if (!SettingHelper.ContainsKey(Constants.WEATHER_USE_LOCATION_SERVICES)) { SettingHelper.Set(Constants.WEATHER_USE_LOCATION_SERVICES, true, false); } //날씨 표시 단위 if (!SettingHelper.ContainsKey(Constants.WEATHER_UNIT_TYPE)) { if (System.Globalization.CultureInfo.CurrentUICulture.Name == "en-US") { SettingHelper.Set(Constants.WEATHER_UNIT_TYPE, DisplayUnit.Fahrenheit, false); } else { SettingHelper.Set(Constants.WEATHER_UNIT_TYPE, DisplayUnit.Celsius, false); } } //날씨 기본 아이콘 설정 if (!SettingHelper.ContainsKey(Constants.WEATHER_ICON_TYPE)) { SettingHelper.Set(Constants.WEATHER_ICON_TYPE, WeatherIconType.Simple01, false); } //달력의 첫요일 SetDefaultSetting(Constants.CALENDAR_FIRST_DAY_OF_WEEK, DateTimeFormatInfo.CurrentInfo.FirstDayOfWeek); //달력 약속 표시 SetDefaultSetting(Constants.CALENDAR_SHOW_APPOINTMENT, true); //시작 페이지 설정 SetDefaultSetting(Constants.COMMON_FIRST_PAGE_ITEM, 0); //기본 빙마켓 설정 SetDefaultSetting(Constants.BING_LANGUAGE_MARKET, System.Globalization.CultureInfo.CurrentUICulture.Name); SetDefaultSetting(Constants.BING_SEARCH_ASPECT, "Tall"); SetDefaultSetting(Constants.BING_SEARCH_OPTIONS, "None"); SetDefaultSetting(Constants.BING_SEARCH_SIZE, "Large"); SetDefaultSetting(Constants.BING_SEARCH_SIZE_WIDTH, "" + (int)ResolutionHelper.CurrentResolution.Width); SetDefaultSetting(Constants.BING_SEARCH_SIZE_HEIGHT, "" + (int)ResolutionHelper.CurrentResolution.Height); SetDefaultSetting(Constants.BING_SEARCH_COLOR, "Color"); SetDefaultSetting(Constants.BING_SEARCH_STYLE, "Photo"); SetDefaultSetting(Constants.BING_SEARCH_FACE, "Other"); SetDefaultSetting(Constants.BING_SEARCH_COUNT, "40"); SetDefaultSetting(Constants.BING_SEARCH_ADULT, "Strict"); //손전등 - 토글버튼 사용 설정 SetDefaultSetting(Constants.FLASHLIGHT_USE_TOGGLE_SWITCH, true); SettingHelper.Save(); }
private void InitializeProtectiveColor() { //배경 색상 브러스 및 카멜레온 효과 스토리보드 생성 LinearGradientBrush gradientBrush = new LinearGradientBrush() { EndPoint = new Point(0.5, 0), StartPoint = new Point(0.5, 1) }; bool useProtectiveColor = (bool)SettingHelper.Get(Constants.CHAMELEON_USE_PROTECTIVE_COLOR); Color beginColor; if (useProtectiveColor) { int index = new Random().Next(0, ColorItem.UintColors.Length - 1); beginColor = ColorItem.ConvertColor(ColorItem.UintColors[index]); } else { beginColor = (SettingHelper.Get(Constants.CHAMELEON_SKIN_BACKGROUND_COLOR) as ColorItem).Color; } double rc = 0.1; GradientStop stop1 = new GradientStop() { Color = (Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible ? Color.FromArgb((byte)(beginColor.A * 0.8), (byte)(beginColor.R * rc), (byte)(beginColor.G * rc), (byte)(beginColor.B * rc)) : Colors.White, Offset = 1 }; //GradientStop stop2 = new GradientStop() { Color = (Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible ? Colors.Black : Colors.White, Offset = 0 }; GradientStop stop2 = new GradientStop() { Color = beginColor, Offset = 0 }; //GradientStop stop1 = new GradientStop() { Color = (Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible ? Colors.Black : Colors.White, Offset = 0 }; //GradientStop stop2 = new GradientStop() { Color = initColor, Offset = 1 }; gradientBrush.GradientStops.Add(stop1); gradientBrush.GradientStops.Add(stop2); PanoramaMainView.Background = gradientBrush; /* * // * // Animate the first gradient stop's offset from * // 0.0 to 1.0 and then back to 0.0. * // * DoubleAnimation offsetAnimation = new DoubleAnimation(); * offsetAnimation.From = 0.0; * offsetAnimation.To = 0.85; * offsetAnimation.Duration = TimeSpan.FromSeconds(1.0); * offsetAnimation.AutoReverse = true; * Storyboard.SetTarget(offsetAnimation, stop1); * Storyboard.SetTargetProperty(offsetAnimation, * new PropertyPath(GradientStop.OffsetProperty)); */ // // Animate the second gradient stop's color from // Purple to Yellow and then back to Purple. // TimeSpan duration = TimeSpan.FromSeconds(2.5); ColorAnimation gradientStopColorAnimation = new ColorAnimation(); //gradientStopColorAnimation.From = Colors.Green; gradientStopColorAnimation.To = Colors.Yellow; gradientStopColorAnimation.Duration = duration; //gradientStopColorAnimation.AutoReverse = true; Storyboard.SetTarget(gradientStopColorAnimation, stop2); Storyboard.SetTargetProperty(gradientStopColorAnimation, new PropertyPath(GradientStop.ColorProperty)); // Set the animation to begin after the first animation // ends. gradientStopColorAnimation.BeginTime = TimeSpan.FromSeconds(0.5); // Create a Storyboard to apply the animations. gradientStopAnimationStoryboard = new Storyboard(); if (useProtectiveColor) { gradientStopAnimationStoryboard.Children.Add(gradientStopColorAnimation); } else { //gradientStopAnimationStoryboard.Children.Add(offsetAnimation); } PanoramaMainView.SelectionChanged += (s, e) => { //colorStoryboard.Begin(); //날씨 설명 애니메이션 정지 HideForecastDescriptionMarquee(); String panoramaName = (e.AddedItems[0] as PanoramaItem).Name; if (panoramaName == PILivetile.Name) { ApplicationBar = IAppBarLivetile; ApplicationBar.IsVisible = true; } else if (panoramaName == PILockscreen.Name) { ApplicationBar = IAppBarLockscreen; ApplicationBar.IsVisible = true; if (LockscreenSelector.ItemsSource != null) { foreach (PhonePicture pic in LockscreenSelector.ItemsSource as ChameleonAlbum) { if (pic.CurrentLockscreen != null) { LockscreenSelector.ScrollTo(pic); break; } } } } else if (panoramaName == PIWeather.Name) { ApplicationBar = iAppBarWeather; ApplicationBar.IsVisible = true; } else if (panoramaName == PICalendar.Name) { ApplicationBar = IAppBarCalendar; ApplicationBar.IsVisible = true; } else { ApplicationBar = null; } Color newColor; if ((bool)SettingHelper.Get(Constants.CHAMELEON_USE_PROTECTIVE_COLOR)) { ColorAnimation protectiveColorAnimation = gradientStopAnimationStoryboard.Children[0] as ColorAnimation; if (protectiveColorAnimation == null) { gradientStopAnimationStoryboard.Stop(); gradientStopAnimationStoryboard.Children.Clear(); gradientStopAnimationStoryboard.Children.Add(gradientStopColorAnimation); protectiveColorAnimation = gradientStopColorAnimation; } //계속 다른 색상을 생성 do { int index = new Random().Next(0, ColorItem.UintColors.Length); newColor = ColorItem.ConvertColor(ColorItem.UintColors[index]); } while (newColor.Equals(protectiveColorAnimation.To)); //System.Diagnostics.Debug.WriteLine("random : " + newColor.ToString()); protectiveColorAnimation.To = newColor; gradientStopAnimationStoryboard.Begin(); } else { newColor = (SettingHelper.Get(Constants.CHAMELEON_SKIN_BACKGROUND_COLOR) as ColorItem).Color; ChangeBackgroundColor(newColor); // DoubleAnimation fixedColorAnimation = gradientStopAnimationStoryboard.Children[0] as DoubleAnimation; // if (fixedColorAnimation == null) // { // gradientStopAnimationStoryboard.Stop(); // gradientStopAnimationStoryboard.Children.Clear(); // gradientStopAnimationStoryboard.Children.Add(offsetAnimation); // } // gradientStopAnimationStoryboard.Begin(); } SetAppbarColor(ApplicationBar, newColor); }; //gradientStopColorAnimation.Completed += (s, e) => //{ // Color color = ApplicationBar.BackgroundColor; // ApplicationBar.BackgroundColor = Color.FromArgb(255, color.R, color.G, color.B); //}; }
private void appBarIconBtnForecast_Click(object sender, EventArgs e) { HideForecastDescriptionMarquee(); ApplicationBarIconButton btn = iAppBarWeather.Buttons[0] as ApplicationBarIconButton; bool isNight = btn.Text == AppResources.AppbarMenuNight; if (isNight) { btn.Text = AppResources.AppbarMenuDay; btn.IconUri = PathHelper.GetPath("appbar.weather.sun.png"); ListBoxNightForecasts.Visibility = System.Windows.Visibility.Visible; ListBoxForecasts.Visibility = System.Windows.Visibility.Collapsed; } else { btn.Text = AppResources.AppbarMenuNight; btn.IconUri = PathHelper.GetPath("appbar.moon.png"); ListBoxNightForecasts.Visibility = System.Windows.Visibility.Collapsed; ListBoxForecasts.Visibility = System.Windows.Visibility.Visible; } Color newColor; Color dark = Color.FromArgb(255, 64, 64, 64); if ((bool)SettingHelper.Get(Constants.CHAMELEON_USE_PROTECTIVE_COLOR)) { ColorAnimation protectiveColorAnimation = gradientStopAnimationStoryboard.Children[0] as ColorAnimation; newColor = (Color)protectiveColorAnimation.To; if (protectiveColorAnimation != null) { //gradientStopAnimationStoryboard.Stop(); //gradientStopAnimationStoryboard.Children.Clear(); //gradientStopAnimationStoryboard.Children.Add(protectiveColorAnimation); if (isNight) { newColor = dark; } else { //계속 다른 색상을 생성 do { int index = new Random().Next(0, ColorItem.UintColors.Length); newColor = ColorItem.ConvertColor(ColorItem.UintColors[index]); } while (newColor.Equals(protectiveColorAnimation.To)); } protectiveColorAnimation.To = newColor; gradientStopAnimationStoryboard.Begin(); } } else { if (isNight) { newColor = dark; } else { newColor = (SettingHelper.Get(Constants.CHAMELEON_SKIN_BACKGROUND_COLOR) as ColorItem).Color; } ChangeBackgroundColor(newColor); // DoubleAnimation fixedColorAnimation = gradientStopAnimationStoryboard.Children[0] as DoubleAnimation; // if (fixedColorAnimation == null) // { // gradientStopAnimationStoryboard.Stop(); // gradientStopAnimationStoryboard.Children.Clear(); // gradientStopAnimationStoryboard.Children.Add(offsetAnimation); // } // gradientStopAnimationStoryboard.Begin(); } SetAppbarColor(ApplicationBar, newColor); }