Example #1
0
        public GameLoop CreateGame(IHud hud, IInput input, IRandom random)
        {
            Settings = LoadSettingsFromAppConfig();

            var services = new ServiceCollection();

            // todo Each setting goes with scenario. Can combine in the likeness of a scheme
            services
            .AddSingleton <GameLoop>()
            .AddSingleton <IBindings, GameConfigBindings>()
            .AddSingleton <IScenarioSelector, TypeNameScenarioSelector>()
            .AddSingleton <IScenario, HealerScenario>()
            .AddSingleton <IScenario, DealerScenario>()
            .AddSingleton <IScenario, WeaponScenario>()
            .AddSingleton <IScenario, MonsterScenario>()
            .AddSingleton <IMonster, DefaultMonster>()
            .AddSingleton(random)
            .AddSingleton(hud)
            .AddSingleton(input)
            .AddSingleton(Settings.Bindings)
            .AddSingleton(Settings.Hero)
            .AddSingleton(Settings.Healer)
            .AddSingleton(Settings.Dealer)
            .AddSingleton(Settings.Weapon)
            .AddSingleton(Settings.Monster)
            .AddSingleton(Settings);

            return(services.BuildServiceProvider().GetService <GameLoop>());
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ImageView.Image = UIImageHelper.FromFileAuto("iTunesArtwork");
            CancelButton.SetBackgroundImage(Images.Buttons.GreyButton.CreateResizableImage(new UIEdgeInsets(18, 18, 18, 18)), UIControlState.Normal);
            CancelButton.TintColor = UIColor.Black;
            CancelButton.Layer.ShadowColor = UIColor.Black.CGColor;
            CancelButton.Layer.ShadowOffset = new SizeF(0, 1);
            CancelButton.Layer.ShadowOpacity = 0.3f;
            CancelButton.TouchUpInside += (sender, e) => DismissViewController(true, OnDismissed);

            EnableButton.SetBackgroundImage(Images.Buttons.BlackButton.CreateResizableImage(new UIEdgeInsets(18, 18, 18, 18)), UIControlState.Normal);
            EnableButton.TintColor = UIColor.White;
            EnableButton.Layer.ShadowColor = UIColor.Black.CGColor;
            EnableButton.Layer.ShadowOffset = new SizeF(0, 1);
            EnableButton.Layer.ShadowOpacity = 0.3f;
            EnableButton.TouchUpInside += EnablePushNotifications;

            var lbl = new UILabel();
            lbl.Frame = new RectangleF(ImageView.Frame.Width - 25, -15, 40, 40);
            lbl.TextAlignment = UITextAlignment.Center;
            lbl.Layer.CornerRadius = lbl.Frame.Width / 2;
            lbl.Layer.MasksToBounds = true;
            lbl.BackgroundColor = UIColor.Red;
            lbl.Text = "12";
            lbl.Font = UIFont.SystemFontOfSize(18f);
            lbl.TextColor = UIColor.White;

            ImageView.AddSubview(lbl);

            _hud = new Hud(View);
        }
Example #3
0
        public LoginView()
            : base(false)
        {
            Title = "Login";
			NavigationItem.RightBarButtonItem = new MonoTouch.UIKit.UIBarButtonItem(MonoTouch.UIKit.UIBarButtonSystemItem.Action, (s, e) => ShowExtraMenu());
            _hud = this.CreateHud();
        }
Example #4
0
 public AddAccountView()
     : base("AddAccountView", null)
 {
     Title = "Login".t();
     NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Theme.CurrentTheme.BackButton, UIBarButtonItemStyle.Plain, (s, e) => NavigationController.PopViewControllerAnimated(true));
     _hud = this.CreateHud();
 }
Example #5
0
        protected override void LoadContent()
        {
            this.spriteBatch = new SpriteBatch(GraphicsDevice);

            this.GameState = DefaultGameType;

            this.SoundManager.LoadContent(this.Content, BonusColisionSoundFile, ObstacleColisionSoundFile, GameTheamMusicFile);

            MediaPlayer.Play(this.SoundManager.BGMusic);
            this.road.LoadContent(this.Content, BackgroundImage);

            this.MenuImage     = Content.Load <Texture2D>(StartMenuImage);
            this.GameOverImage = Content.Load <Texture2D>(GameOverMenuImage);
            this.YouWinImage   = Content.Load <Texture2D>(YouWinMenuImage);

            this.player = new PlayerCar(
                Content.Load <Texture2D>(CarImage),
                new Vector2(Graphic.CarInitialPositionX, Graphic.CarInitialPositionX),
                Movement.CarSpeed);

            this.progressPlayer = new ProgressCar(
                Content.Load <Texture2D>(ProgressCarImage),
                new Vector2(Graphic.PlayerProgressPositionX, Graphic.PlayerProgressPositionY),
                InitialProgressCarSpeed);

            this.hud = new HUD(this.player, this.progressPlayer, EightBitFontFile, HelthBarBorderImage, ProgressCarFinishFlag);
            this.hud.LoadContent(this.Content, HealthBarImage);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ImageView.Image = UIImageHelper.FromFileAuto("iTunesArtwork");
            CancelButton.SetBackgroundImage(Images.Buttons.GreyButton.CreateResizableImage(new UIEdgeInsets(18, 18, 18, 18)), UIControlState.Normal);
            CancelButton.TintColor           = UIColor.Black;
            CancelButton.Layer.ShadowColor   = UIColor.Black.CGColor;
            CancelButton.Layer.ShadowOffset  = new SizeF(0, 1);
            CancelButton.Layer.ShadowOpacity = 0.3f;
            CancelButton.TouchUpInside      += (sender, e) => DismissViewController(true, OnDismissed);

            EnableButton.SetBackgroundImage(Images.Buttons.BlackButton.CreateResizableImage(new UIEdgeInsets(18, 18, 18, 18)), UIControlState.Normal);
            EnableButton.TintColor           = UIColor.White;
            EnableButton.Layer.ShadowColor   = UIColor.Black.CGColor;
            EnableButton.Layer.ShadowOffset  = new SizeF(0, 1);
            EnableButton.Layer.ShadowOpacity = 0.3f;
            EnableButton.TouchUpInside      += EnablePushNotifications;

            var lbl = new UILabel();

            lbl.Frame               = new RectangleF(ImageView.Frame.Width - 25, -15, 40, 40);
            lbl.TextAlignment       = UITextAlignment.Center;
            lbl.Layer.CornerRadius  = lbl.Frame.Width / 2;
            lbl.Layer.MasksToBounds = true;
            lbl.BackgroundColor     = UIColor.Red;
            lbl.Text      = "12";
            lbl.Font      = UIFont.SystemFontOfSize(18f);
            lbl.TextColor = UIColor.White;

            ImageView.AddSubview(lbl);

            _hud = new Hud(View);
        }
Example #7
0
 public AddAccountView()
     : base("AddAccountView", null)
 {
     Title = "Login".t();
     NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Theme.CurrentTheme.BackButton, UIBarButtonItemStyle.Plain, (s, e) => NavigationController.PopViewControllerAnimated(true));
     _hud = this.CreateHud();
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.View.AutosizesSubviews = true;

            ImageView.Image = Images.Logos.Enterprise;
            ImageView.Layer.CornerRadius = 24f;
            ImageView.Layer.MasksToBounds = true;

            CancelButton.SetBackgroundImage(Images.Buttons.GreyButton.CreateResizableImage(new UIEdgeInsets(18, 18, 18, 18)), UIControlState.Normal);
            CancelButton.TintColor = UIColor.Black;
            CancelButton.Layer.ShadowColor = UIColor.Black.CGColor;
            CancelButton.Layer.ShadowOffset = new SizeF(0, 1);
            CancelButton.Layer.ShadowOpacity = 0.3f;
            CancelButton.TouchUpInside += (sender, e) => DismissViewController(true, OnDismissed);

            EnableButton.SetBackgroundImage(Images.Buttons.BlackButton.CreateResizableImage(new UIEdgeInsets(18, 18, 18, 18)), UIControlState.Normal);
            EnableButton.TintColor = UIColor.White;
            EnableButton.Layer.ShadowColor = UIColor.Black.CGColor;
            EnableButton.Layer.ShadowOffset = new SizeF(0, 1);
            EnableButton.Layer.ShadowOpacity = 0.3f;
            EnableButton.TouchUpInside += EnablePushNotifications;

            _hud = new Hud(View);
        }
Example #9
0
 public LoginView()
     : base(false)
 {
     Title = "Login";
     NavigationItem.RightBarButtonItem = new MonoTouch.UIKit.UIBarButtonItem(MonoTouch.UIKit.UIBarButtonSystemItem.Action, (s, e) => ShowExtraMenu());
     _hud = this.CreateHud();
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.View.AutosizesSubviews = true;

            ImageView.Image = UIImageHelper.FromFileAuto("iTunesArtwork");
            ImageView.Layer.CornerRadius  = 24f;
            ImageView.Layer.MasksToBounds = true;

            CancelButton.SetBackgroundImage(Images.Buttons.GreyButton.CreateResizableImage(new UIEdgeInsets(18, 18, 18, 18)), UIControlState.Normal);
            CancelButton.TintColor           = UIColor.Black;
            CancelButton.Layer.ShadowColor   = UIColor.Black.CGColor;
            CancelButton.Layer.ShadowOffset  = new SizeF(0, 1);
            CancelButton.Layer.ShadowOpacity = 0.3f;
            CancelButton.TouchUpInside      += (sender, e) => DismissViewController(true, OnDismissed);

            EnableButton.SetBackgroundImage(Images.Buttons.BlackButton.CreateResizableImage(new UIEdgeInsets(18, 18, 18, 18)), UIControlState.Normal);
            EnableButton.TintColor           = UIColor.White;
            EnableButton.Layer.ShadowColor   = UIColor.Black.CGColor;
            EnableButton.Layer.ShadowOffset  = new SizeF(0, 1);
            EnableButton.Layer.ShadowOpacity = 0.3f;
            EnableButton.TouchUpInside      += EnablePushNotifications;

            PushLabel.Layer.CornerRadius  = PushLabel.Frame.Width / 2;
            PushLabel.Layer.MasksToBounds = true;

            _hud = new Hud(View);
        }
Example #11
0
 public GameLoop(IHud hud, HeroState hero, IScenarioSelector selector, IInput input, GameConfiguration config)
 {
     _hud      = hud;
     _hero     = hero;
     _selector = selector;
     _input    = input;
     _config   = config;
 }
 public LocalSongListActions(SongListViewModel viewModel)
 {
     fileManager = new FirebaseStorageFileManager();
     fileManager.OnFileDownloaded += FileManager_OnFileDownloaded;
     audioPlayer    = DependencyService.Get <IAudioPlayer>();
     hud            = DependencyService.Get <IHud>();
     this.viewModel = viewModel;
 }
Example #13
0
        public override void ViewDidLoad()
        {
            NoItemsText = "No Notifications".t();
            Title = "Notifications".t();

            base.ViewDidLoad();

            _markHud = new Hud(View);
            _segmentBarButton.Width = View.Frame.Width - 10f;
            ToolbarItems = new [] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _segmentBarButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) };

            var vm = (NotificationsViewModel)ViewModel;
            NavigationItem.RightBarButtonItem = new UIBarButtonItem(Theme.CurrentTheme.CheckButton, UIBarButtonItemStyle.Plain, (s, e) => vm.ReadAllCommand.Execute(null));
            vm.ReadAllCommand.CanExecuteChanged += (sender, e) => NavigationItem.RightBarButtonItem.Enabled = vm.ReadAllCommand.CanExecute(null);

            vm.Bind(x => x.IsMarking, x =>
            {
                if (x)
                    _markHud.Show("Marking...");
                else
                    _markHud.Hide();
            });

            BindCollection(vm.Notifications, x =>
            {
                var el = new StyledStringElement(x.Subject.Title, x.UpdatedAt.ToDaysAgo(), UITableViewCellStyle.Subtitle) { Accessory = UITableViewCellAccessory.DisclosureIndicator };

                var subject = x.Subject.Type.ToLower();
                if (subject.Equals("issue"))
                    el.Image = Images.Flag;
                else if (subject.Equals("pullrequest"))
                    el.Image = Images.Hand;
                else if (subject.Equals("commit"))
                    el.Image = Images.Commit;
                else if (subject.Equals("release"))
                    el.Image = Images.Tag;
                else
                    el.Image = Images.Notifications;

                el.Tapped += () => vm.GoToNotificationCommand.Execute(x);
                return el;
            });

            var set = this.CreateBindingSet<NotificationsView, NotificationsViewModel>();
            set.Bind(_viewSegment).To(x => x.ShownIndex);
            set.Apply();
        }
Example #14
0
 public override void ViewDidLoad()
 {
     Title = "Create Gist";
     _hud = this.CreateHud();
     base.ViewDidLoad();
     NavigationItem.RightBarButtonItem = new UIBarButtonItem(Theme.CurrentTheme.SaveButton, UIBarButtonItemStyle.Plain, (s, e) => ViewModel.SaveCommand.Execute(null));
     ViewModel.Bind(x => x.Description, UpdateView);
     ViewModel.Bind(x => x.Files, UpdateView);
     ViewModel.Bind(x => x.Public, UpdateView);
     ViewModel.Bind(x => x.IsSaving, x =>
     {
         if (x)
             _hud.Show("Saving...");
         else
             _hud.Hide();
     });
 }
