/// <summary> /// 判断配置类实体是否相等 /// </summary> /// <param name="SettingHelper">目标配置类</param> /// <returns>相等</returns> public bool Equals(SettingHelper SettingHelper) { if (!SettingHelper.Company.Equals(this.Company)) { return false; } if (!SettingHelper.Project.Equals(this.Project)) { return false; } if (!SettingHelper.Author.Equals(this.Author)) { return false; } if (!SettingHelper.Design.Equals(this.Design)) { return false; } if (!SettingHelper.Output.Equals(this.Output)) { return false; } if (!SettingHelper.CurrentDb.Equals(this.CurrentDb)) { return false; } if (!SettingHelper.Overwrite.Equals(this.Overwrite)) { return false; } return true; }
public static void SaveLogoOrFavicon(Stream inputStream, string fileName, bool isFavicon) { ImageSetting setting = GetSetting(); var fullPath = HttpContext.Current.Server.MapPath("/"); CreateFolder(setting); if (inputStream == null) throw new ArgumentNullException("inputStream"); var image = new WebImage(inputStream) {FileName = fileName}; if (image.Width > 500) { image.Resize(500, ((500 * image.Height) / image.Width)); } var logo = new SettingHelper<IHomeLogoSetting>("homeLogo").Setting(); var fn = (!isFavicon) ? logo.LogoName : logo.FaviconName; image.Save(fullPath + fn); }
void BingSearchSizeWidth_TextChanged(object sender, TextChangedEventArgs e) { SettingHelper.Set(Constants.BING_SEARCH_SIZE_WIDTH, BingSearchSizeWidth.Text, false); }
private void slider_DanmuSpeed_ValueChanged(object sender, RangeBaseValueChangedEventArgs e) { SettingHelper.Set_DMSpeed(slider_DanmuSpeed.Value); }
private void cb_DownQuality_SelectionChanged(object sender, SelectionChangedEventArgs e) { SettingHelper.Set_DownQualit(cb_DownQuality.SelectedIndex + 1); }
private void cb_VideoType_SelectionChanged(object sender, SelectionChangedEventArgs e) { SettingHelper.Set_VideoType(cb_VideoType.SelectedIndex); }
private void sw_Playback_SelectionChanged(object sender, SelectionChangedEventArgs e) { SettingHelper.Set_Playback(sw_Playback.SelectedIndex); }
private void cb_Rigth_SelectionChanged(object sender, SelectionChangedEventArgs e) { SettingHelper.Set_Rigth(cb_Rigth.SelectedIndex); }
private void sw_LoadSe_Toggled(object sender, RoutedEventArgs e) { SettingHelper.Set_LoadSplash(sw_LoadSe.IsOn); }
public static string GetDirectoryTempPath() { return(SettingHelper.Get().UploadDirectoryTemp); }
private void RenderLiveWeather(LiveWeather result) { WeatherCity city = SettingHelper.Get(Constants.WEATHER_MAIN_CITY) as WeatherCity; TxtWeatherNoCity.Visibility = System.Windows.Visibility.Collapsed; GridLiveWeather.Visibility = System.Windows.Visibility.Visible; SystemTray.SetIsVisible(this, false); if (SystemTray.ProgressIndicator != null) { SystemTray.ProgressIndicator.IsVisible = false; } BitmapImage imageSource = new BitmapImage(); imageSource.UriSource = new WeatherImageIconConverter().Convert(result.CurrentConditionIcon, null, "205x172", null) as Uri; //업데이트 시간 System.DateTime dateTime = GetDateTime(result.ObDate); //지역 string[] langs = CultureInfo.CurrentCulture.Name.Split('-'); if (langs[0] == "ko" || langs[0] == "ja" || langs[1] == "zh") { PIWeather.Header = (string.IsNullOrEmpty(result.Station.State) ? string.Empty : result.Station.State + " ") + result.Station.City; } else { PIWeather.Header = result.Station.City + (string.IsNullOrEmpty(result.Station.State) ? string.Empty : " ," + result.Station.State); } //업데이트 시간 TxtLiveWeatherDtUpdated.Text = dateTime.ToString(CultureInfo.CurrentUICulture.DateTimeFormat.LongDatePattern); TxtLiveWeatherTmUpdated.Text = string.Format(AppResources.WeatherUpdatedTime, dateTime.ToString(CultureInfo.CurrentUICulture.DateTimeFormat.ShortTimePattern)); //날씨 이미지 ImgLiveWeatherIcon.Source = imageSource; //날씨 텍스트 TxtLiveWeatherCondition.Text = result.CurrentCondition; //기온 string[] temp = result.Temp.Value.Value.Split('.'); TxtLiveWeatherTemp.Text = temp[0]; //TxtLiveWeatherTemp.Text = "-50"; double orgFontSize = TxtLiveWeatherTemp.FontSize; //온도 표시 문자열의 길이에 따라 폰트 사이즈 변경 while (TxtLiveWeatherTemp.Width < TxtLiveWeatherTemp.ActualWidth) { TxtLiveWeatherTemp.FontSize--; } if (temp.Length > 1) { TxtLiveWeatherTempFloat.Text = "." + temp[1]; } TxtLiveWeatherTempUnits.Text = (WeatherUnitsConverter.ConvertOnlyUnit(result.Temp.Value) as ValueUnits).Units; //체감온도 string feelsLikeLabel = string.IsNullOrEmpty(result.FeelsLikeLabel) ? AppResources.WeatherLiveFeelsLike : result.FeelsLikeLabel + " {0}"; TxtLiveWeatherFeelTemp.Text = string.Format(feelsLikeLabel, WeatherUnitsConverter.Convert(result.FeelsLike)); //습도 TxtLiveWeatherHumidity.Text = string.Format(AppResources.WeatherLiveHumidity, result.Humidity.Value.Value, result.Humidity.Value.Units); //바람 TxtLiveWeatherWind.Text = string.Format(AppResources.WeatherLiveWind, result.WindDirection, result.WindSpeed.Value, result.WindSpeed.Units); //최고/최저 기온 TxtLiveWeatherTempRange.Text = WeatherRangeConverter.RangeText( new ValueUnits[2] { result.Temp.Low, result.Temp.High }, true); double dTemp = 0; double dFeel = 0; try { dTemp = Double.Parse(result.Temp.Value.Value); dFeel = Double.Parse(result.FeelsLike.Value); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("온도 파싱 에러" + e.Message); } if (string.IsNullOrEmpty(result.FeelsLike.Value) || string.Format("{0:F1}", dTemp) == string.Format("{0:F1}", dFeel)) { BrdLiveWeatherFeelTemp.Visibility = System.Windows.Visibility.Collapsed; } //현재 기온의 텍스트 크기가 변경이 되었다면... 단위와 소수점 크기도 변경 double rt = TxtLiveWeatherTemp.FontSize / orgFontSize; Thickness margin = GrdTempSub.Margin; margin.Top *= rt; GrdTempSub.Margin = margin; GrdTempSub.Height *= rt; TxtLiveWeatherTempUnits.FontSize *= rt; TxtLiveWeatherTempFloat.FontSize *= rt; }
private async Task UserInfo() { try { GetLoginInfoModel model = new GetLoginInfoModel(); if (Uid.Length != 0) { model = await GetUserInfo(Uid); // http://i0.hdslb.com/ } else { model = await GetUserInfo(); } if (model.approve) { if (model.official_verify.type != -1) { txt_RZ.Text = model.official_verify.desc; } txt_RZ.Visibility = Visibility.Visible; } else { txt_RZ.Visibility = Visibility.Collapsed; } grid_Info.DataContext = model; if (model.level_info.current_level <= 3) { bor_Level.Background = new SolidColorBrush(new Windows.UI.Color() { R = 48, G = 161, B = 255, A = 200 }); } else { if (model.current_level <= 6) { bor_Level.Background = new SolidColorBrush(new Windows.UI.Color() { R = 255, G = 48, B = 48, A = 200 }); } else { bor_Level.Background = new SolidColorBrush(new Windows.UI.Color() { R = 255, G = 199, B = 45, A = 200 }); } } if (model.vip.vipType != 0) { bor_Vip.Visibility = Visibility.Visible; } else { bor_Vip.Visibility = Visibility.Collapsed; } //if (model!=null&&model.toutu.Length!=0) //{ // img_bg.ImageSource = new BitmapImage(new Uri("http://i0.hdslb.com/"+model.toutu)); //} SettingHelper settings = new SettingHelper(); if (settings.SettingContains("UserWebTT")) { if ((bool)settings.GetSettingValue("UserWebTT")) { GetBg(); } else { img_bg.ImageSource = new BitmapImage(new Uri("ms-appx:///Assets/bg1.png")); } } else { settings.SetSettingValue("UserWebTT", false); img_bg.ImageSource = new BitmapImage(new Uri("ms-appx:///Assets/bg1.png")); } page = 1; MaxPage = 0; list_AUser.Items.Clear(); GetUserAttention(page); } catch (Exception) { messShow.Show("读取用户信息失败", 2000); // throw; } }
/// <summary> /// Initializes the <see cref="ActionPipelineService"/> class. /// </summary> static ActionPipelineService() { var configSection = SettingHelper.GetConfigurationSection(); }
public void SendEmail(MailMessage mail) { try { mail.From = new MailAddress(SettingHelper.GetSettingValue("Abp.Net.Mail.SenderAddress"), SettingHelper.GetSettingValue("Abp.Net.Mail.DisplayName")); using (var client = new SmtpClient(SettingHelper.GetSettingValue("Abp.Net.Mail.ServerAddress"), SettingHelper.GetSettingValue <int>("Abp.Net.Mail.ServerPort"))) { client.UseDefaultCredentials = false; client.Credentials = new System.Net.NetworkCredential(SettingHelper.GetSettingValue("Abp.Net.Mail.Username"), SettingHelper.GetSettingValue("Abp.Net.Mail.Password")); client.Send(mail); } } catch (Exception ex) { Logger.Warn("Could not send email!", ex); } }
private void performScheduledCommand() { switch (_commandScheduled) { case COMMAND_MAIN: for (int i = 0; i < menuItems.Length; i++) { menuItems[i] = null; } switchFlag(FLAG_MAIN); break; case COMMAND_QUICKPLAY: bool firstPlay = SettingHelper.GetSetting <bool>(PlayScene.RECORD_FIRST_PLAY, true); if (firstPlay) { confirmDialog.CommandCode = COMMAND_QUICKPLAY; confirmDialog.Title = Localize.Instance.PlayTutorial; confirmDialog.Content = Localize.Instance.PlayTutorialDescription; confirmDialog.FadeIn(UIDialogType.Confirm); } else { gameMode = GameMode.Classic; switchState(MenuState.Game); } break; case COMMAND_ADVENTURE: gameMode = GameMode.Adventure; switchState(MenuState.Game); break; case COMMAND_LEADERBOARD: Main.Instance.GotoLeaderboard(); break; case COMMAND_INSTRUCTION: for (int i = 0; i < menuItems.Length; i++) { menuItems[i] = null; } switchFlag(FLAG_INSTRUCTION); break; case COMMAND_HOWTO: Main.Instance.GotoInstruction(texHowToPlay); break; case COMMAND_TUTORIAL: gameMode = GameMode.Tutorial; _returnMenuAfterTutorial = true; switchState(MenuState.Game); break; case COMMAND_ABOUT: Main.Instance.GotoInstruction(texCredits); break; case COMMAND_MOREAPP: for (int i = 0; i < menuItems.Length; i++) { menuItems[i] = null; } switchFlag(FLAG_INSTRUCTION); break; case COMMAND_SPLASH: Main.Instance.GotoSplash(true); break; } }
private void InitializeBingSetting() { SetPickerSource(LanguageMarketPicker, BingMarkets.Markets, SettingHelper.GetString(Constants.BING_LANGUAGE_MARKET)); List <PickerItem> aspect = new List <PickerItem>(); aspect.Add(new PickerItem() { Key = "Tall", Name = AppResources.Tall }); aspect.Add(new PickerItem() { Key = "Wide", Name = AppResources.Wide }); SetPickerSource(BingSearchAspectPicker, aspect, SettingHelper.GetString(Constants.BING_SEARCH_ASPECT)); List <PickerItem> options = new List <PickerItem>(); options.Add(new PickerItem() { Key = "None", Name = AppResources.None }); options.Add(new PickerItem() { Key = "DisableLocationDetection", Name = AppResources.DisableLocationDetection }); options.Add(new PickerItem() { Key = "EnableHighlighting", Name = AppResources.EnableHighlighting }); SetPickerSource(BingSearchOptionsPicker, options, SettingHelper.GetString(Constants.BING_SEARCH_OPTIONS)); List <PickerItem> size = new List <PickerItem>(); size.Add(new PickerItem() { Key = "Large", Name = AppResources.Large }); size.Add(new PickerItem() { Key = "Medium", Name = AppResources.Medium }); size.Add(new PickerItem() { Key = "Small", Name = AppResources.Small }); size.Add(new PickerItem() { Key = "Custom", Name = AppResources.Custom }); string value = SettingHelper.GetString(Constants.BING_SEARCH_SIZE); string width = SettingHelper.GetString(Constants.BING_SEARCH_SIZE_WIDTH); string height = SettingHelper.GetString(Constants.BING_SEARCH_SIZE_HEIGHT); if (string.IsNullOrEmpty(width)) { width = (int)ResolutionHelper.CurrentResolution.Width + ""; SettingHelper.Set(Constants.BING_SEARCH_SIZE_WIDTH, width, false); } if (string.IsNullOrEmpty(height)) { height = (int)ResolutionHelper.CurrentResolution.Height + ""; SettingHelper.Set(Constants.BING_SEARCH_SIZE_HEIGHT, height, false); } BingSearchSizeWidth.Text = width; BingSearchSizeHeight.Text = height; SetPickerSource(BingSearchSizePicker, size, value); if (value == "Custom") { BingSearchCustomSize.Visibility = System.Windows.Visibility.Visible; } List <PickerItem> color = new List <PickerItem>(); color.Add(new PickerItem() { Key = "Color", Name = AppResources.Color }); color.Add(new PickerItem() { Key = "Monochrome", Name = AppResources.Monochrome }); SetPickerSource(BingSearchColorPicker, color, SettingHelper.GetString(Constants.BING_SEARCH_COLOR)); List <PickerItem> style = new List <PickerItem>(); style.Add(new PickerItem() { Key = "Photo", Name = AppResources.Photo }); style.Add(new PickerItem() { Key = "Graphics", Name = AppResources.Graphics }); SetPickerSource(BingSearchStylePicker, style, SettingHelper.GetString(Constants.BING_SEARCH_STYLE)); List <PickerItem> face = new List <PickerItem>(); face.Add(new PickerItem() { Key = "Face", Name = AppResources.Face }); face.Add(new PickerItem() { Key = "Portrait", Name = AppResources.Portrait }); face.Add(new PickerItem() { Key = "Other", Name = AppResources.Other }); SetPickerSource(BingSearchFacePicker, face, SettingHelper.GetString(Constants.BING_SEARCH_FACE)); List <PickerItem> count = new List <PickerItem>(); count.Add(new PickerItem() { Key = "20", Name = "20" }); count.Add(new PickerItem() { Key = "40", Name = "40" }); count.Add(new PickerItem() { Key = "60", Name = "60" }); //count.Add(new PickerItem() { Key = "80", Name = "80" }); //count.Add(new PickerItem() { Key = "100", Name = "100" }); SetPickerSource(BingSearchQueryCountPicker, count, SettingHelper.GetString(Constants.BING_SEARCH_COUNT)); List <PickerItem> adult = new List <PickerItem>(); adult.Add(new PickerItem() { Key = "Strict", Name = AppResources.Strict }); adult.Add(new PickerItem() { Key = "Moderate", Name = AppResources.Moderate }); adult.Add(new PickerItem() { Key = "Off", Name = AppResources.Off }); SetPickerSource(BingSearchAdultPicker, adult, SettingHelper.GetString(Constants.BING_SEARCH_ADULT)); LanguageMarketPicker.SelectionChanged += OnBingSearchPickerSelectionChanged; BingSearchOptionsPicker.SelectionChanged += OnBingSearchPickerSelectionChanged; BingSearchSizePicker.SelectionChanged += OnBingSearchPickerSelectionChanged; BingSearchAspectPicker.SelectionChanged += OnBingSearchPickerSelectionChanged; BingSearchColorPicker.SelectionChanged += OnBingSearchPickerSelectionChanged; BingSearchStylePicker.SelectionChanged += OnBingSearchPickerSelectionChanged; BingSearchFacePicker.SelectionChanged += OnBingSearchPickerSelectionChanged; BingSearchAdultPicker.SelectionChanged += OnBingSearchPickerSelectionChanged; BingSearchSizeWidth.TextChanged += BingSearchSizeWidth_TextChanged; BingSearchSizeHeight.TextChanged += BingSearchSizeHeight_TextChanged; BingSearchSizeWidth.MouseLeave += BingSearchSizeWidth_MouseLeave; BingSearchSizeHeight.MouseLeave += BingSearchSizeHeight_MouseLeave; DomainFilter.Text = string.Format("{0} ({1})", AppResources.DomainFilter, AppResources.BlackList); }
private async Task HandleLogin() { IsLogining = true; if (ApiHelper.userBasicDatas.ContainsKey(tbx_username.Text.Trim())) { MessageBox.Show("该账号已经添加!", "提示"); return; } ld.phone = tbx_username.Text.Trim(); ld.pwd = tbx_password.Password.Trim(); tbx_tip.Text = "正在登陆..."; HttpMessage resp = await ApiHelper.Login( ld.phone, ld.pwd, tbx_valicode.Text.Trim(), ld.account_type, ld.deviceid, ld.imeiid); switch (resp.statusCode) { case HttpStatusCode.OK: tbx_tip.Text = ""; loginResponse = resp.data as LoginResponse; if (loginResponse.iRet == 0) { var devices = await GetDevices(ld.phone); if (devices == null || devices.Count == 0) { MessageBox.Show("请先用app绑定玩客云设备", "错误"); LoginSuccess = false; IsLogining = false; return; } LoginSuccess = true; MessageBox.Show("登陆成功", "恭喜"); Debug.WriteLine(MainWindow.settings.loginDatas == null); if (MainWindow.settings.loginDatas == null) { MainWindow.settings.loginDatas = new List <LoginData>(); } MainWindow.settings.loginDatas.Add(ld); SettingHelper.WriteSettings(MainWindow.settings, MainWindow.password); //保存登陆信息 ApiHelper.userBasicDatas.Add(loginResponse.data.phone, loginResponse.data); //载入登陆响应信息到主窗口 this.Close(); } else if (loginResponse.iRet == -121) { MessageBox.Show("验证码输入错误", "错误(-121)"); ShowVali(true); RefreshVali(); Debug.WriteLine(this.url_login_vali); IsLogining = false; } else if (loginResponse.iRet == -122) { MessageBox.Show("请输入验证码", "提示(-122)"); ShowVali(true); this.url_login_vali = loginResponse.sMsg.Replace(@"\/", @"/"); this.url_login_vali = loginResponse.sMsg.Replace(@"http://account.onethingpcs.com/", ""); RefreshVali(); Debug.WriteLine(this.url_login_vali); IsLogining = false; } else { LoginSuccess = true; MessageBox.Show(loginResponse.sMsg, $"登陆失败({loginResponse.iRet})"); IsLogining = false; } break; default: tbx_tip.Text = ""; MessageBox.Show(resp.data.ToString(), "网络异常错误!"); IsLogining = false; break; } }
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); }
internal ViewerWindow() { // this object should be initialized before loading UI components, because many of which are binding to it. ContextObject = new ContextObject(); ContextObject.PropertyChanged += ContextObject_PropertyChanged; InitializeComponent(); Icon = (App.IsWin10 ? Properties.Resources.app_white_png : Properties.Resources.app_png).ToBitmapSource(); FontFamily = new FontFamily(TranslationHelper.Get("UI_FontFamily", failsafe: "Segoe UI")); SizeChanged += SaveWindowSizeOnSizeChanged; StateChanged += (sender, e) => _ignoreNextWindowSizeChange = true; windowFrameContainer.PreviewMouseMove += ShowWindowCaptionContainer; Topmost = SettingHelper.Get("Topmost", false); buttonTop.Tag = Topmost ? "Top" : "Auto"; buttonTop.Click += (sender, e) => { Topmost = !Topmost; SettingHelper.Set("Topmost", Topmost); buttonTop.Tag = Topmost ? "Top" : "Auto"; }; buttonPin.Click += (sender, e) => { if (Pinned) { return; } ViewWindowManager.GetInstance().ForgetCurrentWindow(); }; buttonCloseWindow.Click += (sender, e) => { if (Pinned) { BeginClose(); } else { ViewWindowManager.GetInstance().ClosePreview(); } }; buttonOpen.Click += (sender, e) => { if (Pinned) { RunAndClose(); } else { ViewWindowManager.GetInstance().RunAndClosePreview(); } }; buttonWindowStatus.Click += (sender, e) => WindowState = WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; buttonShare.Click += (sender, e) => ShareHelper.Share(_path, this); buttonOpenWith.Click += (sender, e) => ShareHelper.Share(_path, this, true); }
private async void FindLocation() { if (!SettingHelper.ContainsKey(Constants.WEATHER_LOCATION_CONSENT)) { MessageBoxResult result = MessageBox.Show(AppResources.MsgConfirmUseLocation, AppResources.AgreeUseLocation, MessageBoxButton.OKCancel); SettingHelper.Set(Constants.WEATHER_LOCATION_CONSENT, (result == MessageBoxResult.OK), false); } if (!SettingHelper.ContainsKey(Constants.WEATHER_LOCATION_CONSENT)) { // The user has opted out of Location. return; } Geolocator geolocator = new Geolocator(); geolocator.DesiredAccuracyInMeters = 50; try { Geoposition geoposition = await geolocator.GetGeopositionAsync( maximumAge : TimeSpan.FromMinutes(5), timeout : TimeSpan.FromSeconds(10) ); DisplayUnit unitType = (DisplayUnit)SettingHelper.Get(Constants.WEATHER_UNIT_TYPE); //날씨 조회 모드 설정 변경 WeatherCity city = new WeatherCity(); city.IsGpsLocation = true; city.Latitude = geoposition.Coordinate.Latitude.ToString(); city.Longitude = geoposition.Coordinate.Longitude.ToString(); //검색조건 저장 SettingHelper.Set(Constants.WEATHER_MAIN_CITY, city, false); //좌표로 날씨 조회 RetrieveWeather(city); } catch (Exception ex) { if ((uint)ex.HResult == 0x80004004) { //로딩 패널 제거 HideLoadingPanel(); // the application does not have the right capability or the location master switch is off //StatusTextBlock.Text = "location is disabled in phone settings."; if (MessageBox.Show(AppResources.MsgFailLocationService, AppResources.Confirm, MessageBoxButton.OKCancel) == MessageBoxResult.OK) { var navigate = Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings-location:")); } } //else { // something else happened acquring the location } } }
private void sw_HideStatus_Toggled(object sender, RoutedEventArgs e) { SettingHelper.Set_HideStatus(sw_HideStatus.IsOn); }
private void RefreshLiveWeather() { DisplayUnit weatherUnit = (DisplayUnit)SettingHelper.Get(Constants.WEATHER_UNIT_TYPE); weatherBug.RefreshLiveWeather(weatherUnit); }
private void sw_CloseAD_Toggled(object sender, RoutedEventArgs e) { SettingHelper.Set_HideAD(sw_CloseAD.IsOn); }
private void RetrieveWeather(WeatherCity city) { DisplayUnit unitType = (DisplayUnit)SettingHelper.Get(Constants.WEATHER_UNIT_TYPE); weatherBug.LiveWeather(city, unitType); }
private void sw_ForceAudio_Toggled(object sender, RoutedEventArgs e) { SettingHelper.Set_ForceAudio(sw_ForceAudio.IsOn); }
private void cbx_sortOrder_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { MainWindow.settings.SortOrder = cbx_sortOrder.SelectedIndex; SettingHelper.WriteSettings(MainWindow.settings, MainWindow.password); }
private void sw_DanmuBorder_Toggled(object sender, RoutedEventArgs e) { SettingHelper.Set_DMBorder(sw_DanmuBorder.IsOn); }
protected override void OnNavigatedFrom(NavigationEventArgs e) { base.OnNavigatedFrom(e); SettingHelper.Save(); }
private void slider_Num_ValueChanged(object sender, RangeBaseValueChangedEventArgs e) { SettingHelper.Set_DMNumber(Convert.ToInt32(slider_Num.Value)); }
public bool IsModifierAvailable(ModifierType.Type type) { return(SettingHelper.GetModifierLevel(type) .GetOrDefault(0) > 0 && GetModifierUnit(type) > 0); }
protected async override void OnNavigatedTo(NavigationEventArgs e) { if (SettingHelper.IsPc()) { sp_View.DisplayMode = SplitViewDisplayMode.CompactOverlay; } else { sp_View.DisplayMode = SplitViewDisplayMode.Overlay; } ChangeTheme(); timer = new DispatcherTimer(); timer.Interval = new TimeSpan(0, 0, 5); timer.Start(); timer.Tick += Timer_Tick; MessageCenter.ChanageThemeEvent += MessageCenter_ChanageThemeEvent; MessageCenter.MianNavigateToEvent += MessageCenter_MianNavigateToEvent; MessageCenter.InfoNavigateToEvent += MessageCenter_InfoNavigateToEvent; MessageCenter.PlayNavigateToEvent += MessageCenter_PlayNavigateToEvent; MessageCenter.HomeNavigateToEvent += MessageCenter_HomeNavigateToEvent; MessageCenter.BgNavigateToEvent += MessageCenter_BgNavigateToEvent;; MessageCenter.Logined += MessageCenter_Logined; MessageCenter.ChangeBg += MessageCenter_ChangeBg; //main_frame.Navigate(typeof(ChannelPage)); MessageCenter_ChangeBg(); main_frame.Visibility = Visibility.Visible; menu_List.SelectedIndex = 0; Can_Nav = false; Can_Nav = true; frame.Visibility = Visibility.Visible; frame.Navigate(typeof(BlankPage)); play_frame.Visibility = Visibility.Visible; play_frame.Navigate(typeof(BlankPage)); //LoadPlayApiInfo(); if (e.Parameter != null) { var m = e.Parameter as StartModel; switch (m.StartType) { case StartTypes.None: break; case StartTypes.Video: MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(VideoViewPage), m.Par1); break; case StartTypes.Live: MessageCenter.SendNavigateTo(NavigateMode.Play, typeof(LiveRoomPage), m.Par1); break; case StartTypes.Bangumi: MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(BanInfoPage), m.Par1); break; case StartTypes.MiniVideo: //MessageCenter.ShowMiniVideo(m.Par1); //MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(WebPage), "http://vc.bilibili.com/mobile/detail?vc=" + m.Par1); break; case StartTypes.Web: MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(WebPage), m.Par1); break; case StartTypes.Album: MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(DynamicInfoPage), m.Par1); break; case StartTypes.Article: MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(ArticleContentPage), m.Par1); break; case StartTypes.Music: MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(MusicInfoPage), m.Par1); break; case StartTypes.User: MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(UserCenterPage), m.Par1); break; case StartTypes.File: var files = m.Par3 as IReadOnlyList <IStorageItem>; List <PlayerModel> ls = new List <PlayerModel>(); int i = 1; foreach (StorageFile file in files) { ls.Add(new PlayerModel() { Mode = PlayMode.FormLocal, No = i.ToString(), VideoTitle = "", Title = file.DisplayName, Parameter = file, Aid = file.DisplayName, Mid = file.Path }); i++; } play_frame.Navigate(typeof(PlayerPage), new object[] { ls, 0 }); // MessageCenter.SendNavigateTo(NavigateMode.Play, typeof(PlayerPage), new object[] { ls, 0 }); break; case StartTypes.HandelUri: if (!await MessageCenter.HandelUrl(m.Par1)) { ContentDialog contentDialog = new ContentDialog() { PrimaryButtonText = "确定", Title = "不支持跳转的地址" }; TextBlock textBlock = new TextBlock() { Text = m.Par1, IsTextSelectionEnabled = true }; contentDialog.Content = textBlock; await contentDialog.ShowAsync(); } break; default: break; } } if (SettingHelper.Get_First()) { TextBlock tx = new TextBlock() { Text = string.Format(@"{0}", AppHelper.GetLastVersionStr()), IsTextSelectionEnabled = true, TextWrapping = TextWrapping.Wrap }; await new ContentDialog() { Content = tx, PrimaryButtonText = "知道了" }.ShowAsync(); SettingHelper.Set_First(false); } new AppHelper().GetDeveloperMessage(); account = new Account(); //检查登录状态 if (SettingHelper.Get_Access_key() != "") { if ((await account.CheckLoginState(ApiHelper.access_key)).success) { MessageCenter_Logined(); await account.SSO(ApiHelper.access_key); } else { var data = await account.RefreshToken(SettingHelper.Get_Access_key(), SettingHelper.Get_Refresh_Token()); if (!data.success) { Utils.ShowMessageToast("登录过期,请重新登录"); await Utils.ShowLoginDialog(); } } } }
void BingSearchSizeHeight_TextChanged(object sender, TextChangedEventArgs e) { SettingHelper.Set(Constants.BING_SEARCH_SIZE_HEIGHT, BingSearchSizeHeight.Text, false); }