Example #1
0
 public void RemoveButton(NavigateButton button)
 {
     NavigatePanel.Children.Remove(button);
     if (MainWindowContent.Content == button.CurrentControl.Content)
     {
         MainWindowContent.Visibility = Visibility.Hidden;
     }
 }
Example #2
0
 public override void InitBindings()
 {
     ChooseFancyButton.SetOnClickCommand(ViewModel.AskUserAboutFancyThingsCommand);
     ShowFancyButton.SetOnClickCommand(ViewModel.ShowLastFanciedThingCommand);
     ResetButton.SetOnClickCommand(ViewModel.ResetFanciness);
     NavigateButton.SetOnClickCommand(ViewModel.NavigateSomewhereElseCommand);
     ShowDialogButton.SetOnClickCommand(ViewModel.ShowDialogCommand);
     ShowDifferentDialogButton.SetOnClickCommand(ViewModel.ShowDialogBCommand);
 }
 void ReleaseDesignerOutlets()
 {
     if (NavigateButton != null)
     {
         NavigateButton.Dispose();
         NavigateButton = null;
     }
     if (WelcomeText != null)
     {
         WelcomeText.Dispose();
         WelcomeText = null;
     }
 }
Example #4
0
        public NormalWindowProxy <T> Navigate <T>(int?timeOut = null) where T : Entity
        {
            if (NavigateButton.Current.IsOffscreen)
            {
                throw new InvalidOperationException("Navigate button not visible on SearchControl {0}".FormatWith(Element.Current.Name));
            }

            var win = Element.CaptureWindow(
                () => NavigateButton.ButtonInvoke(),
                () => "Navigate selected entity on SearchControl ({0})".FormatWith(Element.Current.Name), timeOut);

            return(new NormalWindowProxy <T>(win));
        }
Example #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            try
            {
                _bindings.Add(this.SetBinding(() => MainViewModel.WelcomeTitle, () => WelcomeText.Text));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                //throw;
            }

            NavigateButton.SetCommand("Click", MainViewModel.NavigateCommand);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Binding and commanding

            // Binding between the first UILabel and the WelcomeTitle property on the VM.
            // Keep track of the binding to avoid premature garbage collection
            bindings.Add(
                this.SetBinding(
                    () => Vm.WelcomeTitle,
                    () => WelcomeText.Text));

            // Actuate the NavigateCommand on the VM.
            NavigateButton.SetCommand(
                "TouchUpInside",
                Vm.NavigateCommand);
        }
        void ReleaseDesignerOutlets()
        {
            if (ChooseFancyButton != null)
            {
                ChooseFancyButton.Dispose();
                ChooseFancyButton = null;
            }

            if (NavigateButton != null)
            {
                NavigateButton.Dispose();
                NavigateButton = null;
            }

            if (ResetButton != null)
            {
                ResetButton.Dispose();
                ResetButton = null;
            }

            if (ShowDialogButton != null)
            {
                ShowDialogButton.Dispose();
                ShowDialogButton = null;
            }

            if (ShowDifferentDialogButton != null)
            {
                ShowDifferentDialogButton.Dispose();
                ShowDifferentDialogButton = null;
            }

            if (ShowFancyButton != null)
            {
                ShowFancyButton.Dispose();
                ShowFancyButton = null;
            }
        }
Example #8
0
 void ReleaseDesignerOutlets()
 {
     if (ClockText != null)
     {
         ClockText.Dispose();
         ClockText = null;
     }
     if (DialogNavText != null)
     {
         DialogNavText.Dispose();
         DialogNavText = null;
     }
     if (IncrementButton != null)
     {
         IncrementButton.Dispose();
         IncrementButton = null;
     }
     if (NavigateButton != null)
     {
         NavigateButton.Dispose();
         NavigateButton = null;
     }
     if (SendMessageButton != null)
     {
         SendMessageButton.Dispose();
         SendMessageButton = null;
     }
     if (ShowDialogButton != null)
     {
         ShowDialogButton.Dispose();
         ShowDialogButton = null;
     }
     if (WelcomeText != null)
     {
         WelcomeText.Dispose();
         WelcomeText = null;
     }
 }