Example #15
0
        public void Reset()
        {
            if (welcomeSound != null)
            {
                welcomeSound.Stop();
            }

            //components.Remove(profil); profil = null;
            components.Remove(chooser); if (chooser != null)
            {
                chooser.Dispose();
            }
            chooser = null;
            components.Remove(intro); if (intro != null)
            {
                intro.Dispose();
            }
            intro = null;
            components.Remove(credits); if (credits != null)
            {
                credits.Dispose();
            }
            credits = null;
            components.Remove(menu); menu   = null;
            components.Remove(level); level = null;

            components.Remove(hud); hud         = null;
            components.Remove(console); console = null;

            components.Clear();

            if (game.World != null)
            {
                //components.Remove(game.World);
                game.World.Dispose();
                game.World = null;
            }

            /*
             * if (score != null)
             * {
             *  score.Reset();
             * }
             * score = null;*/
            Material.ClearSharedPool();
        }
Example #16
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.AutosizesSubviews = true;
            _imgView = new UIImageView {AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight};
            _hud = new Hud(View);
            Add(_imgView);

            var vm = (BaseStartupViewModel)ViewModel;
            vm.Bind(x => x.IsLoggingIn, x =>
                {
                    if (x)
                    {
                        _hud.Show("Logging in...");
                    }
                    else
                    {
                        _hud.Hide();
                    }
                });
        }
Example #17
0
        public override void ViewDidLoad()
        {
            Title = "Accounts";
            base.ViewDidLoad();

            NavigationItem.LeftBarButtonItem  = null;
            NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Add, (s, e) => ViewModel.AddAccountCommand.Execute(null));

            _hud = new Hud(View);
            ViewModel.Bind(x => x.IsLoggingIn, x =>
            {
                if (x)
                {
                    _hud.Show("Logging in...");
                }
                else
                {
                    _hud.Hide();
                }
            });
        }
Example #18
0
        public override void ViewDidLoad()
        {
            Title = "Accounts";
            base.ViewDidLoad();

            NavigationItem.LeftBarButtonItem = null;
            NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Add, (s, e) => ViewModel.AddAccountCommand.Execute(null));

            _hud = new Hud(View);
            ViewModel.Bind(x => x.IsLoggingIn, x =>
            {
                if (x)
                {
                    _hud.Show("Logging in...");
                }
                else
                {
                    _hud.Hide();
                }
            });
        }
Example #19
0
 public override void ViewDidLoad()
 {
     Title = "Create Gist";
     _hud  = this.CreateHud();
     base.ViewDidLoad();
     NavigationItem.RightBarButtonItem = new UIBarButtonItem(Theme.CurrentTheme.SaveButton, UIBarButtonItemStyle.Plain, (s, e) => ViewModel.SaveCommand.Execute(null));
     ViewModel.Bind(x => x.Description, UpdateView);
     ViewModel.Bind(x => x.Files, UpdateView);
     ViewModel.Bind(x => x.Public, UpdateView);
     ViewModel.Bind(x => x.IsSaving, x =>
     {
         if (x)
         {
             _hud.Show("Saving...");
         }
         else
         {
             _hud.Hide();
         }
     });
 }
Example #20
0
 public GameManager(
     IGameOptions gameOptions,
     IDebug debug,
     IItemManager itemManager,
     IEntityManager entityManager,
     IHud hud,
     IPlayer player,
     IInventory inventory,
     IActiveGear activeGear
     )
 {
     // components
     _debug         = debug ?? throw new ArgumentNullException(ComponentStrings.Debug);
     _gameOptions   = gameOptions ?? throw new ArgumentNullException(ComponentStrings.GameOptions);
     _hud           = hud ?? throw new ArgumentNullException(ComponentStrings.HUD);
     _inventory     = inventory ?? throw new ArgumentNullException(ComponentStrings.Inventory);
     _itemManager   = itemManager ?? throw new ArgumentNullException(ComponentStrings.ItemManager);
     _entityManager = entityManager ?? throw new ArgumentNullException(ComponentStrings.EntityManager);
     _player        = player ?? throw new ArgumentNullException(ComponentStrings.Player);
     _activeGear    = activeGear ?? throw new ArgumentNullException(ComponentStrings.ActiveGear);
 }
Example #21
0
        public void TechnicianListPageViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            TechnicianListPageViewModel vm = sender as TechnicianListPageViewModel;

            switch (e.PropertyName)
            {
            case "IsLoading":
                IHud hud = DependencyService.Get <IHud>();
                if (vm.IsLoading)
                {
                    //XHUD.HUD.Show("Loading data...", -1, XHUD.MaskType.Black);

                    hud.Show("Loading data...");
                }
                else
                {
                    hud.Dismiss();
                }
                break;

            case "IsSignedIn":
                if (vm.IsSignedIn)
                {
                    Device.BeginInvokeOnMainThread(() =>
                                                   MainPage = new MainDashboard());
                    //MainPage = new MainDashboard(this);
                }
                else
                {
                    if (!(MainPage is TechnicianListPage))
                    {
                        MainPage = new TechnicianListPage(vm);
                    }
                }
                break;

            default:
                break;
            }
        }
Example #22
0
 public override void ViewDidLoad()
 {
     base.ViewDidLoad();
     _hud = new Hud(View);
 }
Example #23
0
 public static IDisposable Activate(this IHud hud, string text)
 {
     hud.Show(text);
     return(Disposable.Create(hud.Hide));
 }
Example #24
0
        public override void ViewDidLoad()
        {
            NoItemsText = "No Notifications".t();
            Title       = "Notifications".t();

            base.ViewDidLoad();

            _markHud = new Hud(View);
            _segmentBarButton.Width = View.Frame.Width - 10f;
            ToolbarItems            = new [] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _segmentBarButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) };

            var vm = (NotificationsViewModel)ViewModel;

            NavigationItem.RightBarButtonItem    = new UIBarButtonItem(Theme.CurrentTheme.CheckButton, UIBarButtonItemStyle.Plain, (s, e) => vm.ReadAllCommand.Execute(null));
            vm.ReadAllCommand.CanExecuteChanged += (sender, e) => NavigationItem.RightBarButtonItem.Enabled = vm.ReadAllCommand.CanExecute(null);

            vm.Bind(x => x.IsMarking, x =>
            {
                if (x)
                {
                    _markHud.Show("Marking...");
                }
                else
                {
                    _markHud.Hide();
                }
            });

            BindCollection(vm.Notifications, x =>
            {
                var el = new StyledStringElement(x.Subject.Title, x.UpdatedAt.ToDaysAgo(), UITableViewCellStyle.Subtitle)
                {
                    Accessory = UITableViewCellAccessory.DisclosureIndicator
                };

                var subject = x.Subject.Type.ToLower();
                if (subject.Equals("issue"))
                {
                    el.Image = Images.Flag;
                }
                else if (subject.Equals("pullrequest"))
                {
                    el.Image = Images.Hand;
                }
                else if (subject.Equals("commit"))
                {
                    el.Image = Images.Commit;
                }
                else if (subject.Equals("release"))
                {
                    el.Image = Images.Tag;
                }
                else
                {
                    el.Image = Images.Notifications;
                }

                el.Tapped += () => vm.GoToNotificationCommand.Execute(x);
                return(el);
            });

            var set = this.CreateBindingSet <NotificationsView, NotificationsViewModel>();

            set.Bind(_viewSegment).To(x => x.ShownIndex);
            set.Apply();
        }
 public HudNumberManager(InGameHud hud)
 {
     Hud = hud;
 }
