Beispiel #1
0
		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;
					},
				};
		}
Beispiel #2
0
		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");
		}
Beispiel #11
0
        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)
 {
 }
Beispiel #23
0
 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)
 {
 }
 public MvvmNavigationController(string nibName, NSBundle bundle)
     : base(nibName, bundle)
 {
 }
Beispiel #27
0
        private LocalizedStrings()
        {
            var path = NSBundle.MainBundle.PathForResource("en", "lproj");

            __LanguageBundle = NSBundle.FromPath(path);
        }
Beispiel #28
0
 protected MvvmTabBarController(string nibName, NSBundle bundle)
     : base(nibName, bundle)
 {
 }
Beispiel #29
0
 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);
 }
Beispiel #32
0
 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();
 }
Beispiel #35
0
        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)
 {
 }
Beispiel #37
0
 protected MvvmCollectionViewController(string nibName, NSBundle bundle)
     : base(nibName, bundle)
 {
 }
Beispiel #38
0
 public Touches_ClassicViewController(UIWindow window, string nibName, NSBundle bundle) : base(nibName, bundle)
 {
     this.window = window;
 }
Beispiel #39
0
 protected MvxEventSourceTableViewController(string nibName, NSBundle bundle)
     : base(nibName, bundle)
 {
 }
Beispiel #40
0
 protected MvxCollectionViewController(string nibName, NSBundle bundle)
     : base(nibName, bundle)
 {
     this.AdaptForBinding();
 }
Beispiel #41
0
        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);
 }
Beispiel #43
0
 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)
 {
 }
Beispiel #46
0
 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);
		}
Beispiel #50
0
 public StatusBarController(string nibName, NSBundle bundle) : base(nibName, bundle)
 {
     //Prepare();
 }
 public UIViewControllerWithPopover(string nibName, NSBundle bundle, Action <object> callbackAction)
     : base(nibName, bundle)
 {
     _CallbackAction = callbackAction;
 }
Beispiel #52
0
 /// <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();
 }
Beispiel #56
0
 public Transitioning_To_Xcode_4ViewController(string nibName, NSBundle bundle) : base(nibName, bundle)
 {
 }
Beispiel #57
0
 public BaseView(string nibName, NSBundle bundle) : base(nibName, bundle)
 {
 }
Beispiel #58
0
 public MessageContentViewController(LogJoint.UI.Mac.IView ljView, NSBundle bundle) :
     base("MessageContentView", bundle)
 {
     this.ljView = ljView;
 }
 public OpenGLViewController(string nibName, NSBundle bundle)
     : base(nibName, bundle)
 {
 }
Beispiel #60
0
 protected BaseView(string nibName, NSBundle bundle) : base(nibName, bundle)
 {
 }