Example #9
0
        private void ReadNavigateButtons()
        {
            ((Collection <NavigateButton>) this._navigateButtons).Clear();
            if (this._group.members_count > 0)
            {
                NavigateButton navigateButton1 = new NavigateButton();
                navigateButton1.ButtonType = NavigateButtonType.Subscribers;
                string str = UIStringFormatterHelper.FormatForUIShort((long)this._group.members_count);
                navigateButton1.ButtonTitle = str;
                NavigateButton navigateButton2 = navigateButton1;
                navigateButton2.ButtonSubtitle = this._group.GroupType != GroupType.PublicPage ? UIStringFormatterHelper.FormatNumberOfSomething(this._group.members_count, GroupResources.OneMemberFrm, GroupResources.TwoFourMembersFrm, GroupResources.FiveMembersFrm, false, null, false) : UIStringFormatterHelper.FormatNumberOfSomething(this._group.members_count, GroupResources.OneSubscriberFrm, GroupResources.TwoFourSubscribersFrm, GroupResources.FiveSubscribersFrm, false, null, false);
                ((Collection <NavigateButton>) this._navigateButtons).Add(navigateButton2);
            }
            if (this._group.counters.topics > 0)
            {
                NavigateButton navigateButton = new NavigateButton();
                navigateButton.ButtonType = NavigateButtonType.Discussions;
                string str1 = UIStringFormatterHelper.FormatForUIShort((long)this._group.counters.topics);
                navigateButton.ButtonTitle = str1;
                string str2 = UIStringFormatterHelper.FormatNumberOfSomething(this._group.counters.topics, GroupResources.OneTopicFrm, GroupResources.TwoFourTopicsFrm, GroupResources.FiveTopicsFrm, false, null, false);
                navigateButton.ButtonSubtitle = str2;
                ((Collection <NavigateButton>) this._navigateButtons).Add(navigateButton);
            }
            if (this._group.counters.photos > 0)
            {
                NavigateButton navigateButton = new NavigateButton();
                navigateButton.ButtonType = NavigateButtonType.Photo;
                string str1 = UIStringFormatterHelper.FormatForUIShort((long)this._group.counters.photos);
                navigateButton.ButtonTitle = str1;
                string str2 = this._group.counters.photos == 1 ? GroupResources.Photo : GroupResources.Photos;
                navigateButton.ButtonSubtitle = str2;
                ((Collection <NavigateButton>) this._navigateButtons).Add(navigateButton);
            }
            if (this._group.counters.videos > 0)
            {
                NavigateButton navigateButton = new NavigateButton();
                navigateButton.ButtonType = NavigateButtonType.Video;
                string str1 = UIStringFormatterHelper.FormatForUIShort((long)this._group.counters.videos);
                navigateButton.ButtonTitle = str1;
                string str2 = this._group.counters.videos == 1 ? GroupResources.Video : GroupResources.Videos;
                navigateButton.ButtonSubtitle = str2;
                ((Collection <NavigateButton>) this._navigateButtons).Add(navigateButton);
            }
            if (this._group.counters.audios > 0)
            {
                NavigateButton navigateButton = new NavigateButton();
                navigateButton.ButtonType = NavigateButtonType.Audio;
                string str1 = UIStringFormatterHelper.FormatForUIShort((long)this._group.counters.audios);
                navigateButton.ButtonTitle = str1;
                string str2 = this._group.counters.audios == 1 ? GroupResources.Audio : GroupResources.Audios;
                navigateButton.ButtonSubtitle = str2;
                ((Collection <NavigateButton>) this._navigateButtons).Add(navigateButton);
            }
            if (this._group.counters.docs <= 0)
            {
                return;
            }
            NavigateButton navigateButton3 = new NavigateButton();

            navigateButton3.ButtonType = NavigateButtonType.Documents;
            string str3 = UIStringFormatterHelper.FormatForUIShort((long)this._group.counters.docs);

            navigateButton3.ButtonTitle = str3;
            string str4 = UIStringFormatterHelper.FormatNumberOfSomething(this._group.counters.docs, CommonResources.OneDocFrm, CommonResources.TwoFourDocumentsFrm, CommonResources.FiveDocumentsFrm, false, null, false);

            navigateButton3.ButtonSubtitle = str4;
            ((Collection <NavigateButton>) this._navigateButtons).Add(navigateButton3);
        }
        protected override void InitBindings()
        {
            Bindings.Add(this.SetBinding(() => ViewModel.Boiler).WhenSourceChanges(async() =>
            {
                if (ViewModel.Boiler == null)
                {
                    return;
                }

                if (_previouslyDisplayedBoiler != null)
                {
                    _previouslyDisplayedBoiler.PropertyThresholdStatusChanged -= PreviouslyDisplayedBoilerOnPropertyThresholdStatusChanged;
                }

                _previouslyDisplayedBoiler = ViewModel.Boiler;
                _previouslyDisplayedBoiler.PropertyThresholdStatusChanged +=
                    PreviouslyDisplayedBoilerOnPropertyThresholdStatusChanged;

                ClearPropertyBindings();

                #region ValueBindings

                _propertyBindings.Add(this.SetBinding(() => ViewModel.Boiler.PipeX001_FTX001_Output).WhenSourceChanges(() =>
                                                                                                                       Callback(PipeX001_FTX001_Output, () => ViewModel.Boiler.PipeX001_FTX001_Output)));

                _propertyBindings.Add(this.SetBinding(() => ViewModel.Boiler.PipeX001_ValveX001_Input).WhenSourceChanges(() =>
                                                                                                                         Callback(PipeX001_ValveX001_Input, () => ViewModel.Boiler.PipeX001_ValveX001_Input)));

                _propertyBindings.Add(this.SetBinding(() => ViewModel.Boiler.DrumX001_LIX001_Output).WhenSourceChanges(() =>
                                                                                                                       Callback(DrumX001_LIX001_Output, () => ViewModel.Boiler.DrumX001_LIX001_Output)));

                _propertyBindings.Add(this.SetBinding(() => ViewModel.Boiler.PipeX002_FTX002_Output).WhenSourceChanges(() =>
                                                                                                                       Callback(PipeX002_FTX002_Output, () => ViewModel.Boiler.PipeX002_FTX002_Output)));

                _propertyBindings.Add(this.SetBinding(() => ViewModel.Boiler.FCX001_ControlOut).WhenSourceChanges(() =>
                                                                                                                  Callback(FCX001_ControlOut, () => ViewModel.Boiler.FCX001_ControlOut)));

                _propertyBindings.Add(this.SetBinding(() => ViewModel.Boiler.FCX001_SetPoint).WhenSourceChanges(() =>
                                                                                                                Callback(FCX001_SetPoint, () => ViewModel.Boiler.FCX001_SetPoint)));

                _propertyBindings.Add(this.SetBinding(() => ViewModel.Boiler.FCX001_Measurement).WhenSourceChanges(() =>
                                                                                                                   Callback(FCX001_Measurement, () => ViewModel.Boiler.FCX001_Measurement)));

                _propertyBindings.Add(this.SetBinding(() => ViewModel.Boiler.LCX001_ControlOut).WhenSourceChanges(() =>
                                                                                                                  Callback(LCX001_ControlOut, () => ViewModel.Boiler.LCX001_ControlOut)));

                _propertyBindings.Add(this.SetBinding(() => ViewModel.Boiler.LCX001_Measurement).WhenSourceChanges(() =>
                                                                                                                   Callback(LCX001_Measurement, () => ViewModel.Boiler.LCX001_Measurement)));

                _propertyBindings.Add(this.SetBinding(() => ViewModel.Boiler.LCX001_SetPoint).WhenSourceChanges(() =>
                                                                                                                Callback(LCX001_SetPoint, () => ViewModel.Boiler.LCX001_SetPoint)));

                _propertyBindings.Add(this.SetBinding(() => ViewModel.Boiler.CCX001_ControlOut).WhenSourceChanges(() =>
                                                                                                                  Callback(CCX001_ControlOut, () => ViewModel.Boiler.CCX001_ControlOut)));

                _propertyBindings.Add(this.SetBinding(() => ViewModel.Boiler.CCX001_Input1).WhenSourceChanges(() =>
                                                                                                              Callback(CCX001_Input1, () => ViewModel.Boiler.CCX001_Input1)));

                _propertyBindings.Add(this.SetBinding(() => ViewModel.Boiler.CCX001_Input2).WhenSourceChanges(() =>
                                                                                                              Callback(CCX001_Input2, () => ViewModel.Boiler.CCX001_Input2)));

                _propertyBindings.Add(this.SetBinding(() => ViewModel.Boiler.CCX001_Input3).WhenSourceChanges(() =>
                                                                                                              Callback(CCX001_Input3, () => ViewModel.Boiler.CCX001_Input3)));

                #endregion

                #region ImageValuesBindings

                Bindings.Add(
                    this.SetBinding(() => ViewModel.Boiler.FCX001_SetPoint,
                                    () => FSetPoint.Text).ConvertSourceToTarget(ConvertPropertyValue));
                Bindings.Add(
                    this.SetBinding(() => ViewModel.Boiler.LCX001_SetPoint,
                                    () => LSetPoint.Text).ConvertSourceToTarget(ConvertPropertyValue));

                Bindings.Add(
                    this.SetBinding(() => ViewModel.Boiler.LCX001_Measurement,
                                    () => WaveView.ProgressValue).ConvertSourceToTarget(d => (int)d));

                Bindings.Add(
                    this.SetBinding(() => ViewModel.Boiler.PipeX001_ValveX001_Input,
                                    () => ValveInput.Text).ConvertSourceToTarget(d => $"Valve Input = {d:N2}"));

                Bindings.Add(
                    this.SetBinding(() => ViewModel.Boiler.PipeX002_FTX002_Output,
                                    () => FTMeasurement.Text).ConvertSourceToTarget(ConvertPropertyValue));

                Bindings.Add(
                    this.SetBinding(() => ViewModel.Boiler.DrumX001_LIX001_Output,
                                    () => WaveViewLabel.Text).ConvertSourceToTarget(d => $"{d:N0}%"));

                #endregion

                #region UpperDashboardBindings

                Bindings.Add(
                    this.SetBinding(() => ViewModel.Boiler.LCX001_Measurement,
                                    () => WaveViewUpper.ProgressValue).ConvertSourceToTarget(d => (int)d));

                Bindings.Add(
                    this.SetBinding(() => ViewModel.Boiler.PipeX001_ValveX001_Input,
                                    () => InputPipeProgressBar.Progress).ConvertSourceToTarget(d => (int)d));

                Bindings.Add(
                    this.SetBinding(() => ViewModel.Boiler.PipeX002_FTX002_Output,
                                    () => OutputPipeProgressBar.Progress).ConvertSourceToTarget(d => (int)(d * 1000)));

                Bindings.Add(
                    this.SetBinding(() => ViewModel.Boiler.DrumX001_LIX001_Output,
                                    () => WaveViewUpperLabel.Text).ConvertSourceToTarget(d => $"{d:N0}%"));

                #endregion

                BoilerName.Text  = ViewModel.Boiler.Repository;
                BoilerNotes.Text = ViewModel.Boiler.Notes;

                var map = await _mapTaskCompletionSource.Task;

                _marker?.Remove();
                var pos = new LatLng(ViewModel.Boiler.Lat, ViewModel.Boiler.Lon);
                _marker = map.AddMarker(new MarkerOptions().SetPosition(pos).SetTitle(ViewModel.Boiler.Repository));
                map.MoveCamera(CameraUpdateFactory.NewLatLngZoom(pos, 14f));
            }));


            #region PropertyLabelInitialization

            PipeX001_FTX001_Output.FindViewById <TextView>(Resource.Id.PropertyName).Text   = nameof(PipeX001_FTX001_Output);
            PipeX001_ValveX001_Input.FindViewById <TextView>(Resource.Id.PropertyName).Text = nameof(PipeX001_ValveX001_Input);
            DrumX001_LIX001_Output.FindViewById <TextView>(Resource.Id.PropertyName).Text   = nameof(DrumX001_LIX001_Output);
            PipeX002_FTX002_Output.FindViewById <TextView>(Resource.Id.PropertyName).Text   = nameof(PipeX002_FTX002_Output);
            FCX001_ControlOut.FindViewById <TextView>(Resource.Id.PropertyName).Text        = nameof(FCX001_ControlOut);
            FCX001_Measurement.FindViewById <TextView>(Resource.Id.PropertyName).Text       = nameof(FCX001_Measurement);
            FCX001_SetPoint.FindViewById <TextView>(Resource.Id.PropertyName).Text          = nameof(FCX001_SetPoint);
            LCX001_ControlOut.FindViewById <TextView>(Resource.Id.PropertyName).Text        = nameof(LCX001_ControlOut);
            LCX001_Measurement.FindViewById <TextView>(Resource.Id.PropertyName).Text       = nameof(LCX001_Measurement);
            LCX001_SetPoint.FindViewById <TextView>(Resource.Id.PropertyName).Text          = nameof(LCX001_SetPoint);
            CCX001_ControlOut.FindViewById <TextView>(Resource.Id.PropertyName).Text        = nameof(CCX001_ControlOut);
            CCX001_Input1.FindViewById <TextView>(Resource.Id.PropertyName).Text            = nameof(CCX001_Input1);
            CCX001_Input2.FindViewById <TextView>(Resource.Id.PropertyName).Text            = nameof(CCX001_Input2);
            CCX001_Input3.FindViewById <TextView>(Resource.Id.PropertyName).Text            = nameof(CCX001_Input3);

            #endregion

            MapView.OnCreate(null);
            MapView.GetMapAsync(this);
            NavigateButton.SetOnClickCommand(ViewModel.LaunchNavigationCommand);
        }
Example #11
0
        public HudLayer(Action up, Action down) : base(CCColor4B.Transparent)
        {
            Score  = 0;
            energy = 100;

            Battery10       = new CCSprite("/Assets/Content/Images/Hud/red_block_battery.png");
            Battery10.Scale = 0.5f;
            AddChild(Battery10);

            Battery20       = new CCSprite("/Assets/Content/Images/Hud/red_block_battery.png");
            Battery20.Scale = 0.5f;
            AddChild(Battery20);

            Battery30       = new CCSprite("/Assets/Content/Images/Hud/orange_block_battery.png");
            Battery30.Scale = 0.5f;
            AddChild(Battery30);

            Battery40       = new CCSprite("/Assets/Content/Images/Hud/orange_block_battery.png");
            Battery40.Scale = 0.5f;
            AddChild(Battery40);

            Battery50       = new CCSprite("/Assets/Content/Images/Hud/orange_block_battery.png");
            Battery50.Scale = 0.5f;
            AddChild(Battery50);

            Battery60       = new CCSprite("/Assets/Content/Images/Hud/green_block_battery.png");
            Battery60.Scale = 0.5f;
            AddChild(Battery60);

            Battery70       = new CCSprite("/Assets/Content/Images/Hud/green_block_battery.png");
            Battery70.Scale = 0.5f;
            AddChild(Battery70);

            Battery80       = new CCSprite("/Assets/Content/Images/Hud/green_block_battery.png");
            Battery80.Scale = 0.5f;
            AddChild(Battery80);

            Battery90       = new CCSprite("/Assets/Content/Images/Hud/green_block_battery.png");
            Battery90.Scale = 0.5f;
            AddChild(Battery90);

            Battery100       = new CCSprite("/Assets/Content/Images/Hud/green_block_battery.png");
            Battery100.Scale = 0.5f;
            AddChild(Battery100);

            energySprite       = new CCSprite("/Assets/Content/Images/Hud/battery.png");
            energySprite.Scale = 0.5f;
            AddChild(energySprite);

            energyLabel       = new CCLabel("100%", "Fonts/MarkerFelt", 22, CCLabelFormat.SpriteFont);
            energyLabel.Color = CCColor3B.Green;
            AddChild(energyLabel);

            ScoreLabel       = new CCLabel("Score: 0", "Fonts/MarkerFelt", 22, CCLabelFormat.SpriteFont);
            ScoreLabel.Color = new CCColor3B(200, 48, 255);
            AddChild(ScoreLabel);

            buttonUp = new NavigateButton("up", 100, up);
            AddChild(buttonUp);

            buttonDown = new NavigateButton("down", -100, down);
            AddChild(buttonDown);
        }