Example #26
0
        public void SetStateGame(string levelname)
        {
            if (score != null)
            {
                score.Reset();
            }
            score = null;

            game.Graphics.ShadowMappingSupportedOverride = !profil.CurrentProfil.Shadow;
            game.Graphics.AllowFogShaders = profil.CurrentProfil.Fog;

            Reset();


            components.Add(game.Physics);

            game.Input.MouseMovement = new Vector2(0, 0);

            hud = new Hud(game, "test");
            components.Add(hud);
            components.Add(GraphicalConsole.GetSingleton(game));
            GraphicalConsole.GetSingleton(game).RegisterObjectFunction(game, "Game", "Exit");
            GraphicalConsole.GetSingleton(game).RegisterObjectFunction(game.Input, "Input", "Bind");

            GraphicalConsole.GetSingleton(game).WriteLine(string.Format("Loading Level: {0}", levelname), 0);
            game.World = new World(game, levelname, components);

            components.Add(game.World);


            GraphicalConsole.GetSingleton(game).RegisterObjectFunction(game, "Game", "LoadLevel");


            Cheats cheats = new Cheats(game);

            components.Add(cheats);
            GraphicalConsole.GetSingleton(game).RegisterObjectProperty(cheats, "OneBananaProblem", "GodMode");
            score = new Score();

            // set post processing
            game.Renderer.PostProcessType = PostProcessType.BloomAndBlur;

            game.Renderer.Camera = game.World.Players[0].Camera;
            inputFocus           = game.World;
            if (welcomeSound == null)
            {
                welcomeSound = game.Sounds.CreateSound("Welcome");
            }
            welcomeSound.Play();
            game.Sounds.MusicBox(MusicBoxStatus.Play);

            TrafficLight trafficLight = new TrafficLight(game, TrafficLightGreenCallback);

            trafficLight.LocalPosition = game.World.Players[0].GlobalPosition + new Vector3(0, 130, -200);
            trafficLight.CanyonSegment = 0;
            game.World.AddObject(trafficLight);
            trafficLight.Start();
            //Gameplayed = true;

            // player shall wait until the trafficLight shows green
            game.World.Players[0].Enabled = false;
        }
Example #27
0
		public override void ViewDidLoad()
		{
			base.ViewDidLoad();

			_hud = this.CreateHud();

			NavigationItem.RightBarButtonItem = new UIBarButtonItem(Theme.CurrentTheme.SaveButton, UIBarButtonItemStyle.Plain, (s, e) => {
				View.EndEditing(true);
				ViewModel.SaveCommand.Execute(null);
			});

			var title = new InputElement("Title", string.Empty, string.Empty) { TextAlignment = UITextAlignment.Right };
			title.Changed += (object sender, EventArgs e) => ViewModel.Title = title.Value;

			var assignedTo = new StyledStringElement("Responsible", "Unassigned", UITableViewCellStyle.Value1);
			assignedTo.Accessory = UITableViewCellAccessory.DisclosureIndicator;
			assignedTo.Tapped += () => ViewModel.GoToAssigneeCommand.Execute(null);

			var kind = new StyledStringElement("Issue Type", ViewModel.Kind, UITableViewCellStyle.Value1);
			kind.Accessory = UITableViewCellAccessory.DisclosureIndicator;
			kind.Tapped += () =>
			{
				var ctrl = new IssueAttributesView(IssueModifyViewModel.Kinds, ViewModel.Kind) { Title = "Issue Type" };
				ctrl.SelectedValue = x => ViewModel.Kind = x.ToLower();
				NavigationController.PushViewController(ctrl, true);
			};

			var priority = new StyledStringElement("Priority", ViewModel.Priority, UITableViewCellStyle.Value1);
			priority.Accessory = UITableViewCellAccessory.DisclosureIndicator;
			priority.Tapped += () => 
			{
				var ctrl = new IssueAttributesView(IssueModifyViewModel.Priorities, ViewModel.Priority) { Title = "Priority" };
				ctrl.SelectedValue = x => ViewModel.Priority = x.ToLower();
				NavigationController.PushViewController(ctrl, true);
			};

			var milestone = new StyledStringElement("Milestone", "None", UITableViewCellStyle.Value1);
			milestone.Accessory = UITableViewCellAccessory.DisclosureIndicator;
			milestone.Tapped += () => ViewModel.GoToMilestonesCommand.Execute(null);

			var component = new StyledStringElement("Component", "None", UITableViewCellStyle.Value1);
			component.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            component.Tapped += () => ViewModel.GoToComponentsCommand.Execute(null);

			var version = new StyledStringElement("Version", "None", UITableViewCellStyle.Value1);
			version.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            version.Tapped += () => ViewModel.GoToVersionsCommand.Execute(null);

			var content = new MultilinedElement("Description");
			content.Tapped += () =>
			{
                var composer = new Composer { Title = "Issue Description", Text = content.Value };
				composer.NewComment(this, (text) => {
					ViewModel.Content = text;
					composer.CloseComposer();
				});
			};

			ViewModel.Bind(x => x.IsSaving, x =>
			{
				if (x)
					_hud.Show("Saving...");
				else
					_hud.Hide();
			});

			Root = new RootElement(Title) { new Section { title, assignedTo, kind, priority }, new Section { milestone, component, version }, new Section { content } };

			ViewModel.Bind(x => x.Title, x => {
				title.Value = x;
				Root.Reload(title, UITableViewRowAnimation.None);
			}, true);

			ViewModel.Bind(x => x.AssignedTo, x => {
				assignedTo.Value = x == null ? "Unassigned" : x.Username;
				Root.Reload(assignedTo, UITableViewRowAnimation.None);
			}, true);

			ViewModel.Bind(x => x.Kind, x => {
				kind.Value = x;
				Root.Reload(kind, UITableViewRowAnimation.None);
			}, true);

			ViewModel.Bind(x => x.Priority, x => {
				priority.Value = x;
				Root.Reload(priority, UITableViewRowAnimation.None);
			}, true);

			ViewModel.Bind(x => x.Milestone, x => {
				milestone.Value = x ?? "None";
				Root.Reload(milestone, UITableViewRowAnimation.None);
			}, true);

			ViewModel.Bind(x => x.Component, x => {
				component.Value = x ?? "None";
				Root.Reload(component, UITableViewRowAnimation.None);
			}, true);

			ViewModel.Bind(x => x.Version, x => {
				version.Value = x ?? "None";
				Root.Reload(version, UITableViewRowAnimation.None);
			}, true);

			ViewModel.Bind(x => x.Content, x => {
				content.Value = x;
				Root.Reload(content, UITableViewRowAnimation.None);
			}, true);
		}
