Last active
October 27, 2015 09:49
-
-
Save konradbartecki/8456910488a380da8036 to your computer and use it in GitHub Desktop.
Windows Phone 8.1 Helpers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class InputScopeHelper | |
{ | |
public static InputScope GetSingleScope(InputScopeNameValue myscope) | |
{ | |
InputScope scope = new InputScope(); | |
InputScopeName name = new InputScopeName(); | |
name.NameValue = myscope; | |
scope.Names.Add(name); | |
return scope; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Globalization; | |
using Windows.ApplicationModel.Resources.Core; | |
using Windows.UI.Xaml; | |
using Windows.UI.Xaml.Controls; | |
namespace WindowsPhoneHelpers | |
{ | |
public static class LanguageSwitchHelper | |
{ | |
public static void ChangeLanguage(string code, FlowDirection flowDirection) | |
{ | |
var culture = new CultureInfo(code); | |
Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = culture.Name; | |
CultureInfo.DefaultThreadCurrentCulture = culture; | |
CultureInfo.DefaultThreadCurrentUICulture = culture; | |
var frame = Window.Current.Content as Frame; | |
if (frame != null) | |
frame.FlowDirection = flowDirection; | |
var loader = new Windows.ApplicationModel.Resources.ResourceLoader(); | |
ResourceManager.Current.DefaultContext.Reset(); | |
Windows.ApplicationModel.Resources.Core.ResourceContext.GetForCurrentView().Reset(); | |
Windows.ApplicationModel.Resources.Core.ResourceContext.GetForViewIndependentUse().Reset(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace WindowsPhoneHelpers | |
{ | |
public static class LocalSettingsHelper | |
{ | |
public static bool? GetBool(string key) | |
{ | |
try | |
{ | |
bool b = (bool) Windows.Storage.ApplicationData.Current.LocalSettings.Values[key]; | |
return b; | |
} | |
catch (NullReferenceException) | |
{ | |
return null; | |
} | |
} | |
public static void SaveBool(string key, bool value) | |
{ | |
Windows.Storage.ApplicationData.Current.LocalSettings.Values[key] = value; | |
} | |
public static string GetString(string key) | |
{ | |
try | |
{ | |
string s = Windows.Storage.ApplicationData.Current.LocalSettings.Values[key] as string; | |
return s; | |
} | |
catch (NullReferenceException) | |
{ | |
return null; | |
} | |
} | |
public static void SaveString(string key, string value) | |
{ | |
Windows.Storage.ApplicationData.Current.LocalSettings.Values[key] = value; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Windows.UI.ViewManagement; | |
namespace WindowsPhoneHelpers | |
{ | |
public static class ProgressIndicatorHelper | |
{ | |
public static void ShowLoader(string loaderMessage) | |
{ | |
StatusBarProgressIndicator progressbar = StatusBar.GetForCurrentView().ProgressIndicator; | |
progressbar.Text = loaderMessage; | |
progressbar.ShowAsync(); | |
} | |
public static void HideLoader() | |
{ | |
StatusBarProgressIndicator progressbar = StatusBar.GetForCurrentView().ProgressIndicator; | |
progressbar.HideAsync(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment