public void Update() { // Check if a language is in the preferences that we have var prefLang = NSUserDefaults.StandardUserDefaults.ArrayForKey("AppleLanguages")[0].ToString(); var settingsLang = Settings.Current.GetValueOrDefault<string>(Settings.LanguageKey, string.Empty); var lang = string.IsNullOrEmpty(settingsLang) ? prefLang : settingsLang; // We don't want to have english as default language, because it is the development language if (!lang.Equals("en") && Array.IndexOf(NSBundle.MainBundle.Localizations, lang) >= 0) { langBundle = NSBundle.FromPath(NSBundle.MainBundle.PathForResource(lang, "lproj")); } else { // We want to use the default language langBundle = null; } // Activate Vernacular Catalog Catalog.Implementation = new ResourceCatalog { GetResourceById = id => { if (langBundle == null) return null; var resource = langBundle.LocalizedString(id, null); return resource == id ? null : resource; }, }; }
public static void setLanguage(string language) { if(!isLanguageSupport(language)) language = "en"; string path = NSBundle.MainBundle.PathForResource(language,"lproj"); bundle = NSBundle.FromPath (path); }
public PhotoViewController (string nibName, NSBundle bundle) : base (NSObjectFlag.Empty) { photoMap = new Dictionary<NSUrl, string> (); # if USE_FULLSCREEN_LAYOUT WantsFullScreenLayout = true; #endif }
public EmployeeTableViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { m_arrEmployee = new ObservableCollection<Employee>(); Title = NSBundle.MainBundle.LocalizedString("Employees", "Master"); }
public XIBLessController(string nibName, NibManager nibManager, NSBundle mainBundle) : base() { this.Manager = nibManager; this.LoadFromNib(nibName, mainBundle); this.ViewDidLoad(); }
public SecondViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { this.Title = NSBundle.MainBundle.LocalizedString ("Second", "Second"); //this.TabBarItem.Image = UIImage.FromBundle ("Images/second"); this.TabBarItem.Image = UIImage.FromFile("Images/second.png"); }
public MvxSimpleTableViewSource(UITableView tableView, string nibName, string cellIdentifier = null, NSBundle bundle = null) : base(tableView) { cellIdentifier = cellIdentifier ?? "CellId" + nibName; _cellIdentifier = new NSString(cellIdentifier); tableView.RegisterNibForCellReuse(UINib.FromName(nibName, bundle ?? NSBundle.MainBundle), cellIdentifier); }
public MainViewController (string nibName, NSBundle bundle) : base (nibName, bundle) { // Custom initialization info.TipValueChanged += (sender, e) => { TipValue.Text = info.TipValue.ToString (); Total.Text = (info.TipValue + info.Total).ToString (); }; }
public MvxSimpleTableViewSource(UITableView tableView, string nibName, string cellIdentifier = null, NSBundle bundle = null) : base(tableView) { // if no cellIdentifier supplied, then use the nibName as cellId cellIdentifier = cellIdentifier ?? nibName; this._cellIdentifier = new NSString(cellIdentifier); tableView.RegisterNibForCellReuse(UINib.FromName(nibName, bundle ?? NSBundle.MainBundle), cellIdentifier); }
public MasterViewController (string nibNameOrNull, NSBundle nibBundleOrNull) : base (nibNameOrNull, nibBundleOrNull) { titles [0] = "Faust - Erste Szene"; titles [1] = "Julius Caesar - Antony's speech"; titles [2] = "Midsummer Night's Dream - Exit speech"; titles [3] = "Romeo & Juliet - Queen Mab"; titles [4] = "Troilus and Cressida - Ulysses"; LoadPagesFromResource ("/Pages"); }
static Settings() { string resourcePath = NSBundle.MainBundle.PathForResource(NSLocale.PreferredLanguages[0], "lproj"); if(string.IsNullOrEmpty(resourcePath)) { resourcePath = NSBundle.MainBundle.PathForResource("en", "lproj"); } localeBundle = NSBundle.FromPath(resourcePath); }
static string[] GetBackgroundModes(NSBundle bundle) { var backgroundModes = bundle.ObjectForInfoDictionary("UIBackgroundModes"); if (backgroundModes == null) { return new string[0]; } return NSArray.StringArrayFromHandle(backgroundModes.Handle); }
public MvxTouchControl(string nibName, NSBundle bundle) : base(nibName, bundle) { //Hack: iOS crashes if you create a MvxUIViewController without DataContext DataContext = new object (); if (!Mvx.CanResolve<IMvxControlsContainer>()) new Plugin().Load(); _container = Mvx.Resolve<IMvxControlsContainer>(); _container.Add(this); }
public static void RequestAuthorization(this CLLocationManager manager, NSBundle bundle) { if (bundle.RequiresBackgroundLocation()) { bundle.ThrowIfNoBackgroundDescription(); manager.RequestAlwaysAuthorization(); } else { bundle.ThrowIfNoInUseDescription(); manager.RequestWhenInUseAuthorization(); } }
static void ThrowIfNoDescription(NSBundle bundle, string key) { if (!UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { return; } var backgroundModes = bundle.ObjectForInfoDictionary(key); if (backgroundModes == null) { throw new InvalidOperationException(string.Format("You must provide a value for {0} in Info.plist to use location services", key)); } }
protected MvvmTabBarController(string nibName, NSBundle bundle) : base(nibName, bundle) { }
public AccountViewController( string nibName, NSBundle bundle ) : base(nibName, bundle) { }
public MvvmNavigationController(string nibName, NSBundle bundle) : base(nibName, bundle) { }
public QuartzViewController(string nib, NSBundle bundle) : base(nib, bundle) { }
public CollectionViewSource(UICollectionView collectionView, string nibName, string cellIdentifier = null, NSBundle bundle = null) : base(collectionView) { cellIdentifier = cellIdentifier ?? nibName; this.cellIdentifier = new NSString(cellIdentifier); collectionView.RegisterNibForCell(UINib.FromName(nibName, bundle ?? NSBundle.MainBundle), cellIdentifier); }
protected MvxBindingTouchViewController(MvxShowViewModelRequest request, string nibName, NSBundle bundle) : base(request, nibName, bundle) { }
protected MvxEventSourceTableViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { }
public RotatingViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { initialize(); }
/// <summary> /// Initializes a new instance of the <see cref="ReactiveViewController{TViewModel}"/> class. /// </summary> /// <param name="nibNameOrNull">The name.</param> /// <param name="nibBundleOrNull">The bundle.</param> protected ReactiveViewController(string nibNameOrNull, NSBundle nibBundleOrNull) : base(nibNameOrNull, nibBundleOrNull) { }
/// <summary> /// Initializes a new instance of the <see cref="ReactiveTabBarController"/> class. /// </summary> /// <param name="nibName">The name.</param> /// <param name="bundle">The bundle.</param> protected ReactiveTabBarController(string nibName, NSBundle bundle) : base(nibName, bundle) { }
private LocalizedStrings() { var path = NSBundle.MainBundle.PathForResource("en", "lproj"); __LanguageBundle = NSBundle.FromPath(path); }
public ViewTransitionsViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { }
public RotatingViewController (string nibName, NSBundle bundle) : base(nibName, bundle) { }
public void LoadFromNib(string nibName, NSBundle bundle) { this.Manager.LoadController<XIBLessController>(this, nibName, bundle); }
protected BaseViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { }
public OpenGLViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { _onLoadedAction = (width, height) => SparrowSharpApp.Start(width, height, typeof(Benchmark)); }
public MvxViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { this.AdaptForBinding(); }
public virtual async Task <Tuple <Stream, LoadingResult, ImageInformation> > Resolve(string identifier, TaskParameter parameters, CancellationToken token) { NSBundle bundle = null; var filename = Path.GetFileNameWithoutExtension(identifier); var tmpPath = Path.GetDirectoryName(identifier).Trim('/'); var filenamePath = string.IsNullOrWhiteSpace(tmpPath) ? null : tmpPath + "/"; foreach (var fileType in fileTypes) { string file = null; var extension = Path.HasExtension(identifier) ? Path.GetExtension(identifier) : string.IsNullOrWhiteSpace(fileType) ? string.Empty : "." + fileType; token.ThrowIfCancellationRequested(); int scale = (int)ScaleHelper.Scale; if (scale > 1) { while (scale > 1) { token.ThrowIfCancellationRequested(); var tmpFile = string.Format("{0}@{1}x{2}", filename, scale, extension); bundle = NSBundle._AllBundles.FirstOrDefault(bu => { var path = string.IsNullOrWhiteSpace(filenamePath) ? bu.PathForResource(tmpFile, null) : bu.PathForResource(tmpFile, null, filenamePath); return(!string.IsNullOrWhiteSpace(path)); }); if (bundle != null) { file = tmpFile; break; } scale--; } } token.ThrowIfCancellationRequested(); if (file == null) { var tmpFile = string.Format(filename + extension); file = tmpFile; bundle = NSBundle._AllBundles.FirstOrDefault(bu => { var path = string.IsNullOrWhiteSpace(filenamePath) ? bu.PathForResource(tmpFile, null) : bu.PathForResource(tmpFile, null, filenamePath); return(!string.IsNullOrWhiteSpace(path)); }); } token.ThrowIfCancellationRequested(); if (bundle != null) { var path = bundle.PathForResource(file, null); var stream = FileStore.GetInputStream(path, true); var imageInformation = new ImageInformation(); imageInformation.SetPath(identifier); imageInformation.SetFilePath(path); return(new Tuple <Stream, LoadingResult, ImageInformation>( stream, LoadingResult.CompiledResource, imageInformation)); } token.ThrowIfCancellationRequested(); if (string.IsNullOrEmpty(fileType)) { //Asset catalog if (UIDevice.CurrentDevice.CheckSystemVersion(9, 0)) { NSDataAsset asset = null; try { await MainThreadDispatcher.Instance.PostAsync(() => asset = new NSDataAsset(filename)).ConfigureAwait(false); } catch (Exception) { } if (asset != null) { token.ThrowIfCancellationRequested(); var stream = asset.Data?.AsStream(); var imageInformation = new ImageInformation(); imageInformation.SetPath(identifier); imageInformation.SetFilePath(null); return(new Tuple <Stream, LoadingResult, ImageInformation>( stream, LoadingResult.CompiledResource, imageInformation)); } } else if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0)) { UIImage image = null; try { await MainThreadDispatcher.Instance.PostAsync(() => image = UIImage.FromBundle(filename)).ConfigureAwait(false); } catch (Exception) { } if (image != null) { token.ThrowIfCancellationRequested(); var stream = image.AsPNG()?.AsStream(); var imageInformation = new ImageInformation(); imageInformation.SetPath(identifier); imageInformation.SetFilePath(null); return(new Tuple <Stream, LoadingResult, ImageInformation>( stream, LoadingResult.CompiledResource, imageInformation)); } } } } throw new FileNotFoundException(identifier); }
// Call to load from the XIB/NIB file public MvxWindowController(string viewName, NSBundle bundle) : base(viewName, bundle) { }
protected MvvmCollectionViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { }
public Touches_ClassicViewController(UIWindow window, string nibName, NSBundle bundle) : base(nibName, bundle) { this.window = window; }
protected MvxCollectionViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { this.AdaptForBinding(); }
static NSBundle RetrieveLanguageBundle(string Language) { var Path = NSBundle.MainBundle.PathForResource(Language, "lproj"); return(NSBundle.FromPath(Path)); }
public NBMaterialDialog(string nibName, NSBundle bundle) : base(nibName, bundle) { Initialize(UIColor.White); }
public TabBarViewBase(string nibName, NSBundle bundle) : base(nibName, bundle) { }
protected ReactiveSplitViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { setupRxObj(); }
public MvvmSplitViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { }
public XViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { }
public Protocols_Delegates_EventsViewController (string nibName, NSBundle bundle) : base (nibName, bundle) { }
public TestFlightSampleViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { }
public FlipsideViewController (string nibName, NSBundle bundle) : base (nibName, bundle) { this.ContentSizeForViewInPopover = new SizeF (320f, 480f); }
public StatusBarController(string nibName, NSBundle bundle) : base(nibName, bundle) { //Prepare(); }
public UIViewControllerWithPopover(string nibName, NSBundle bundle, Action <object> callbackAction) : base(nibName, bundle) { _CallbackAction = callbackAction; }
/// <summary> /// Initializes a new instance of the <see cref="CustomDialogBase"/> class. /// </summary> /// <param name="name">Name.</param> /// <param name="p">Bundle.</param> protected CustomDialogBase(string name, NSBundle p) : base(name, p) { Initialize(); }
public TCConsultationTemplateViewController (string nibName, NSBundle bundle) : base (nibName, bundle) { }
public ScrollingNavigationTableViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { }
protected MvxTableViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { this.AdaptForBinding(); }
public Transitioning_To_Xcode_4ViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { }
public BaseView(string nibName, NSBundle bundle) : base(nibName, bundle) { }
public MessageContentViewController(LogJoint.UI.Mac.IView ljView, NSBundle bundle) : base("MessageContentView", bundle) { this.ljView = ljView; }
public OpenGLViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { }
protected BaseView(string nibName, NSBundle bundle) : base(nibName, bundle) { }