Example #28
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _header = new HeaderView();
            _hud = this.CreateHud();

            var content = System.IO.File.ReadAllText("WebCell/body.html", System.Text.Encoding.UTF8);
            _descriptionElement = new WebElement(content, "body", false);
            _descriptionElement.UrlRequested = ViewModel.GoToUrlCommand.Execute;
            //_descriptionElement.HeightChanged = x => Render();

            var content2 = System.IO.File.ReadAllText("WebCell/comments.html", System.Text.Encoding.UTF8);
            _commentsElement = new WebElement(content2, "comments", true);
            _commentsElement.UrlRequested = ViewModel.GoToUrlCommand.Execute;
            //_commentsElement.HeightChanged = x => Render();

            _milestoneElement = new StyledStringElement("Milestone", "No Milestone", UITableViewCellStyle.Value1) {Image = Images.Milestone, Accessory = UITableViewCellAccessory.DisclosureIndicator};
            _milestoneElement.Tapped += () => ViewModel.GoToMilestoneCommand.Execute(null);

            _assigneeElement = new StyledStringElement("Assigned", "Unassigned".t(), UITableViewCellStyle.Value1) {Image = Images.Person, Accessory = UITableViewCellAccessory.DisclosureIndicator };
            _assigneeElement.Tapped += () => ViewModel.GoToAssigneeCommand.Execute(null);

            _labelsElement = new StyledStringElement("Labels", "None", UITableViewCellStyle.Value1) {Image = Images.Tag, Accessory = UITableViewCellAccessory.DisclosureIndicator};
            _labelsElement.Tapped += () => ViewModel.GoToLabelsCommand.Execute(null);

            _addCommentElement = new StyledStringElement("Add Comment") { Image = Images.Pencil };
            _addCommentElement.Tapped += AddCommentTapped;

            NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Action, (s, e) => ShowExtraMenu());
            NavigationItem.RightBarButtonItem.Enabled = false;
            ViewModel.Bind(x => x.IsLoading, x => 
            {
                if (!x)
                {
                    NavigationItem.RightBarButtonItem.Enabled = ViewModel.Issue != null;
                }
            });

            ViewModel.Bind(x => x.IsModifying, x =>
            {
                if (x)
                    _hud.Show("Loading...");
                else
                    _hud.Hide();
            });

            ViewModel.Bind(x => x.Issue, x =>
            {
                _assigneeElement.Value = x.Assignee != null ? x.Assignee.Login : "******".t();
                _milestoneElement.Value = x.Milestone != null ? x.Milestone.Title : "No Milestone";
                _labelsElement.Value = x.Labels.Count == 0 ? "None" : string.Join(", ", x.Labels.Select(i => i.Name));
                _descriptionElement.Value = ViewModel.MarkdownDescription;
                _header.Title = x.Title;
                _header.Subtitle = "Updated " + x.UpdatedAt.ToDaysAgo();
                Render();
            });

            ViewModel.BindCollection(x => x.Comments, (e) => RenderComments());
            ViewModel.BindCollection(x => x.Events, (e) => RenderComments());
        }
Example #29
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _header = new HeaderView();
            _hud    = this.CreateHud();

            var content = System.IO.File.ReadAllText("WebCell/body.html", System.Text.Encoding.UTF8);

            _descriptionElement = new WebElement(content, "body", false);
            _descriptionElement.UrlRequested = ViewModel.GoToUrlCommand.Execute;
            //_descriptionElement.HeightChanged = x => Render();

            var content2 = System.IO.File.ReadAllText("WebCell/comments.html", System.Text.Encoding.UTF8);

            _commentsElement = new WebElement(content2, "comments", true);
            _commentsElement.UrlRequested = ViewModel.GoToUrlCommand.Execute;
            //_commentsElement.HeightChanged = x => Render();

            _milestoneElement = new StyledStringElement("Milestone", "No Milestone", UITableViewCellStyle.Value1)
            {
                Image = Images.Milestone, Accessory = UITableViewCellAccessory.DisclosureIndicator
            };
            _milestoneElement.Tapped += () => ViewModel.GoToMilestoneCommand.Execute(null);

            _assigneeElement = new StyledStringElement("Assigned", "Unassigned".t(), UITableViewCellStyle.Value1)
            {
                Image = Images.Person, Accessory = UITableViewCellAccessory.DisclosureIndicator
            };
            _assigneeElement.Tapped += () => ViewModel.GoToAssigneeCommand.Execute(null);

            _labelsElement = new StyledStringElement("Labels", "None", UITableViewCellStyle.Value1)
            {
                Image = Images.Tag, Accessory = UITableViewCellAccessory.DisclosureIndicator
            };
            _labelsElement.Tapped += () => ViewModel.GoToLabelsCommand.Execute(null);

            _addCommentElement = new StyledStringElement("Add Comment")
            {
                Image = Images.Pencil
            };
            _addCommentElement.Tapped += AddCommentTapped;

            NavigationItem.RightBarButtonItem         = new UIBarButtonItem(UIBarButtonSystemItem.Action, (s, e) => ShowExtraMenu());
            NavigationItem.RightBarButtonItem.Enabled = false;
            ViewModel.Bind(x => x.IsLoading, x =>
            {
                if (!x)
                {
                    NavigationItem.RightBarButtonItem.Enabled = ViewModel.Issue != null;
                }
            });

            ViewModel.Bind(x => x.IsModifying, x =>
            {
                if (x)
                {
                    _hud.Show("Loading...");
                }
                else
                {
                    _hud.Hide();
                }
            });

            ViewModel.Bind(x => x.Issue, x =>
            {
                _assigneeElement.Value    = x.Assignee != null ? x.Assignee.Login : "******".t();
                _milestoneElement.Value   = x.Milestone != null ? x.Milestone.Title : "No Milestone";
                _labelsElement.Value      = x.Labels.Count == 0 ? "None" : string.Join(", ", x.Labels.Select(i => i.Name));
                _descriptionElement.Value = ViewModel.MarkdownDescription;
                _header.Title             = x.Title;
                _header.Subtitle          = "Updated " + x.UpdatedAt.ToDaysAgo();
                Render();
            });

            ViewModel.BindCollection(x => x.Comments, (e) => RenderComments());
            ViewModel.BindCollection(x => x.Events, (e) => RenderComments());
        }