Example #12
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Dismiss the keyboard
            DialogNavText.ShouldReturn += t =>
            {
                t.ResignFirstResponder();
                return(true);
            };

            // Binding and commanding

            // Binding between the first UILabel and the WelcomeTitle property on the VM.
            // Keep track of the binding to avoid premature garbage collection
            _bindings.Add(
                this.SetBinding(
                    () => Vm.WelcomeTitle,
                    () => WelcomeText.Text));

            // Actuate the IncrementCommand on the VM.
            IncrementButton.SetCommand(
                "TouchUpInside",
                Vm.IncrementCommand);

            // Create a binding that fires every time that the EditingChanged event is called
            var dialogNavBinding = this.SetBinding(
                () => DialogNavText.Text)
                                   .UpdateSourceTrigger("EditingChanged");

            // Keep track of the binding to avoid premature garbage collection
            _bindings.Add(dialogNavBinding);

            // Actuate the NavigateCommand on the VM.
            // This command needs a CommandParameter of type string.
            // This is what the dialogNavBinding provides.
            NavigateButton.SetCommand(
                "TouchUpInside",
                Vm.NavigateCommand,
                dialogNavBinding);

            // Actuate the ShowDialogCommand on the VM.
            // This command needs a CommandParameter of type string.
            // This is what the dialogNavBinding provides.
            // This button will be disabled when the content of DialogNavText
            // is empty (see ShowDialogCommand on the MainViewModel class).
            ShowDialogButton.SetCommand(
                "TouchUpInside",
                Vm.ShowDialogCommand,
                dialogNavBinding);

            // Create a binding between the Clock property of the VM
            // and the ClockText UILabel.
            // Keep track of the binding to avoid premature garbage collection
            _bindings.Add(
                this.SetBinding(
                    () => Vm.Clock,
                    () => ClockText.Text));

            // Actuate the SendMessageCommand on the VM.
            SendMessageButton.SetCommand(
                "TouchUpInside",
                Vm.SendMessageCommand);
        }
Example #13
0
 public override void AwakeFromNib()
 {
     NavigateButton.AddGestureRecognizer(new UITapGestureRecognizer(OnNavigateTapped));
     HeaderCloseButton.AddGestureRecognizer(new UITapGestureRecognizer(OnCloseTapped));
 }