Пример #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            tableView.WeakDataSource = tableView.WeakDelegate = this;

            _goBack.TouchUpInside += (sender, e) => this.RevealViewController().RevealToggleAnimated(true);

            _innboxLabel.TouchUpInside += (sender, e) =>
            {
                try
                {
                    var controller =
                        Storyboard.InstantiateViewController("MessageboxIdentifier") as MessageboxController;
                    if (controller != null)
                    {
                        controller.MMBType = Constants.MMBType.Messagebox;
                        this.RevealViewController().SetFrontViewController(controller, true);
                    }
                }
                catch (Exception ex)
                {
                    Logger.Logg(ex);
                }
            };

            _trans = new Translate();
            View.AddGestureRecognizer(this.RevealViewController().PanGestureRecognizer);
            //Make sure the fields are blanked out
            _searchField.Placeholder = _trans.GetString("Misc_SearchboxPlaceholder");
            _searchField.TextChanged += SearchTextChanged;
            _searchField.OnEditingStopped += SearchStopped;
            _searchField.OnEditingStarted += SearchStarted;
            _searchField.CancelButtonClicked += CancelButtonClicked;
            _searchField.SearchButtonClicked += SearchButtonClicked;

            Localize();
        }
Пример #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.LightContent, false);
            _trans = new CorePlatform.Translate();

            _loginIdPortenWebController =
                Storyboard.InstantiateViewController("LoginWebController") as LoginWebController;

            OpenLanguage.TouchUpInside += (sender, e) =>
            {
                var prompt = new UIAlertView(string.Empty, _trans.GetString("Popup_SelectLanguage"), null,
                    _trans.GetString("Misc_Cancel"),
                    new[]
                    {
                        _trans.GetString("Misc_Lang_Bokmaal"), _trans.GetString("Misc_Lang_Nynorsk"),
                        _trans.GetString("Misc_Lang_English")
                    })
                {
                    AlertViewStyle = UIAlertViewStyle.Default
                };

                prompt.Clicked += (s, b) =>
                {
                    Localize();
                    if (b.ButtonIndex == 0)
                    {
                    }
                    else if (b.ButtonIndex == 1)
                    {
                        AppContext.CurrentCulture = "nb-NO";
                        AppContext.CurrentLanguage = "1044";
                    }
                    else if (b.ButtonIndex == 2)
                    {
                        AppContext.CurrentCulture = "nn-NO";
                        AppContext.CurrentLanguage = "2068";
                    }
                    else if (b.ButtonIndex == 3)
                    {
                        AppContext.CurrentCulture = "en";
                        AppContext.CurrentLanguage = "1033";
                    }
                    Util.Util.SetLanguage();
                    Localize();
                };
                prompt.Show();
            };

            //Add this as an observer of the Settings
            NSNotificationCenter.DefaultCenter.AddObserver(new NSString("NSUserDefaultsDidChangeNotification"),
                // ReSharper disable once RedundantLambdaParameterType
                (NSNotification obj) =>
                {
                    NSUserDefaults.StandardUserDefaults.Synchronize();
                    LoadSettings();
                });

            Util.Util.Root = this;

            AppContext.hasLaunched = NSUserDefaults.StandardUserDefaults.BoolForKey("hasLaunched");

            if (!AppContext.hasLaunched)
            {
                NSUserDefaults.StandardUserDefaults.SetBool(true, "hasLaunched");
            }
        }