Example #30
0
 void Awake()
 {
     CurrentHud = hud.GetComponentStrict <Hud>();
 }
 private NotificationService()
 {
     HudNotify = DependencyService.Get <IHud>();
 }
Example #32
0
 public override void ViewDidLoad()
 {
     base.ViewDidLoad();
     _hud = new Hud(View);
 }
Example #33
0
        public override void ViewDidLoad()
        {
            Title = "New Issue";

            base.ViewDidLoad();

            _hud = this.CreateHud();
            var vm = (IssueAddViewModel)ViewModel;

            NavigationItem.RightBarButtonItem = new UIBarButtonItem(Theme.CurrentTheme.SaveButton, UIBarButtonItemStyle.Plain, (s, e) => {
                View.EndEditing(true);
                vm.SaveCommand.Execute(null);
            });

            var title = new InputElement("Title", string.Empty, string.Empty);

            title.Changed += (object sender, EventArgs e) => vm.Title = title.Value;

            var assignedTo = new StyledStringElement("Responsible", "Unassigned", UITableViewCellStyle.Value1);

            assignedTo.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            assignedTo.Tapped   += () => vm.GoToAssigneeCommand.Execute(null);

            var milestone = new StyledStringElement("Milestone".t(), "None", UITableViewCellStyle.Value1);

            milestone.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            milestone.Tapped   += () => vm.GoToMilestonesCommand.Execute(null);

            var labels = new StyledStringElement("Labels".t(), "None", UITableViewCellStyle.Value1);

            labels.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            labels.Tapped   += () => vm.GoToLabelsCommand.Execute(null);

            var content = new MultilinedElement("Description");

            content.Tapped += () =>
            {
                var composer = new MarkdownComposerViewController {
                    Title = "Issue Description", Text = content.Value
                };
                composer.NewComment(this, (text) => {
                    vm.Content = text;
                    composer.CloseComposer();
                });
            };

            vm.Bind(x => x.Title, x => title.Value     = x);
            vm.Bind(x => x.Content, x => content.Value = x);
            vm.Bind(x => x.AssignedTo, x => {
                assignedTo.Value = x == null ? "Unassigned" : x.Login;
                Root.Reload(assignedTo, UITableViewRowAnimation.None);
            });
            vm.Bind(x => x.Milestone, x => {
                milestone.Value = x == null ? "None" : x.Title;
                Root.Reload(milestone, UITableViewRowAnimation.None);
            });
            vm.BindCollection(x => x.Labels, x => {
                labels.Value = vm.Labels.Items.Count == 0 ? "None" : string.Join(", ", vm.Labels.Items.Select(i => i.Name));
                Root.Reload(labels, UITableViewRowAnimation.None);
            });

            vm.Bind(x => x.IsSaving, x =>
            {
                if (x)
                {
                    _hud.Show("Saving...");
                }
                else
                {
                    _hud.Hide();
                }
            });

            Root = new RootElement(Title)
            {
                new Section {
                    title, assignedTo, milestone, labels
                }, new Section {
                    content
                }
            };
        }
Example #34
0
		public override void ViewDidLoad()
		{
			Title = "New Issue";

			base.ViewDidLoad();

			_hud = this.CreateHud();
			var vm = (IssueAddViewModel)ViewModel;

			NavigationItem.RightBarButtonItem = new UIBarButtonItem(Theme.CurrentTheme.SaveButton, UIBarButtonItemStyle.Plain, (s, e) => {
				View.EndEditing(true);
				vm.SaveCommand.Execute(null);
			});

			var title = new InputElement("Title", string.Empty, string.Empty);
			title.Changed += (object sender, EventArgs e) => vm.Title = title.Value;

			var assignedTo = new StyledStringElement("Responsible", "Unassigned", UITableViewCellStyle.Value1);
			assignedTo.Accessory = UITableViewCellAccessory.DisclosureIndicator;
			assignedTo.Tapped += () => vm.GoToAssigneeCommand.Execute(null);

			var milestone = new StyledStringElement("Milestone".t(), "None", UITableViewCellStyle.Value1);
			milestone.Accessory = UITableViewCellAccessory.DisclosureIndicator;
			milestone.Tapped += () => vm.GoToMilestonesCommand.Execute(null);

			var labels = new StyledStringElement("Labels".t(), "None", UITableViewCellStyle.Value1);
			labels.Accessory = UITableViewCellAccessory.DisclosureIndicator;
			labels.Tapped += () => vm.GoToLabelsCommand.Execute(null);

			var content = new MultilinedElement("Description");
			content.Tapped += () =>
			{
                var composer = new MarkdownComposerViewController { Title = "Issue Description", Text = content.Value };
				composer.NewComment(this, (text) => {
					vm.Content = text;
					composer.CloseComposer();
				});
			};

			vm.Bind(x => x.Title, x => title.Value = x);
			vm.Bind(x => x.Content, x => content.Value = x);
			vm.Bind(x => x.AssignedTo, x => {
				assignedTo.Value = x == null ? "Unassigned" : x.Login;
				Root.Reload(assignedTo, UITableViewRowAnimation.None);
			});
			vm.Bind(x => x.Milestone, x => {
				milestone.Value = x == null ? "None" : x.Title;
				Root.Reload(milestone, UITableViewRowAnimation.None);
			});
			vm.BindCollection(x => x.Labels, x => {
				labels.Value = vm.Labels.Items.Count == 0 ? "None" : string.Join(", ", vm.Labels.Items.Select(i => i.Name));
				Root.Reload(labels, UITableViewRowAnimation.None);
			});

			vm.Bind(x => x.IsSaving, x =>
			{
				if (x)
					_hud.Show("Saving...");
				else
					_hud.Hide();
			});

			Root = new RootElement(Title) { new Section { title, assignedTo, milestone, labels }, new Section { content } };
		}
Example #35
0
 public HudHeartManager(InGameHud hud)
 {
     Hud = hud;
 }
Example #36
0
 public HudInitializer(IHud hud)
 {
     Hud = hud;
 }
Example #37
0
        public override void ViewDidLoad()
        {
            Root.UnevenRows = true;

            base.ViewDidLoad();

            _header = new HeaderView();
            _hud = this.CreateHud();

            var content = System.IO.File.ReadAllText("WebCell/body.html", System.Text.Encoding.UTF8);
            _descriptionElement = new WebElement(content, "body", false);
            _descriptionElement.UrlRequested = ViewModel.GoToUrlCommand.Execute;

            var content2 = System.IO.File.ReadAllText("WebCell/comments.html", System.Text.Encoding.UTF8);
            _commentsElement = new WebElement(content2, "comments", true);
            _commentsElement.UrlRequested = ViewModel.GoToUrlCommand.Execute;

            _milestoneElement = new StyledStringElement("Milestone", "No Milestone", UITableViewCellStyle.Value1) { Image = Images.Milestone };
            _milestoneElement.Tapped += () => ViewModel.GoToMilestoneCommand.Execute(null);

            _assigneeElement = new StyledStringElement("Assigned", "Unassigned".t(), UITableViewCellStyle.Value1) { Image = Images.Person };
            _assigneeElement.Tapped += () => ViewModel.GoToAssigneeCommand.Execute(null);

            _labelsElement = new StyledStringElement("Labels", "None", UITableViewCellStyle.Value1) { Image = Images.Tag };
            _labelsElement.Tapped += () => ViewModel.GoToLabelsCommand.Execute(null);

            _addCommentElement = new StyledStringElement("Add Comment") { Image = Images.Pencil };
            _addCommentElement.Tapped += AddCommentTapped;

            _split1 = new SplitElement(new SplitElement.Row { Image1 = Images.Cog, Image2 = Images.Merge });
            _split2 = new SplitElement(new SplitElement.Row { Image1 = Images.Person, Image2 = Images.Create });

            ViewModel.Bind(x => x.PullRequest, x =>
            {
                var merged = (x.Merged != null && x.Merged.Value);

                _split1.Value.Text1 = x.State;
                _split1.Value.Text2 = merged ? "Merged" : "Not Merged";

                _split2.Value.Text1 = x.User.Login;
                _split2.Value.Text2 = x.CreatedAt.ToString("MM/dd/yy");

                _descriptionElement.Value = ViewModel.MarkdownDescription;
                _header.Title = x.Title;
                _header.Subtitle = "Updated " + x.UpdatedAt.ToDaysAgo();

                Render();
            });

            NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Action, (s, e) => ShowExtraMenu());
            NavigationItem.RightBarButtonItem.Enabled = false;
            ViewModel.Bind(x => x.IsLoading, x =>
            {
                if (!x)
                {
                    NavigationItem.RightBarButtonItem.Enabled = ViewModel.PullRequest != null;
                }
            });

            ViewModel.Bind(x => x.IsModifying, x =>
            {
                if (x)
                    _hud.Show("Loading...");
                else
                    _hud.Hide();
            });

            ViewModel.Bind(x => x.Issue, x =>
            {
                _assigneeElement.Value = x.Assignee != null ? x.Assignee.Login : "******".t();
                _milestoneElement.Value = x.Milestone != null ? x.Milestone.Title : "No Milestone";
                _labelsElement.Value = x.Labels.Count == 0 ? "None" : string.Join(", ", x.Labels.Select(i => i.Name));
                Render();
            });

            ViewModel.GoToLabelsCommand.CanExecuteChanged += (sender, e) =>
            {
                var before = _labelsElement.Accessory;
                _labelsElement.Accessory = ViewModel.GoToLabelsCommand.CanExecute(null) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None;
                if (_labelsElement.Accessory != before && _labelsElement.GetImmediateRootElement() != null)
                    Root.Reload(_labelsElement, UITableViewRowAnimation.Fade);
            };
            ViewModel.GoToAssigneeCommand.CanExecuteChanged += (sender, e) =>
            {
                var before = _assigneeElement.Accessory;
                _assigneeElement.Accessory = ViewModel.GoToAssigneeCommand.CanExecute(null) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None;
                if (_assigneeElement.Accessory != before && _assigneeElement.GetImmediateRootElement() != null)
                    Root.Reload(_assigneeElement, UITableViewRowAnimation.Fade);
            };
            ViewModel.GoToMilestoneCommand.CanExecuteChanged += (sender, e) =>
            {
                var before = _milestoneElement.Accessory;
                _milestoneElement.Accessory = ViewModel.GoToMilestoneCommand.CanExecute(null) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None;
                if (_milestoneElement.Accessory != before && _milestoneElement.GetImmediateRootElement() != null)
                    Root.Reload(_milestoneElement, UITableViewRowAnimation.Fade);
            };

            ViewModel.BindCollection(x => x.Comments, e => RenderComments());
            ViewModel.BindCollection(x => x.Events, e => RenderComments());
        }
Example #38
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _hud = this.CreateHud();

            NavigationItem.RightBarButtonItem = new UIBarButtonItem(Theme.CurrentTheme.SaveButton, UIBarButtonItemStyle.Plain, (s, e) => {
                View.EndEditing(true);
                ViewModel.SaveCommand.Execute(null);
            });

            var title = new InputElement("Title", string.Empty, string.Empty)
            {
                TextAlignment = UITextAlignment.Right
            };

            title.Changed += (object sender, EventArgs e) => ViewModel.Title = title.Value;

            var assignedTo = new StyledStringElement("Responsible", "Unassigned", UITableViewCellStyle.Value1);

            assignedTo.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            assignedTo.Tapped   += () => ViewModel.GoToAssigneeCommand.Execute(null);

            var kind = new StyledStringElement("Issue Type", ViewModel.Kind, UITableViewCellStyle.Value1);

            kind.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            kind.Tapped   += () =>
            {
                var ctrl = new IssueAttributesView(IssueModifyViewModel.Kinds, ViewModel.Kind)
                {
                    Title = "Issue Type"
                };
                ctrl.SelectedValue = x => ViewModel.Kind = x.ToLower();
                NavigationController.PushViewController(ctrl, true);
            };

            var priority = new StyledStringElement("Priority", ViewModel.Priority, UITableViewCellStyle.Value1);

            priority.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            priority.Tapped   += () =>
            {
                var ctrl = new IssueAttributesView(IssueModifyViewModel.Priorities, ViewModel.Priority)
                {
                    Title = "Priority"
                };
                ctrl.SelectedValue = x => ViewModel.Priority = x.ToLower();
                NavigationController.PushViewController(ctrl, true);
            };

            var milestone = new StyledStringElement("Milestone".t(), "None", UITableViewCellStyle.Value1);

            milestone.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            milestone.Tapped   += () => ViewModel.GoToMilestonesCommand.Execute(null);

            var component = new StyledStringElement("Component".t(), "None", UITableViewCellStyle.Value1);

            component.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            component.Tapped   += () => ViewModel.GoToComponentsCommand.Execute(null);

            var version = new StyledStringElement("Version".t(), "None", UITableViewCellStyle.Value1);

            version.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            version.Tapped   += () => ViewModel.GoToVersionsCommand.Execute(null);

            var content = new MultilinedElement("Description");

            content.Tapped += () =>
            {
                var composer = new Composer {
                    Title = "Issue Description", Text = content.Value
                };
                composer.NewComment(this, (text) => {
                    ViewModel.Content = text;
                    composer.CloseComposer();
                });
            };

            ViewModel.Bind(x => x.IsSaving, x =>
            {
                if (x)
                {
                    _hud.Show("Saving...");
                }
                else
                {
                    _hud.Hide();
                }
            });

            Root = new RootElement(Title)
            {
                new Section {
                    title, assignedTo, kind, priority
                }, new Section {
                    milestone, component, version
                }, new Section {
                    content
                }
            };

            ViewModel.Bind(x => x.Title, x => {
                title.Value = x;
                Root.Reload(title, UITableViewRowAnimation.None);
            }, true);

            ViewModel.Bind(x => x.AssignedTo, x => {
                assignedTo.Value = x == null ? "Unassigned" : x.Username;
                Root.Reload(assignedTo, UITableViewRowAnimation.None);
            }, true);

            ViewModel.Bind(x => x.Kind, x => {
                kind.Value = x;
                Root.Reload(kind, UITableViewRowAnimation.None);
            }, true);

            ViewModel.Bind(x => x.Priority, x => {
                priority.Value = x;
                Root.Reload(priority, UITableViewRowAnimation.None);
            }, true);

            ViewModel.Bind(x => x.Milestone, x => {
                milestone.Value = x ?? "None";
                Root.Reload(milestone, UITableViewRowAnimation.None);
            }, true);

            ViewModel.Bind(x => x.Component, x => {
                component.Value = x ?? "None";
                Root.Reload(component, UITableViewRowAnimation.None);
            }, true);

            ViewModel.Bind(x => x.Version, x => {
                version.Value = x ?? "None";
                Root.Reload(version, UITableViewRowAnimation.None);
            }, true);

            ViewModel.Bind(x => x.Content, x => {
                content.Value = x;
                Root.Reload(content, UITableViewRowAnimation.None);
            }, true);
        }
Example #39
0
        public override void ViewDidLoad()
        {
            Root.UnevenRows = true;

            base.ViewDidLoad();

            _header = new HeaderView();
            _hud    = this.CreateHud();

            var content = System.IO.File.ReadAllText("WebCell/body.html", System.Text.Encoding.UTF8);

            _descriptionElement = new WebElement(content, "body", false);
            _descriptionElement.UrlRequested = ViewModel.GoToUrlCommand.Execute;

            var content2 = System.IO.File.ReadAllText("WebCell/comments.html", System.Text.Encoding.UTF8);

            _commentsElement = new WebElement(content2, "comments", true);
            _commentsElement.UrlRequested = ViewModel.GoToUrlCommand.Execute;

            _milestoneElement = new StyledStringElement("Milestone", "No Milestone", UITableViewCellStyle.Value1)
            {
                Image = Images.Milestone
            };
            _milestoneElement.Tapped += () => ViewModel.GoToMilestoneCommand.Execute(null);

            _assigneeElement = new StyledStringElement("Assigned", "Unassigned".t(), UITableViewCellStyle.Value1)
            {
                Image = Images.Person
            };
            _assigneeElement.Tapped += () => ViewModel.GoToAssigneeCommand.Execute(null);

            _labelsElement = new StyledStringElement("Labels", "None", UITableViewCellStyle.Value1)
            {
                Image = Images.Tag
            };
            _labelsElement.Tapped += () => ViewModel.GoToLabelsCommand.Execute(null);

            _addCommentElement = new StyledStringElement("Add Comment")
            {
                Image = Images.Pencil
            };
            _addCommentElement.Tapped += AddCommentTapped;

            _split1 = new SplitElement(new SplitElement.Row {
                Image1 = Images.Cog, Image2 = Images.Merge
            });
            _split2 = new SplitElement(new SplitElement.Row {
                Image1 = Images.Person, Image2 = Images.Create
            });

            ViewModel.Bind(x => x.PullRequest, x =>
            {
                var merged = (x.Merged != null && x.Merged.Value);

                _split1.Value.Text1 = x.State;
                _split1.Value.Text2 = merged ? "Merged" : "Not Merged";

                _split2.Value.Text1 = x.User.Login;
                _split2.Value.Text2 = x.CreatedAt.ToString("MM/dd/yy");

                _descriptionElement.Value = ViewModel.MarkdownDescription;
                _header.Title             = x.Title;
                _header.Subtitle          = "Updated " + x.UpdatedAt.ToDaysAgo();

                Render();
            });

            NavigationItem.RightBarButtonItem         = new UIBarButtonItem(UIBarButtonSystemItem.Action, (s, e) => ShowExtraMenu());
            NavigationItem.RightBarButtonItem.Enabled = false;
            ViewModel.Bind(x => x.IsLoading, x =>
            {
                if (!x)
                {
                    NavigationItem.RightBarButtonItem.Enabled = ViewModel.PullRequest != null;
                }
            });

            ViewModel.Bind(x => x.IsModifying, x =>
            {
                if (x)
                {
                    _hud.Show("Loading...");
                }
                else
                {
                    _hud.Hide();
                }
            });

            ViewModel.Bind(x => x.Issue, x =>
            {
                _assigneeElement.Value  = x.Assignee != null ? x.Assignee.Login : "******".t();
                _milestoneElement.Value = x.Milestone != null ? x.Milestone.Title : "No Milestone";
                _labelsElement.Value    = x.Labels.Count == 0 ? "None" : string.Join(", ", x.Labels.Select(i => i.Name));
                Render();
            });

            ViewModel.GoToLabelsCommand.CanExecuteChanged += (sender, e) =>
            {
                var before = _labelsElement.Accessory;
                _labelsElement.Accessory = ViewModel.GoToLabelsCommand.CanExecute(null) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None;
                if (_labelsElement.Accessory != before && _labelsElement.GetImmediateRootElement() != null)
                {
                    Root.Reload(_labelsElement, UITableViewRowAnimation.Fade);
                }
            };
            ViewModel.GoToAssigneeCommand.CanExecuteChanged += (sender, e) =>
            {
                var before = _assigneeElement.Accessory;
                _assigneeElement.Accessory = ViewModel.GoToAssigneeCommand.CanExecute(null) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None;
                if (_assigneeElement.Accessory != before && _assigneeElement.GetImmediateRootElement() != null)
                {
                    Root.Reload(_assigneeElement, UITableViewRowAnimation.Fade);
                }
            };
            ViewModel.GoToMilestoneCommand.CanExecuteChanged += (sender, e) =>
            {
                var before = _milestoneElement.Accessory;
                _milestoneElement.Accessory = ViewModel.GoToMilestoneCommand.CanExecute(null) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None;
                if (_milestoneElement.Accessory != before && _milestoneElement.GetImmediateRootElement() != null)
                {
                    Root.Reload(_milestoneElement, UITableViewRowAnimation.Fade);
                }
            };

            ViewModel.BindCollection(x => x.Comments, e => RenderComments());
            ViewModel.BindCollection(x => x.Events, e => RenderComments());
        }