protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			SetContentView(Resource.Layout.Log);
			logView = FindViewById<TextView> (Resource.Id.log);
			scrollView = FindViewById<ScrollView> (Resource.Id.logScrollView);
			scrollView.FullScroll(FocusSearchDirection.Down);
			logView.SetText(savedText,TextView.BufferType.Editable);
			scrollView.ScrollTo(0,logView.Height);
			scrollView.FullScroll(FocusSearchDirection.Down);
		}
Exemplo n.º 2
0
		public static void TextViewDialog(Context context, string path, string text = null)
		{
			var textView = new TextView(context);
			textView.SetPadding(10, 10, 10, 10);
			textView.SetTextSize(ComplexUnitType.Sp, 10f);
			var scrollView = new ScrollView(context);
			scrollView.AddView(textView);
			AlertDialog.Builder dialog = new AlertDialog.Builder(context);
			dialog.SetView(scrollView);

			if (text == null) {
				try {
					using (StreamReader sr = new StreamReader(path, Encoding.GetEncoding("euc-kr"))) {
						textView.Text = sr.ReadToEnd();
						sr.Close();
					}
				} catch { }
			} else {
				textView.Text = text;
			}

			dialog.SetPositiveButton("닫기", delegate
			{ });

			dialog.Show();
		}
Exemplo n.º 3
0
		public void GetsCorrectSizeRequestWithWrappingContent (ScrollOrientation orientation)
		{
			var scrollView = new ScrollView {
				IsPlatformEnabled = true,
				Orientation = orientation,
				Platform = new UnitPlatform (null, true)
			};

			var hLayout = new StackLayout {
				IsPlatformEnabled = true,
				Orientation = StackOrientation.Horizontal,
				Children = {
					new Label {Text = "THIS IS A REALLY LONG STRING", IsPlatformEnabled = true},
					new Label {Text = "THIS IS A REALLY LONG STRING", IsPlatformEnabled = true},
					new Label {Text = "THIS IS A REALLY LONG STRING", IsPlatformEnabled = true},
					new Label {Text = "THIS IS A REALLY LONG STRING", IsPlatformEnabled = true},
					new Label {Text = "THIS IS A REALLY LONG STRING", IsPlatformEnabled = true},
				}
			};

			scrollView.Content = hLayout;

			var r = scrollView.GetSizeRequest (100, 100);

			Assert.AreEqual (10, r.Request.Height);
		}
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			base.OnCreateView (inflater, container, savedInstanceState);

			ctrl = ((GameController)this.Activity);

			if (container == null)
				return null;

			var view = inflater.Inflate(Resource.Layout.GameDetailScreen, container, false);

			_layoutDefault = view.FindViewById<ScrollView> (Resource.Id.scrollView);

			_imageView = view.FindViewById<ImageView> (Resource.Id.imageView);
			_imageDirection = view.FindViewById<ImageView> (Resource.Id.imageDirection);
			_textDescription = view.FindViewById<TextView> (Resource.Id.textDescription);
			_textDirection = view.FindViewById<TextView> (Resource.Id.textDirection);
			_layoutBottom = view.FindViewById<LinearLayout> (Resource.Id.layoutBottom);
			_layoutButtons = view.FindViewById<LinearLayout> (Resource.Id.layoutButtons);
			_layoutDirection = view.FindViewById<LinearLayout> (Resource.Id.layoutDirection);

			// Don't know a better way :(
			_layoutBottom.SetBackgroundResource(Main.BottomBackground);

			_layoutButtons.Visibility = ViewStates.Visible;

			HasOptionsMenu = !(activeObject is Task);

			return view;
		}
Exemplo n.º 5
0
		public View InflateViews ()
		{
			mScrollView = new ScrollView (Activity);
			ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams (
				ViewGroup.LayoutParams.MatchParent,
				ViewGroup.LayoutParams.MatchParent);
			mScrollView.LayoutParameters = scrollParams;

			mLogView = new LogView (Activity);
			ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams (scrollParams);
			logParams.Height = ViewGroup.LayoutParams.WrapContent;
			mLogView.LayoutParameters = logParams;
			mLogView.Clickable = true;
			mLogView.Focusable = true;
			mLogView.Typeface = Typeface.Monospace;

			// Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
			int paddingDips = 16;
			float scale = Resources.DisplayMetrics.Density;
			int paddingPixels = (int) ((paddingDips * (scale)) + .5);
			mLogView.SetPadding (paddingPixels, paddingPixels, paddingPixels, paddingPixels);
			mLogView.CompoundDrawablePadding = paddingPixels;

			mLogView.Gravity = GravityFlags.Bottom;
			mLogView.SetTextAppearance (Activity, Android.Resource.Style.TextAppearanceMedium);

			mScrollView.AddView (mLogView);
			return mScrollView;
		}
		/// <summary>
		/// Creates a new view for the profile fragment whenever a new username is selected 
		/// and displays the corresponding profile bios.
		/// <param name="inflater">Android layout inflater.</param>
		/// <param name="container">.ndroid view container</param>
		/// <param name="savedInstanceState">Bundle.</param>
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            if (container == null)
            {
                // Currently in a layout without a container, so no reason to create our view.
                return null;
            }

            var scroller = new ScrollView(Activity);
            
            var text = new TextView(Activity);
            var padding = Convert.ToInt32(TypedValue.ApplyDimension(ComplexUnitType.Dip, 4, Activity.Resources.DisplayMetrics));
            text.SetPadding(padding, padding, padding, padding);
            text.TextSize = 24;

			try {
				text.Text = nearbyBios[ShownUserId];
			}
			catch(IndexOutOfRangeException e) {
				string error = "\n\nServer offline\n\n" + e.Message;
				System.Diagnostics.Debug.WriteLine (error);
				nearbyBios = new string[1];
				nearbyBios [0] = error;
			}
			

            scroller.AddView(text);

            return scroller;
        }
Exemplo n.º 7
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            ScrollView _scrl = new ScrollView (this);
            LinearLayout _linear = new LinearLayout (this);
            _linear.Orientation = Orientation.Vertical;
            _scrl.AddView (_linear);

            Button _addBtn = new Button (this);
            _addBtn.Text = "Click to add TextViiews and EditTexts";
            _linear.AddView (_addBtn);

            _addBtn.Click += (sender, e) => {

                // TODO Auto-generated method stub
                count++;

                TextView _text = new TextView (ApplicationContext);
                _text.Text = "Number : " + count.ToString();
                _linear.AddView(_text);

                EditText _edit = new EditText(ApplicationContext);
                _edit.Text = " Edit Text : " + count.ToString();
                _linear.AddView(_edit);

            };

            this.SetContentView (_scrl);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            ScrollView scrollView = new ScrollView(this);

            TableLayout tableLayout = new TableLayout(this);
            TableRow tablerow = new TableRow(this);

            // make columns span the whole width
            tableLayout.SetColumnStretchable(0, true);
            tableLayout.SetColumnStretchable(1, true);

            TextView DepartCollumn = new TextView(this);
            DepartCollumn.Text = "Depart";
            tablerow.AddView(DepartCollumn);
            TimetableList.TimeColumns.Add(DepartCollumn);
            TextView ArriveCollumn = new TextView(this);
            ArriveCollumn.Text = "Arrive";
            tablerow.AddView(ArriveCollumn);
            TimetableList.TimeColumns.Add(ArriveCollumn);

            tableLayout.AddView(tablerow);
            //			tableLayout.SetScrollContainer(true);

            scrollView.AddView(tableLayout);

            SetContentView(scrollView);
        }
 public StickyHeaderScrollView(Context context, View header, int minHeightHeader, HeaderAnimator headerAnimator, ScrollView scrollView)
     : base(context, header, scrollView, minHeightHeader, headerAnimator)
 {
     // scroll events
     scrollView.ViewTreeObserver.AddOnGlobalLayoutSingleFire(() => headerAnimator.OnScroll(-scrollView.ScrollY));
     scrollView.ViewTreeObserver.ScrollChanged += (sender, e) => headerAnimator.OnScroll(-scrollView.ScrollY);
 }
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			base.OnCreateView (inflater, container, savedInstanceState);

			ctrl = ((ScreenController)this.Activity);

			if (container == null)
				return null;

			var view = inflater.Inflate(Resource.Layout.ScreenDetail, container, false);

			layoutDefault = view.FindViewById<ScrollView> (Resource.Id.scrollView);
			layoutMap = view.FindViewById<LinearLayout> (Resource.Id.layoutMap);

			imageView = view.FindViewById<ImageView> (Resource.Id.imageView);
			textDescription = view.FindViewById<TextView> (Resource.Id.textDescription);
			textWorksWith = view.FindViewById<TextView> (Resource.Id.textWorksWith);
			layoutButtons = view.FindViewById<LinearLayout> (Resource.Id.layoutButtons);
			layoutWorksWith = view.FindViewById<LinearLayout> (Resource.Id.layoutWorksWith);

			layoutButtons.Visibility = ViewStates.Visible;
			layoutWorksWith.Visibility = ViewStates.Gone;
			layoutMap.Visibility = ViewStates.Gone;

			HasOptionsMenu = !(activeObject is Task);

			return view;
		}
Exemplo n.º 11
0
		public void SetElement(VisualElement element)
		{
			ScrollView oldElement = _view;
			_view = (ScrollView)element;

			if (oldElement != null)
			{
				oldElement.PropertyChanged -= HandlePropertyChanged;
				((IScrollViewController)oldElement).ScrollToRequested -= OnScrollToRequested;
			}
			if (element != null)
			{
				OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));

				if (_container == null)
				{
					Tracker = new VisualElementTracker(this);
					_container = new ScrollViewContainer(_view, Forms.Context);
				}

				_view.PropertyChanged += HandlePropertyChanged;
				Controller.ScrollToRequested += OnScrollToRequested;

				LoadContent();
				UpdateBackgroundColor();

				UpdateOrientation();

				element.SendViewInitialized(this);

				if (!string.IsNullOrEmpty(element.AutomationId))
					ContentDescription = element.AutomationId;
			}
		}
Exemplo n.º 12
0
		public RelativeLayoutGallery()
		{
			var layout = new RelativeLayout ();

			var box1 = new ContentView {
				BackgroundColor = Color.Gray,
				Content = new Label {
					Text = "0"
				}
			};

			double padding = 10;
			layout.Children.Add (box1, () => new Rectangle (((layout.Width + padding) % 60) / 2, padding, 50, 50));

			var last = box1;
			for (int i = 0; i < 200; i++) {
				var relativeTo = last; // local copy
				var box = new ContentView {
					BackgroundColor = Color.Gray,
					Content = new Label {
						Text = (i+1).ToString ()
					}
				};

				Func<View, bool> pastBounds = view => relativeTo.Bounds.Right + padding + relativeTo.Width > layout.Width;
				layout.Children.Add (box, () => new Rectangle (pastBounds (relativeTo) ? box1.X : relativeTo.Bounds.Right + padding,
													  pastBounds (relativeTo) ? relativeTo.Bounds.Bottom + padding : relativeTo.Y, 
													  relativeTo.Width, 
													  relativeTo.Height));

				last = box;
			}

			Content = new ScrollView {Content = layout, Padding = new Thickness(50)};
		}
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            var p = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            var view = new LinearLayout(_context);
            view.LayoutParameters = p;

            var optionHolder = new LinearLayout(_context);
            optionHolder.Orientation = Orientation.Vertical;
            optionHolder.LayoutParameters = p;

            foreach (var option in _options)
            {
                optionHolder.AddView(AddCategoryRow(option));
            }
            var scrollView = new ScrollView(_context);
            scrollView.LayoutParameters = p;
            scrollView.AddView(optionHolder);
            view.AddView(scrollView);

            var dialog = new Android.Support.V7.App.AlertDialog.Builder(_context);
            dialog.SetTitle(_title);
            dialog.SetView(view);
            //dialog.SetNegativeButton("Cancel", (s, a) => { });
            dialog.SetPositiveButton("Ok", (s, a) => { });
            return dialog.Create();
        }
Exemplo n.º 14
0
		public Issue1538 ()
		{
			StackLayout sl = new StackLayout(){VerticalOptions = LayoutOptions.FillAndExpand};
			sl.Children.Add( _sv = new ScrollView(){HeightRequest=100} );
			Content = sl;

			AddContentDelayed ();
		}
Exemplo n.º 15
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            if (container == null)
            {
                // Currently in a layout without a container, so no reason to create our view.
                return null;
            }

            var scroller = new ScrollView(Activity);
            var llayout = new LinearLayout (Activity);
            llayout.Orientation = Orientation.Vertical;
            var text = new TextView(Activity);
            var padding = Convert.ToInt32(TypedValue.ApplyDimension(ComplexUnitType.Dip, 4, Activity.Resources.DisplayMetrics));
            text.SetPadding(padding, padding, padding, padding);
            text.TextSize = 24;
            var doc = DoctorManager.GetDoctor (ShownPlayId);
            var hosp = HospitalManager.GetHospital (doc.HospitalID);
            text.Text = "Фамилия: " + doc.FirstName + "\n\n" +
            "Имя: " + doc.SecondName + "\n\n" +
            "Отчество: " + doc.ThirdName + "\n\n" +
            "Больница: " + hosp.Name + "\n\n" +
            "Адрес: " + hosp.Adress;
                //Shakespeare.Dialogue[ShownPlayId];
            llayout.AddView(text);

            Spinner spn = new Spinner (Activity);

            var preses = Presentations.GetPresentations ();

            List<String> presentsTitle = new List<String>();
            for (int i = 0; i < preses.Count; i++) {
                for (int j = 0; j < preses[i].parts.Count; j++) {
                    presentsTitle.Add (preses [i].name + "." + preses [i].parts [j].name);
                }
            }
            spn.Adapter = new ArrayAdapter<String>(Activity, Android.Resource.Layout.SimpleListItemChecked, presentsTitle.ToArray());
            llayout.AddView(spn);

            Button btnSlide = new Button (Activity);
            btnSlide.Text = "Начать показ!";
            btnSlide.Click += (sender, e) => {
                var slides = new Intent ( Activity, typeof(PresentationView));
                int presentationID = 0;
                int partID = spn.SelectedItemPosition;
                for (int i=0; (i <= preses.Count-1) && (partID > preses[i].parts.Count-1); i++){
                    presentationID = i+1;
                    partID = partID - preses [i].parts.Count;
                }
                slides.PutExtra ("presentationID", presentationID);
                slides.PutExtra ("partID", partID);
                slides.PutExtra ("doctorID", ShownPlayId);
                StartActivity (slides);
            };
            llayout.AddView (btnSlide);

            scroller.AddView (llayout);
            return scroller;
        }
Exemplo n.º 16
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = new SearchOptionsView(this.Activity, SearchLocation, Category);

            var scrollView = new ScrollView(this.Activity);
            scrollView.AddView(view);

            return scrollView;
        }
Exemplo n.º 17
0
      protected override void OnCreate(Android.Os.Bundle savedInstanceState)
      {
         base.OnCreate(savedInstanceState);

         ScrollView scroll = new ScrollView(this);
         TextView license = new TextView(this);
         license.SetText(GooglePlayServicesUtil.GetOpenSourceSoftwareLicenseInfo(this));
         scroll.AddView(license);
         SetContentView(scroll);
      }
Exemplo n.º 18
0
			public MyCell()
			{
				var scroll = new ScrollView {
					Orientation = ScrollOrientation.Horizontal,
					Content = new Label()
				};

				scroll.Content.SetBinding (Label.TextProperty, ".");

				View = scroll;
			}
Exemplo n.º 19
0
		public void TestConstructor ()
		{
			ScrollView scrollView = new ScrollView ();

			Assert.Null (scrollView.Content);

			View view = new View ();
			scrollView = new ScrollView {Content = view};

			Assert.AreEqual (view, scrollView.Content);
		}
Exemplo n.º 20
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
             SetContentView(Resource.Layout.activity_b);
            scrollView = (ScrollView)FindViewById<ScrollView>(Resource.Id.tools_scrlllview);
            shopAdapter = new ShopAdapter(SupportFragmentManager);
            inflater = LayoutInflater.From(this);
            ShowToolsView();
            InitPager();
        }
Exemplo n.º 21
0
		protected override void Init ()
		{
			// Set up the scroll viewer page
			var scrollToButton = new Button () { Text = "Now push this button" };

			var stackLayout = new StackLayout ();

			stackLayout.Children.Add (scrollToButton);

			for (int n = 0; n < 100; n++) {
				stackLayout.Children.Add (new Label () { Text = n.ToString () });
			}

			var scrollView = new ScrollView () {
				Content = stackLayout
			};

			var pageWithScrollView = new ContentPage () {
				Content = scrollView
			};

			// Set up the start page
			var goButton = new Button () {
				Text = "Push this button"
			};

			var successLabel = new Label () { Text = "The test has passed", IsVisible = false };

			var startPage = new ContentPage () {
				Content = new StackLayout {
					VerticalOptions = LayoutOptions.Center,
					Children = {
						goButton,
						successLabel
					}
				}
			};

			PushAsync (startPage);

			goButton.Clicked += (sender, args) => Navigation.PushAsync (pageWithScrollView);

			scrollToButton.Clicked += async (sender, args) => {
				try {
					// Deliberately not awaited so we can simulate a user navigating back
					scrollView.ScrollToAsync (0, 1500, true);
					await Navigation.PopAsync ();
					successLabel.IsVisible = true;
				} catch (Exception ex) {
					Debug.WriteLine (ex);
				}
			};
		}
Exemplo n.º 22
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            FindViewById<Button>(Resource.Id.btnAdd).Click += btnAdd_Click;
            FindViewById<Button>(Resource.Id.btnFunds).Click += btnFunds_Click;
            hScroll = FindViewById<ScrollView>(Resource.Id.hScroll);
            Refresh();
        }
		protected override void OnCreate (Bundle bundle)
		{
			/*base.OnCreate (bundle);
			SetContentView(Resource.Layout.CameraView);
			camera = (SurfaceView)FindViewById(Resource.Id.smallcameraview);
			camera.Holder.SetType(SurfaceType.PushBuffers);
			holder = camera.Holder;
			Session.setSurfaceHolder(holder);*/

			base.OnCreate (bundle);
			base.RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait;
			SetContentView (Resource.Layout.Main);
			startButton = FindViewById<ImageButton> (Resource.Id.startButton);
			connectButton = FindViewById<ImageButton> (Resource.Id.connectToClientButton);
			settingsButton = FindViewById<ImageButton> (Resource.Id.settingsButton);

			connectLight = FindViewById<ImageView> (Resource.Id.connectLight);
			streamingLight = FindViewById<ImageView> (Resource.Id.streamingLight);

			connectText = FindViewById<TextView> (Resource.Id.connectStatus);
			streamText = FindViewById<TextView> (Resource.Id.streamingStatus);

			logView = FindViewById<TextView> (Resource.Id.log);
			scrollView = FindViewById<ScrollView> (Resource.Id.logScrollView);
			scrollView.FullScroll(FocusSearchDirection.Down);
			logView.SetText(savedText,TextView.BufferType.Editable);
			scrollView.ScrollTo(0,logView.Height);
			scrollView.FullScroll(FocusSearchDirection.Down);

			camera = (SurfaceView)FindViewById(Resource.Id.smallcameraview);
			camera.Holder.SetType(SurfaceType.PushBuffers);
			//holder = camera.Holder;
			Session.SetSurfaceHolder(camera.Holder);


			startButton.Click += OnStartClicked;
			connectButton.Click += OnConnectToClientClicked;
			settingsButton.Click += OnStettingsClicked;

			//this should be set based on something
			DisableButton(connectButton);
			EnableButton(settingsButton);
			SetStartICon();

			SetDisableLight(connectLight);
			SetDisableLight(streamingLight);

			connectText.Text = "Client is not connected";
			streamText.Text = "Not streaming";

			PreferenceManager.SetDefaultValues(this, Resource.Layout.Settings,false);
		}
Exemplo n.º 24
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.main);
			mLogTextView = (TextView)FindViewById (Resource.Id.log);
			mSCroller = (ScrollView)FindViewById (Resource.Id.scroller);
			mGoogleApiClient = new GoogleApiClientBuilder (this).AddApi (WearableClass.API)
				.AddConnectionCallbacks (this)
				.AddOnConnectionFailedListener (this)
				.Build ();
		}
        private void Include()
        {
            var scrollView = new ScrollView(null);
            ValidationAttribute attribute = new RequiredAttribute();
            var validationContext = new ValidationContext(this, null, new Dictionary<object, object>());
            validationContext.DisplayName = validationContext.DisplayName;
            validationContext.Items.Add(null, null);
            validationContext.MemberName = validationContext.MemberName;
            validationContext.ObjectInstance.GetHashCode();

            ValidationResult result = attribute.GetValidationResult(this, validationContext);
            result.ErrorMessage = result.ErrorMessage;
            result.MemberNames.GetHashCode();
        }
Exemplo n.º 26
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);
            _console = FindViewById<TextView>(Resource.Id.console);
            _scroll = FindViewById<ScrollView>(Resource.Id.consoleScroll);

            _benchmarkManager = new BenchmarkManager();
            _benchmarkManager.Log += BenchmarkManagerOnLog;

            using (var buttonRun = FindViewById<Button>(Resource.Id.run))
            buttonRun.Click += ButtonRunOnClick;
        }
        private View CreateView(TestRunInfo testRunDetails)
        {
            LinearLayout layout = new LinearLayout(this);
            layout.Orientation = Orientation.Vertical;

            TextView titleTextView = new TextView(this);
            titleTextView.LayoutParameters = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.FillParent, 48);

            titleTextView.SetBackgroundColor(Color.Argb(255,50,50,50));
            titleTextView.SetPadding(20,0,20,0);

            titleTextView.Gravity = GravityFlags.CenterVertical;
            titleTextView.Text = testRunDetails.Description;
            titleTextView.Ellipsize = TextUtils.TruncateAt.Start;

            TextView descriptionTextView = new TextView(this);
            descriptionTextView.LayoutParameters = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent)
            {
                LeftMargin = 40,
                RightMargin = 40
            };

           if (testRunDetails.Running)
    		{
				descriptionTextView.Text = "Test is currently running.";
			}
			else if (testRunDetails.Passed)
			{
				descriptionTextView.Text = "wohhoo, Test has passed.";
			}
			else if (testRunDetails.TestResult != null)
			{
				descriptionTextView.Text = testRunDetails.TestResult.Message + "\r\n\r\n" + testRunDetails.TestResult.StackTrace;	
			}

            ScrollView scrollView = new ScrollView(this);
            scrollView.LayoutParameters = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);

            scrollView.AddView(descriptionTextView);

            layout.AddView(titleTextView);
            layout.AddView(scrollView);

            return layout;
        }
        private static void Include()
        {
            var tuple = Tuple.Create<object, object>(null, null);
            var item1 = tuple.Item1;
            var item2 = tuple.Item2;

            var scrollView = new ScrollView(null);

            var l = new ListView(null);
            l.ItemLongClick += (sender, args) => { args.View.ToString(); };
            l.ItemLongClick -= (sender, args) => { };

            var toolbar = new Toolbar(null);
            toolbar.Menu.ToString();
            toolbar.Title = toolbar.Title;
        }
Exemplo n.º 29
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            var view = inflater.Inflate(Resource.Layout.CallPic, container, false);
            scrollView = view.FindViewById<ScrollView>(Resource.Id.picZoom);
            picture = view.FindViewById<ImageView>(Resource.Id.viewPic);
            text = view.FindViewById <TextView>(Resource.Id.callPicText);
            link = view.FindViewById<TextView>(Resource.Id.callPicURL);
            createdBy = view.FindViewById<TextView>(Resource.Id.callPicCreated);
            Dialog.SetCancelable(true);
            Dialog.SetCanceledOnTouchOutside(true);

            setPic(view);
            return view;
        }
Exemplo n.º 30
0
        protected override void OnCreate (Bundle savedState) 
        {
            base.OnCreate (savedState);

            var scroll = new ScrollView (this);

            var license = new TextView (this);

            license.Text = GooglePlayServicesUtil.GetOpenSourceSoftwareLicenseInfo (this);
            scroll.AddView (license);

            SetContentView (scroll);

            if (Build.VERSION.SdkInt >= BuildVersionCodes.Honeycomb) {
                ActionBar.SetDisplayHomeAsUpEnabled (true);
            }
        }
Exemplo n.º 31
0
        public StartPage()
        {
            var toCardsBtn = new Button {
                Text = "CardsView Items"
            };

            toCardsBtn.Clicked += (sender, e) =>
            {
                this.Navigation.PushAsync(new CardsSampleView());
            };

            var toCoverFlowBtn = new Button {
                Text = "CoverFlowView"
            };

            toCoverFlowBtn.Clicked += (sender, e) =>
            {
                this.Navigation.PushAsync(new CoverFlowSampleXamlView());
            };

            var toCarouselScrollBtn = new Button {
                Text = "CarouselView scroll"
            };

            toCarouselScrollBtn.Clicked += (sender, e) =>
            {
                this.Navigation.PushAsync(new CarouselSampleSrollView());
            };

            var toCarouselDoubleBtn = new Button {
                Text = "CarouselView DoubleView"
            };

            toCarouselDoubleBtn.Clicked += (sender, e) =>
            {
                this.Navigation.PushAsync(new CarouselSampleDoubleView());
            };

            var toCarouselNoTemplateBtn = new Button {
                Text = "CarouselView No template"
            };

            toCarouselNoTemplateBtn.Clicked += (sender, e) =>
            {
                this.Navigation.PushAsync(new CarouselSampleViewNoTemplate());
            };

            var toCarouselXamlBtn = new Button {
                Text = "CarouselView Xaml"
            };

            toCarouselXamlBtn.Clicked += (sender, e) =>
            {
                this.Navigation.PushAsync(new CarouselSampleXamlView());
            };

            var toCarouselListBtn = new Button {
                Text = "Carousel ListView"
            };

            toCarouselListBtn.Clicked += (sender, e) =>
            {
                this.Navigation.PushAsync(new CarouselSampleListView());
            };

            var toCarouselEmbBtn = new Button {
                Text = "Carousel Embedded views"
            };

            toCarouselEmbBtn.Clicked += (sender, e) =>
            {
                this.Navigation.PushAsync(new CarouselSampleEmbeddedView());
            };

            Content = new ScrollView
            {
                Content = new StackLayout
                {
                    Children =
                    {
                        toCardsBtn,
                        toCoverFlowBtn,
                        toCarouselScrollBtn,
                        toCarouselDoubleBtn,
                        toCarouselNoTemplateBtn,
                        toCarouselXamlBtn,
                        toCarouselListBtn,
                        toCarouselEmbBtn
                    }
                }
            };
        }
Exemplo n.º 32
0
        /// <summary>
        /// Create set window.
        /// </summary>
        public SetWindow(RequestWidget _reqW, ResponseWidget _resP)
        {
            // Set
            ReqWidget = _reqW;
            ResWidget = _resP;

            // Set default size
            Width  = 450;
            Height = 500;

            // This window can not be maximalized
            Resizable = true;

            // Icon
            Icon = Image.FromResource(DirectorImages.EDIT_ICON);

            // Set content
            Title = Director.Properties.Resources.SetContentTitle;

            // Center screen
            InitialLocation = WindowLocation.CenterScreen;

            // Create input area
            VBox InputArea = new VBox();

            // Prepare input
            TextInput = new TextEntry()
            {
                ExpandVertical   = true,
                ExpandHorizontal = true,
                MultiLine        = true
            };

            TextInput.Text = "";

            // Content type combo box
            ContentTypeSelect = new ComboBox();
            ContentTypeSelect.Items.Add(ContentType.JSON, "JSON");
            ContentTypeSelect.Items.Add(ContentType.XML, "XML");
            ContentTypeSelect.Items.Add(ContentType.PLAIN, "PLAIN");
            ContentTypeSelect.SelectedIndex = 0;

            if (ReqWidget != null)
            {
                if (ReqWidget.ActiveRequest.RequestTemplateType == ContentType.JSON)
                {
                    TextInput.Text = JSONFormatter.Format(ReqWidget.ActiveRequest.RequestTemplate);
                }
                if (TextInput.Text.Length == 0)
                {
                    TextInput.Text = ReqWidget.ActiveRequest.RequestTemplate;
                }
                ContentTypeSelect.SelectedItem = ReqWidget.ActiveRequest.RequestTemplateType;
            }
            else if (ResWidget != null)
            {
                if (ResWidget.ActiveRequest.ResponseTemplateType == ContentType.JSON)
                {
                    TextInput.Text = JSONFormatter.Format(ResWidget.ActiveRequest.ResponseTemplate);
                }
                if (TextInput.Text.Length == 0)
                {
                    TextInput.Text = ResWidget.ActiveRequest.ResponseTemplate;
                }
                ContentTypeSelect.SelectedItem = ResWidget.ActiveRequest.ResponseTemplateType;
            }

            // Add
            InputArea.PackStart(new Label()
            {
                Markup = "<b>Content type:</b>"
            });
            InputArea.PackStart(ContentTypeSelect, false, true);


            ScrollView ScrollTextInput = new ScrollView()
            {
                Content = TextInput
            };

            InputArea.PackStart(new Label()
            {
                Markup = "<b>" + Director.Properties.Resources.PasteInput + "</b>"
            });
            InputArea.PackStart(ScrollTextInput, true, true);

            // Prepare output
            InputArea.PackStart(new Label()
            {
                Markup = "<b>" + Director.Properties.Resources.Output + "</b>"
            });
            ErrorReport = new MarkdownView();
            InputArea.PackStart(ErrorReport, true, true);

            // Btn
            Button ConfirmButton = new Button(Image.FromResource(DirectorImages.OK_ICON),
                                              Director.Properties.Resources.ConfirmInput)
            {
                WidthRequest     = 150,
                ExpandHorizontal = false,
                ExpandVertical   = false
            };

            InputArea.PackStart(ConfirmButton, expand: false, hpos: WidgetPlacement.End);

            // Save
            ConfirmButton.Clicked += ConfirmButton_Clicked;

            // Content is input area
            Content = InputArea;
        }
Exemplo n.º 33
0
        public MainPage()
        {
            //BackgroundColor = Color.White;
            BackgroundImage = "MainBack.png";

            var optionsList = new List <MainPageItensPattern>();
            // opções sendo criadas e adicionadas a lista

            //------------------------------------------------------------------
            // Meu perfil
            var menuInfo = new MenuOption()
            {
                Name      = "Meu Perfil",
                BkgColor  = "#FFB74D",
                ImagePath = DataAndHelper.Data.MY_PROFILE_ICON
            };
            var itemAux          = new MainPageItensPattern(menuInfo);
            var ClickListenerAux = new TapGestureRecognizer();

            ClickListenerAux.Tapped += delegate
            {
                Navigation.PushModalAsync(new UserHomePage());
            };
            itemAux.GestureRecognizers.Add(ClickListenerAux);
            optionsList.Add(itemAux);

            //------------------------------------------------------------------
            // Nova Corrida
            menuInfo = new MenuOption()
            {
                Name      = "Nova Corrida",
                BkgColor  = "#FFB74D",
                ImagePath = DataAndHelper.Data.NEW_TRAIL_ICON
            };
            itemAux                  = new MainPageItensPattern(menuInfo);
            ClickListenerAux         = new TapGestureRecognizer();
            ClickListenerAux.Tapped += delegate
            {
                Navigation.PushAsync(new RunningMap());
            };
            itemAux.GestureRecognizers.Add(ClickListenerAux);
            optionsList.Add(itemAux);

            //------------------------------------------------------------------
            // Historico de Carridas
            menuInfo = new MenuOption()
            {
                Name      = "Historico de Corridas",
                BkgColor  = "#FFB74D",
                ImagePath = DataAndHelper.Data.ROUTE_HISTORIC_ICON
            };
            itemAux                  = new MainPageItensPattern(menuInfo);
            ClickListenerAux         = new TapGestureRecognizer();
            ClickListenerAux.Tapped += delegate
            {
                Navigation.PushAsync(new HistoricPage_Copy());
            };
            itemAux.GestureRecognizers.Add(ClickListenerAux);
            optionsList.Add(itemAux);

            //------------------------------------------------------------------
            // Historico de Carridas
            menuInfo = new MenuOption()
            {
                Name      = "Pesquisar Trilhas",
                BkgColor  = "#FFB74D",
                ImagePath = DataAndHelper.Data.TRAIL_SEARCH_ICON
            };
            itemAux                  = new MainPageItensPattern(menuInfo);
            ClickListenerAux         = new TapGestureRecognizer();
            ClickListenerAux.Tapped += delegate
            {
                Navigation.PushAsync(new TrailSearch());
            };
            itemAux.GestureRecognizers.Add(ClickListenerAux);
            optionsList.Add(itemAux);
            //------------------------------------------------------------------
            // Carrega Historico para demo

            /*menuInfo = new MenuOption()
             * {
             *  Name = "Apresentação",
             *  BkgColor = "#FFB74D",
             *  ImagePath = DataAndHelper.Data.PRESENTATION_ICON
             * };
             *
             * itemAux = new MainPageItensPattern(menuInfo);
             * ClickListenerAux = new TapGestureRecognizer();
             * ClickListenerAux.Tapped += async delegate
             * {
             *  Business.ApiRequestN api = new Business.ApiRequestN();
             *
             *  foreach (var item in DataAndHelper.Data.DemoHist)
             *  {
             *      await api.AddToUserHistoricAsync(item);
             *  }
             *
             *  await DisplayAlert("YEY!", "Deu certo!", "YUPI");
             * };
             * itemAux.GestureRecognizers.Add(ClickListenerAux);
             * optionsList.Add(itemAux);*/
            //------------------------------------------------------------------

            var mainLayout = new StackLayout();

            int count         = 0;
            var supportLayout = new StackLayout()
            {
                Orientation     = StackOrientation.Horizontal,
                VerticalOptions = LayoutOptions.Start
            };

            foreach (var item in optionsList)
            {
                if (count < 1)
                {
                    supportLayout.Children.Add(item);
                }
                else
                {
                    supportLayout.Children.Add(item);
                    mainLayout.Children.Add(supportLayout);
                    supportLayout = new StackLayout()
                    {
                        Orientation     = StackOrientation.Horizontal,
                        VerticalOptions = LayoutOptions.Start
                    };
                    count = -1;
                }
                count++;
            }
            mainLayout.Children.Add(supportLayout);

            var sv = new ScrollView()
            {
                Content = mainLayout
            };

            Content = sv;
        }
Exemplo n.º 34
0
        public SlideShowView()
        {
            HeightRequest = 200;

            var image1 = new Image()
            {
                Source = new FileImageSource()
                {
                    File = "bama1.jpg"
                }
            };
            var image2 = new Image()
            {
                Source = new FileImageSource()
                {
                    File = "bama2.jpg"
                }
            };
            var image3 = new Image()
            {
                Source = new FileImageSource()
                {
                    File = "bama3.jpg"
                }
            };
            var image4 = new Image()
            {
                Source = new FileImageSource()
                {
                    File = "bama4.jpg"
                }
            };
            var image5 = new Image()
            {
                Source = new FileImageSource()
                {
                    File = "bama5.jpg"
                }
            };
            var image6 = new Image()
            {
                Source = new FileImageSource()
                {
                    File = "bama6.jpg"
                }
            };
            var image7 = new Image()
            {
                Source = new FileImageSource()
                {
                    File = "bama7.jpg"
                }
            };
            var image8 = new Image()
            {
                Source = new FileImageSource()
                {
                    File = "bama8.jpg"
                }
            };
            var image9 = new Image()
            {
                Source = new FileImageSource()
                {
                    File = "bama9.jpg"
                }
            };

            var stack = new StackLayout()
            {
                Padding     = new Thickness(0, 0, 0, 10),
                Orientation = StackOrientation.Horizontal,
                Spacing     = 10,
                Children    =
                {
                    image1,
                    image2,
                    image3,
                    image4,
                    image5,
                    image6,
                    image7,
                    image8,
                    image9
                }
            };

            Content = new ScrollView()
            {
                Content     = stack,
                Orientation = ScrollOrientation.Horizontal
            };
        }
Exemplo n.º 35
0
        public BolBrzuchaPage()
        {
#pragma warning restore 1591

            // TWORZĘ SOBIE PICKERY - ktore mi beda potrzebne
            Picker age = new Picker
            {
                Title         = "Wskaż wiek osoby",
                Items         = { "Nie wiem", "Powyżej 14", "Poniżej 14" },
                SelectedIndex = 0
            };

            Picker gender = new Picker
            {
                Title         = "Wskaż płeć osoby",
                Items         = { "Mężczyzna", "Kobieta" },
                SelectedIndex = 0
            };

            Picker breathingProblems = new Picker
            {
                Title         = "Czy ma trudności w oddychaniu?",
                Items         = { "Nie", "Duszność", "Świszczący Oddech" },
                SelectedIndex = 0
            };

            Picker isVomitting = new Picker
            {
                Title         = "Czy wymiotuje?",
                Items         = { "Nie", "Tak" },
                SelectedIndex = 0
            };

            Picker doesExcrement = new Picker
            {
                Title         = "Czy wypróżnia się?",
                Items         = { "Nie wiem", "Tak", "Nie" },
                SelectedIndex = 0
            };

            Picker hasGases = new Picker
            {
                Title         = "Czy odchodzą gazy?",
                Items         = { "Nie wiem", "Tak", "Nie" },
                SelectedIndex = 0
            };

            Picker urinalProblems = new Picker
            {
                Title         = "Czy są problemy z oddawaniem moczu?",
                Items         = { "Nie wiem", "Tak", "Nie" },
                SelectedIndex = 0
            };

            Picker bloodInUrine = new Picker
            {
                Title         = "Czy występuje krew w moczu?",
                Items         = { "Nie wiem", "Tak", "Nie" },
                SelectedIndex = 0
            };

            Picker beenInTravel = new Picker
            {
                Title         = "Czy osoba odbyła podróż do krajów tropikalnych?",
                Items         = { "Nie wiem", "Tak", "Nie" },
                SelectedIndex = 0
            };

            Picker tookPainkillers = new Picker
            {
                Title         = "Czy osoba przyjmowała leki przeciwbólowe?",
                Items         = { "Nie wiem", "Tak", "Nie" },
                SelectedIndex = 0
            };

            Picker hadStomachSurgery = new Picker
            {
                Title         = "Czy osoba przechodziła operację w okolicy jamy brzusznej?",
                Items         = { "Nie wiem", "Tak", "Nie" },
                SelectedIndex = 0
            };

            Picker isIll = new Picker
            {
                Title         = "Czy poszkodowany choruje?",
                Items         = { "Nie wiem", "Tak", "Nie" },
                SelectedIndex = 0
            };

            Picker isTakingDrugs = new Picker
            {
                Title         = "Czy przyjmuje leki?",
                Items         = { "Nie wiem", "Tak", "Nie" },
                SelectedIndex = 0
            };

            Picker otherSymptoms = new Picker
            {
                Title         = "Czy widzisz dodatkowe niepokojące objawy?",
                Items         = { "Nie", "Tak" },
                SelectedIndex = 0
            };

            //Teraz tworze sobie sekcje ktore beda sie ukrywac

            StackLayout genderWomanSection = new StackLayout
            {
                IsVisible = false, //Domyslnie ukryte
                Children  =
                {
                    new Label
                    {
                        Text = "Kiedy wystąpiła ostatnia menstruacja?"
                    },
                    new Entry
                    {
                    }
                }
            };

            StackLayout ageAbove14Section = new StackLayout
            {
                IsVisible = false, //Domyslnie ukryte
                Children  =
                {
                    new Label
                    {
                        Text = gender.Title
                    },
                    genderWomanSection
                }
            };

            StackLayout breathingSection = new StackLayout
            {
                IsVisible = false, //Domyslnie ukryte
                Children  =
                {
                    new Label
                    {
                        Text = "Określ, jakie:"
                    },
                    new Entry
                    {
                    }
                }
            };

            StackLayout isVomittingSection = new StackLayout
            {
                IsVisible = false, //Domyslnie ukryte
                Children  =
                {
                    new Label
                    {
                        Text = "Od kiedy?"
                    },
                    new Entry
                    {
                    },
                    new Label
                    {
                        Text = "Ile razy?"
                    },
                    new Entry
                    {
                    },
                    new Label
                    {
                        Text = "Jaki jest rodzaj treści?"
                    },
                    new Entry
                    {
                    }
                }
            };

            StackLayout didExcrementSection = new StackLayout
            {
                IsVisible = false, //Domyslnie ukryte
                Children  =
                {
                    new Label
                    {
                        Text = "Jaki rodzaj stolca?"
                    },
                    new Entry
                    {
                    }
                }
            };

            StackLayout noExcrementSection = new StackLayout
            {
                IsVisible = false, //Domyslnie ukryte
                Children  =
                {
                    new Label
                    {
                        Text = "label"
                    },
                    new Entry
                    {
                    }
                }
            };

            StackLayout noGasesSection = new StackLayout
            {
                IsVisible = false, //Domyslnie ukryte
                Children  =
                {
                    new Label
                    {
                        Text = "Od kiedy?"
                    },
                    new Entry
                    {
                    }
                }
            };

            StackLayout urinalProblemSection = new StackLayout
            {
                IsVisible = false, //Domyslnie ukryte
                Children  =
                {
                    new Label
                    {
                        Text = "Jakie?"
                    },
                    new Entry
                    {
                    }
                }
            };

            StackLayout tookPainkillersSection = new StackLayout
            {
                IsVisible = false, //Domyslnie ukryte
                Children  =
                {
                    new Label
                    {
                        Text = "Kiedy"
                    },
                    new Entry
                    {
                    },
                    new Label
                    {
                        Text = "Jakie?"
                    },
                    new Entry
                    {
                    }
                }
            };

            StackLayout hadStomachSurgerySection = new StackLayout
            {
                IsVisible = false, //Domyslnie ukryte
                Children  =
                {
                    new Label
                    {
                        Text = "Kiedy?"
                    },
                    new Entry
                    {
                    }
                }
            };

            StackLayout isTakingDrugsSection = new StackLayout
            {
                IsVisible = false, //Domyslnie ukryte
                Children  =
                {
                    new Label
                    {
                        Text = "Jakie?"
                    },
                    new Entry
                    {
                    }
                }
            };

            StackLayout isIllSection = new StackLayout
            {
                IsVisible = false, //Domyslnie ukryte
                Children  =
                {
                    new Label
                    {
                        Text = isTakingDrugs.Title
                    },
                    isTakingDrugs,
                    isTakingDrugsSection
                }
            };

            StackLayout otherSection = new StackLayout
            {
                IsVisible = false, //Domyslnie ukryte
                Children  =
                {
                    new Label
                    {
                        Text = "Opisz:"
                    },
                    new Entry
                    {
                    }
                }
            };


            //A to juz sa Eventy pickerow ktore reaguja na zmiane

            age.SelectedIndexChanged += (sender, args) =>
            {
                if (age.SelectedIndex == 1)
                {
                    ageAbove14Section.IsVisible = true;
                }
                else
                {
                    ageAbove14Section.IsVisible = false;
                }
            };

            gender.SelectedIndexChanged += (sender, args) =>
            {
                if (gender.SelectedIndex == 1)
                {
                    genderWomanSection.IsVisible = true;
                }
                else
                {
                    genderWomanSection.IsVisible = false;
                }
            };

            breathingProblems.SelectedIndexChanged += (sender, args) =>
            {
                if (breathingProblems.SelectedIndex == 1)
                {
                    breathingSection.IsVisible = true;
                }
                else
                {
                    breathingSection.IsVisible = false;
                }
            };

            isVomitting.SelectedIndexChanged += (sender, args) =>
            {
                if (isVomitting.SelectedIndex == 1)
                {
                    isVomittingSection.IsVisible = true;
                }
                else
                {
                    isVomittingSection.IsVisible = false;
                }
            };

            doesExcrement.SelectedIndexChanged += (sender, args) =>
            {
                if (doesExcrement.SelectedIndex == 1)
                {
                    didExcrementSection.IsVisible = true;
                    noExcrementSection.IsVisible  = false;
                }
                else if (doesExcrement.SelectedIndex == 2)
                {
                    didExcrementSection.IsVisible = false;
                    noExcrementSection.IsVisible  = true;
                }
                else
                {
                    didExcrementSection.IsVisible = false;
                    noExcrementSection.IsVisible  = false;
                }
            };

            hasGases.SelectedIndexChanged += (sender, args) =>
            {
                if (hasGases.SelectedIndex == 2)
                {
                    noGasesSection.IsVisible = true;
                }
                else
                {
                    noGasesSection.IsVisible = false;
                }
            };

            urinalProblems.SelectedIndexChanged += (sender, args) =>
            {
                if (urinalProblems.SelectedIndex == 1)
                {
                    urinalProblemSection.IsVisible = true;
                }
                else
                {
                    urinalProblemSection.IsVisible = false;
                }
            };

            tookPainkillers.SelectedIndexChanged += (sender, args) =>
            {
                if (tookPainkillers.SelectedIndex == 1)
                {
                    tookPainkillersSection.IsVisible = true;
                }
                else
                {
                    tookPainkillersSection.IsVisible = false;
                }
            };

            hadStomachSurgery.SelectedIndexChanged += (sender, args) =>
            {
                if (hadStomachSurgery.SelectedIndex == 1)
                {
                    hadStomachSurgerySection.IsVisible = true;
                }
                else
                {
                    hadStomachSurgerySection.IsVisible = false;
                }
            };

            isIll.SelectedIndexChanged += (sender, args) =>
            {
                if (isIll.SelectedIndex == 1)
                {
                    isIllSection.IsVisible = true;
                }
                else
                {
                    isIllSection.IsVisible = false;
                }
            };

            isTakingDrugs.SelectedIndexChanged += (sender, args) =>
            {
                if (isTakingDrugs.SelectedIndex == 1)
                {
                    isTakingDrugsSection.IsVisible = true;
                }
                else
                {
                    isTakingDrugsSection.IsVisible = false;
                }
            };

            otherSymptoms.SelectedIndexChanged += (sender, args) =>
            {
                if (otherSymptoms.SelectedIndex == 1)
                {
                    otherSection.IsVisible = true;
                }
                else
                {
                    otherSection.IsVisible = false;
                }
            };

            //I glowny Page
            Title   = "Opisz szczegóły zdarzenia";
            Content = new ScrollView
            {
                Content = new StackLayout
                {
                    Children =
                    {
                        new Label
                        {
                            Text = "Podaj lokalizację bólu"
                        },
                        new Entry
                        {
                        },

                        new Label
                        {
                            Text = "Od jak dawna występuje ból?"
                        },
                        new Entry
                        {
                        },

                        new Label
                        {
                            Text = "W jakich okolicznościach pojawił się ból?"
                        },
                        new Entry
                        {
                        },

                        new Label
                        {
                            Text = age.Title
                        },
                        age,
                        ageAbove14Section,

                        new Label
                        {
                            Text = "Jaki jest charakter bólu?"
                        },
                        new Entry
                        {
                        },

                        new Label
                        {
                            Text = breathingProblems.Title
                        },
                        breathingProblems,
                        breathingSection,

                        new Label
                        {
                            Text = isVomitting.Title
                        },
                        isVomitting,
                        isVomittingSection,

                        new Label
                        {
                            Text = doesExcrement.Title
                        },
                        doesExcrement,
                        didExcrementSection,
                        noExcrementSection,

                        new Label
                        {
                            Text = hasGases.Title
                        },
                        hasGases,
                        noGasesSection,

                        new Label
                        {
                            Text = urinalProblems.Title
                        },
                        urinalProblems,
                        urinalProblemSection,

                        new Label
                        {
                            Text = bloodInUrine.Title
                        },
                        bloodInUrine,

                        new Label
                        {
                            Text = "Jaka jest temperatura ciała?"
                        },
                        new Entry
                        {
                        },

                        new Label
                        {
                            Text = "Jak wygląda skóra na ciele?"
                        },
                        new Entry
                        {
                        },

                        new Label
                        {
                            Text = beenInTravel.Title
                        },
                        beenInTravel,

                        new Label
                        {
                            Text = tookPainkillers.Title
                        },
                        tookPainkillers,
                        tookPainkillersSection,

                        new Label
                        {
                            Text = isIll.Title
                        },
                        isIll,
                        isIllSection,

                        new Label
                        {
                            Text = otherSymptoms.Title
                        },
                        otherSymptoms,
                        otherSection
                    }
                } //StackLayout
            }; // ScrollView
        }
Exemplo n.º 36
0
        public ButtonGallery()
        {
            BackgroundColor = new Color(0.9);

            var normal = new Button {
                Text = "Normal Button"
            };

            normal.Effects.Add(Effect.Resolve($"{Issues.Effects.ResolutionGroupName}.BorderEffect"));

            var disabled = new Button {
                Text = "Disabled Button"
            };
            var disabledswitch = new Switch();

            disabledswitch.SetBinding(Switch.IsToggledProperty, "IsEnabled");
            disabledswitch.BindingContext = disabled;

            var canTapLabel = new Label {
                Text = "Cannot Tap"
            };

            disabled.Clicked += (sender, e) => {
                canTapLabel.Text = "TAPPED!";
            };

            var click = new Button {
                Text = "Click Button"
            };
            var rotate = new Button {
                Text = "Rotate Button"
            };
            var transparent = new Button {
                Text = "Transparent Button"
            };
            string fontName;

            switch (Device.RuntimePlatform)
            {
            default:
            case Device.iOS:
                fontName = "Georgia";
                break;

            case Device.Android:
                fontName = "sans-serif-light";
                break;

            case Device.WinPhone:
            case Device.WinRT:
            case Device.UWP:
                fontName = "Comic Sans MS";
                break;
            }

            var font = Font.OfSize(fontName, NamedSize.Medium);

            var themedButton = new Button {
                Text            = "Accent Button",
                BackgroundColor = Color.Accent,
                TextColor       = Color.White,
                ClassId         = "AccentButton",
                Font            = font
            };
            var borderButton = new Button {
                Text            = "Border Button",
                BorderColor     = Color.Black,
                BackgroundColor = Color.Purple,
                BorderWidth     = 5,
                BorderRadius    = 5
            };
            var timer = new Button {
                Text = "Timer"
            };
            var busy = new Button {
                Text = "Toggle Busy"
            };
            var alert = new Button {
                Text = "Alert"
            };
            var alertSingle = new Button {
                Text = "Alert Single"
            };
            var image = new Button {
                Text = "Image Button", Image = new FileImageSource {
                    File = "bank.png"
                }, BackgroundColor = Color.Blue.WithLuminosity(.8)
            };

            themedButton.Clicked += (sender, args) => themedButton.Font = Font.Default;

            alertSingle.Clicked += (sender, args) => DisplayAlert("Foo", "Bar", "Cancel");

            disabled.IsEnabled = false;
            int i = 1;

            click.Clicked      += (sender, e) => { click.Text = "Clicked " + i++; };
            rotate.Clicked     += (sender, e) => rotate.RelRotateTo(180);
            transparent.Opacity = .5;

            int j = 1;

            timer.Clicked += (sender, args) => Device.StartTimer(TimeSpan.FromSeconds(1), () => {
                timer.Text = "Timer Elapsed " + j++;
                return(j < 4);
            });

            bool isBusy = false;

            busy.Clicked += (sender, args) => IsBusy = isBusy = !isBusy;

            alert.Clicked += async(sender, args) => {
                var result = await DisplayAlert("User Alert", "This is a user alert. This is only a user alert.", "Accept", "Cancel");

                alert.Text = result ? "Accepted" : "Cancelled";
            };

            borderButton.Clicked += (sender, args) => borderButton.BackgroundColor = Color.Default;

            Content = new ScrollView {
                Content = new StackLayout {
                    Padding  = new Size(20, 20),
                    Children =
                    {
                        normal,
                        new StackLayout {
                            Orientation = StackOrientation.Horizontal,
                            Children    =
                            {
                                disabled,
                                disabledswitch,
                            },
                        },
                        canTapLabel,
                        click,
                        rotate,
                        transparent,
                        themedButton,
                        borderButton,
                        new Button {
                            Text = "Thin Border",BorderWidth    =  1, BackgroundColor = Color.White, BorderColor = Color.Black, TextColor = Color.Black
                        },
                        new Button {
                            Text = "Thinner Border",BorderWidth    = .5, BackgroundColor = Color.White, BorderColor = Color.Black, TextColor = Color.Black
                        },
                        new Button {
                            Text = "BorderWidth == 0",BorderWidth    =  0, BackgroundColor = Color.White, BorderColor = Color.Black, TextColor = Color.Black
                        },
                        timer,
                        busy,
                        alert,
                        alertSingle,
                        image,
                    }
                }
            };
        }
Exemplo n.º 37
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            /// Project Class Member variable
            var nameLbl = new Label {
                Text = "Name"
            };
            var nameEntry = new Entry();

            nameEntry.SetBinding(Entry.TextProperty, "name");

            var deadlineLbl = new Label {
                Text = "Deadline"
            };
            var deadlinePicker = new DatePicker();

            deadlinePicker.SetBinding(DatePicker.DateProperty, "deadline");

            var isTeamLbl = new Label {
                Text = "Team Project"
            };
            var isTeamSwitch = new Switch();

            isTeamSwitch.SetBinding(Switch.IsToggledProperty, "isTeam");
            if (idx != -1)
            {
                isTeamSwitch.IsEnabled = false;
            }

            // File List
            fileList = new ListView
            {
                RowHeight    = 40,
                ItemTemplate = new DataTemplate(typeof(Views.FileCell))
            };
            fileList.ItemTemplate.SetBinding(FileCell.idxProperty, "Idx");
            fileList.SetBinding(ListView.ItemsSourceProperty, "fileList");
            if (idx != -1)
            {
                fileList.ItemsSource = dao.GetFileList();
            }
            fileList.ItemSelected += FileList_ItemSelected;
            fileUrlEntry           = new Entry {
                Placeholder = "URL", WidthRequest = 200, HeightRequest = 30
            };
            fileAddBtn = new Button {
                Text = "+", WidthRequest = 30, HeightRequest = 30, Margin = 0
            };
            fileAddBtn.Clicked += FileAddBtn_Clicked;

            fileLayout = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    new Label {
                        Text = "File list"
                    },
                    new StackLayout
                    {
                        VerticalOptions = LayoutOptions.Center,
                        Orientation     = StackOrientation.Horizontal,
                        Children        =
                        {
                            fileUrlEntry,
                            fileAddBtn
                        }
                    },
                    fileList,
                }
            };

            // Comment List
            commentList = new ListView
            {
                RowHeight              = 40,
                ItemTemplate           = new DataTemplate(typeof(Views.CommentCell)),
                IsPullToRefreshEnabled = true
            };
            commentList.ItemTemplate.SetBinding(CommentCell.idxProperty, "Idx");
            commentList.SetBinding(ListView.ItemsSourceProperty, "commentList");
            if (idx != -1)
            {
                commentList.ItemsSource = dao.GetCommentList();
            }
            commentList.RefreshCommand = new Command(() =>
            {
                commentList.ItemsSource  = dao.GetCommentList();
                commentList.IsRefreshing = false;
            });
            commentList.ItemSelected += CommentList_ItemSelected;
            commentAddBtn             = new Button {
                Text = "+", WidthRequest = 30, HeightRequest = 30
            };
            commentEntry = new Entry {
                WidthRequest = 300
            };
            commentEntry.SetBinding(Entry.TextProperty, "comment");
            commentAddBtn.Clicked += CommentAddBtn_Clicked;

            commentLayout = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    new Label {
                        Text = "Comment list"
                    },
                    new StackLayout
                    {
                        VerticalOptions = LayoutOptions.Center,
                        Orientation     = StackOrientation.Horizontal,
                        Children        =
                        {
                            commentEntry,
                            commentAddBtn
                        }
                    },
                    commentList,
                }
            };


            // Team List
            var teamList = new ListView
            {
                RowHeight = 40,
//				ItemTemplate = new DataTemplate(typeof(TeamCell)),
            };

            if (idx != -1)
            {
                teamList.ItemsSource = dao.GetTeamUser();
            }
//			teamList.SetBinding(ListView.ItemsSourceProperty, "teamList");
            var teamAddBtn = new Button {
                Text = "+", WidthRequest = 30, HeightRequest = 30
            };

            teamEntry = new Entry {
                WidthRequest = 300
            };
            teamAddBtn.Clicked += TeamAddBtn_Clicked;

            var teamLayout = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    new Label {
                        Text = "Team Member list"
                    },
                    new StackLayout
                    {
                        VerticalOptions = LayoutOptions.Center,
                        Orientation     = StackOrientation.Horizontal,
                        Children        =
                        {
                            teamEntry,
                            teamAddBtn
                        }
                    },
                    teamList,
                }
            };

            // Todo List
            TodoListView todolistView = new TodoListView(idx);
            var          todoLayout   = new StackLayout
            {
                Children =
                {
                    new Label {
                        Text = "Todo list"
                    },
                    todolistView
                }
            };

            // Buttons
            var saveButton = new Button {
                Text = "Save"
            };

            saveButton.Clicked += SaveButton_Clicked;

            var deleteButton = new Button {
                Text = "Delete"
            };

            deleteButton.Clicked += DeleteButton_Clicked;

            var cancelButton = new Button {
                Text = "Cancel"
            };

            cancelButton.Clicked += CancelButton_Clicked;

            var layout = new StackLayout
            {
                VerticalOptions = LayoutOptions.StartAndExpand,
                Padding         = new Thickness(20),
                Children        =
                {
                    nameLbl,     nameEntry,
                    deadlineLbl, deadlinePicker,
                    isTeamLbl,   isTeamSwitch
                }
            };

            if (idx != -1)
            {
                todolistView.BindingContext = dao.GetTodo();

                layout.Children.Add(fileLayout);
                layout.Children.Add(commentLayout);
                layout.Children.Add(todoLayout);

                if (((Project)this.BindingContext).isTeam)
                {
                    layout.Children.Add(teamLayout);
                }
            }
            layout.Children.Add(saveButton);
            layout.Children.Add(cancelButton);
            if (idx != -1)
            {
                layout.Children.Add(deleteButton);
            }

            scrollView         = new ScrollView();
            scrollView.Content = layout;

            Content = scrollView;
        }
Exemplo n.º 38
0
        public Detsember()
        {
            Title  = "Detsember";
            _label = new Label()
            {
                Text              = "Jõululaupäev",
                FontAttributes    = FontAttributes.Bold,
                FontSize          = 24,
                TextColor         = Color.Black,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                Padding           = new Thickness(10, 10, 10, 10),
            };
            _label1 = new Label()
            {
                Text           = "24. detsember",
                FontAttributes = FontAttributes.Italic,
                Padding        = new Thickness(10, 10, 10, 10),
            };
            _label2 = new Label()
            {
                Text      = "Jõululaupäev (ka: jõuluõhtu) on 24. detsember, päev enne esimest jõulupüha. Eestis on see päev riigipüha.",
                FontSize  = 18,
                TextColor = Color.Black,
                Padding   = new Thickness(10, 10, 10, 10),
            };
            _label3 = new Label()
            {
                Text      = "Juliuse kalendri järgi, mida kasutab teiste seas Vene Õigeusu Kirik, langeb see päev praegu (aastatel 1900–2099) 6. jaanuarile.",
                FontSize  = 18,
                TextColor = Color.Black,
                Padding   = new Thickness(10, 10, 10, 10),
            };
            _image = new Image()
            {
                Source = ImageSource.FromFile("joulu.jpg"),
                Margin = new Thickness(15, 20, 15, 5),
            };
            var tapGestureRecognizer1 = new TapGestureRecognizer();

            tapGestureRecognizer1.Tapped += async(s, e) => {
                if (Clipboard.HasText)
                {
                    bool action = await DisplayAlert("Success", string.Format("Vaata rohkem? {0}", "https://riigipühad.ee/et/jõululaupäev"), "Jah", "Ei");

                    if (action == true)
                    {
                        Device.OpenUri(new Uri("https://xn--riigiphad-v9a.ee/et/jõululaupäev"));
                    }
                }
            };
            _image.GestureRecognizers.Add(tapGestureRecognizer1);

            _label4 = new Label()
            {
                Text              = "Esimene jõulupüha",
                FontAttributes    = FontAttributes.Bold,
                FontSize          = 24,
                TextColor         = Color.Black,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                Padding           = new Thickness(10, 10, 10, 10),
            };
            _label5 = new Label()
            {
                Text           = "25. detsember",
                FontAttributes = FontAttributes.Italic,
                Padding        = new Thickness(10, 10, 10, 10),
            };
            _label6 = new Label()
            {
                Text      = "Pärast Eesti iseseisvuse taastamist on esimene ja teine jõulupüha (25. ja 26. detsember) riigipühad ja puhkepäevad, alates 2005. aastast ka jõululaupäev. Jõulukombestikku mõjutab järjest rohkem rahvusvaheline traditsioon. Rahvusringhääling kannab üle nii jõululaupäeva kui esimese jõulupüha jumalateenistusi. Paljudes asulates püstitatakse juba advendiaja alguses keskväljakule elektrituledega ehitud jõulukuusk, mis jääb enamasti püsti kolmekuningapäevani (langeb kokku Vene Õigeusu Kiriku jõululaupäevaga). Skandinaaviast on üle võetud komme asetada akendele advendiküünlad. Paljudes lastega peredes pannakse jõulude eel õhtuti aknalauale suss, kuhu toob maiustusi päkapikk – jõuluvana abiline, kes kontrollib ja talle ette kannab, kas lapsed on hästi käitunud. Kaubandusettevõtted rõhutavad jõulude eel külluse, heaolu ja kinkide tegemise tähtsust, püüdes suurendada oma läbimüüki; jõuludekoratsioonid ilmuvad kauplustesse sageli juba novembrikuus. Jõuluaja traditsioonilisteks toitudeks on jäänud verivorstid ning seapraad ahjukartuli ja hapukapsastega. Nii nagu naaberriikides, nõnda ka Eestis sagenevad jõulude ja uusaasta aegu meditsiinistatistikas liigsöömisest ja -joomisest tekkinud vaevused.",
                FontSize  = 18,
                TextColor = Color.Black,
                Padding   = new Thickness(10, 10, 10, 10),
            };
            _image1 = new Image()
            {
                Source = ImageSource.FromFile("es.jpg"),
                Margin = new Thickness(15, 20, 15, 5),
            };
            var tapGestureRecognizer = new TapGestureRecognizer();

            tapGestureRecognizer.Tapped += async(s, e) => {
                if (Clipboard.HasText)
                {
                    bool action = await DisplayAlert("Success", string.Format("Vaata rohkem?"), "Jah", "Ei");

                    if (action == true)
                    {
                        Device.OpenUri(new Uri("https://riigipühad.ee/et/esimene+jõulupüha"));
                    }
                }
            };
            _image1.GestureRecognizers.Add(tapGestureRecognizer);
            _label7 = new Label()
            {
                Text              = "Teine jõulupüha",
                FontAttributes    = FontAttributes.Bold,
                FontSize          = 24,
                TextColor         = Color.Black,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                Padding           = new Thickness(10, 10, 10, 10),
            };
            _label8 = new Label()
            {
                Text           = "26. detsember",
                FontAttributes = FontAttributes.Italic,
                Padding        = new Thickness(10, 10, 10, 10),
            };
            _label9 = new Label()
            {
                Text      = "Pärast Eesti iseseisvuse taastamist on esimene ja teine jõulupüha (25. ja 26. detsember) riigipühad ja puhkepäevad, alates 2005. aastast ka jõululaupäev. Jõulukombestikku mõjutab järjest rohkem rahvusvaheline traditsioon.",
                FontSize  = 18,
                TextColor = Color.Black,
                Padding   = new Thickness(10, 10, 10, 10),
            };
            _image2 = new Image()
            {
                Source = ImageSource.FromFile("te.jpg"),
                Margin = new Thickness(15, 20, 15, 5),
            };

            var tapGestureRecognizer2 = new TapGestureRecognizer();

            tapGestureRecognizer2.Tapped += async(s, e) => {
                if (Clipboard.HasText)
                {
                    bool action = await DisplayAlert("Success", string.Format("Vaata rohkem?"), "Jah", "Ei");

                    if (action == true)
                    {
                        Device.OpenUri(new Uri("https://xn--riigiphad-v9a.ee/et/teine+jõulupüha"));
                    }
                }
            };
            _image2.GestureRecognizers.Add(tapGestureRecognizer2);
            StackLayout stackLayout = new StackLayout()
            {
                Children = { _label, _label1, _label2, _label3, _image }
            };

            StackLayout stackLayout1 = new StackLayout()
            {
                Children = { _label4, _label5, _label6, _image1 }
            };

            StackLayout stackLayout2 = new StackLayout()
            {
                Children = { _label7, _label8, _label9, _image2 }
            };
            StackLayout stackLayout3 = new StackLayout()
            {
                Children = { stackLayout, stackLayout1, stackLayout2 }
            };
            ScrollView scrollView = new ScrollView {
                Content = stackLayout3
            };

            Content = scrollView;
        }
Exemplo n.º 39
0
        public StackLayout CreatePostLayout()
        {
            nvm = new ToolbarItem {
                Text = "Cancel",
                Icon = "ic_clear_white_24dp.png"
            };
            nvm.Clicked += (object sender, EventArgs e) => {
                Navigation.PopAsync();
            };
            shout = new ToolbarItem {
                Text = "Shout",
                Icon = "ic_send_white_24dp.png"
            };
            shout.Clicked += async(object sender, EventArgs e) => {
                //post to feed
                if (!string.IsNullOrEmpty(groupid))
                {
                    try{
                        Debug.WriteLine("user {0} saved post to group: {1}", Settings.UserId, groupid);
                        PostItem post = new PostItem {
                            Body = textArea.Text, Title = Settings.Username, GroupID = this.groupid, UserId = Settings.UserId, PostImage = Settings.ProfilePic
                        };
                        await App.DataDB.SavePostItemsTaskAsync(post);

                        PostItem postwID = await App.DataDB.GetSinglePostByPostTextTitleUserIDGroupID(post.Body, post.Title, post.UserId, post.GroupID);

                        Debug.WriteLine("Generated post ID is {0}", postwID.ID);
                        App.ChatClient.Send(postwID);
                    }catch (Exception) {
                        Debug.WriteLine("post error");
                        this.refresher.ExecuteRefreshCommand();
                    }
                }
                else
                {
                    Debug.WriteLine("user {0} saved personal post", Settings.UserId);
                    await App.DataDB.SavePostItemsTaskAsync(new PostItem { Body = textArea.Text, Title = Settings.Username, UserId = Settings.UserId });
                }

                //send message to refresh feed
                //Debug.WriteLine ("SENDING REFRESH MESSAGE");
                //MessagingCenter.Send(this, Values.REFRESH);

                Navigation.PopAsync();
            };
            this.ToolbarItems.Add(shout);
            this.ToolbarItems.Add(nvm);

            textArea = new Editor {
                Text     = this.Title + ". No one will know",
                Keyboard = Keyboard.Create(KeyboardFlags.All),
                //Keyboard = Keyboard.Chat,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                //HeightRequest = scrollView.Height - 10
            };
            textArea.Focused += (sender, e) => {
                if (string.Equals(textArea.Text, this.Title + ". No one will know"))
                {
                    textArea.Text = "";
                }
            };
            textArea.TextChanged += (sender, e) => {
            };

            scrollView = new ScrollView {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Content           = textArea
            };

            return(new StackLayout {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children =
                {
                    scrollView
                }
            });
        }
Exemplo n.º 40
0
        public TrackView()
        {
            layout = new StackLayout()
            {
                Orientation     = StackOrientation.Vertical,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Spacing         = 8,
                Padding         = 16
            };

            var headingLayout = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Children          =
                {
                    new Label {
                        Text = "Xamarin",
                        HorizontalTextAlignment = TextAlignment.End,
                        FontSize  = 30,
                        TextColor = Color.FromHex("#34495E")
                    },
                    new Label {
                        Text = "Insights",
                        HorizontalTextAlignment = TextAlignment.Start,
                        FontSize  = 30,
                        TextColor = Color.FromHex("#3498DB")
                    }
                }
            };

            layout.Children.Add(headingLayout);

            var instructionsLabel = new Label()
            {
                Text = "touch a button",
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.Center
            };

            layout.Children.Add(instructionsLabel);

            var trackButton = new Button()
            {
                Text = "Track",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor   = Color.FromHex("ECECEC")
            };

            trackButton.SetBinding <TrackViewModel>(Button.CommandProperty, vm => vm.TrackCommand);
            layout.Children.Add(trackButton);

            var identifyButton = new Button()
            {
                Text = "Identify",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor   = Color.FromHex("DADFE1")
            };

            identifyButton.SetBinding <TrackViewModel>(Button.CommandProperty, vm => vm.IdentifyCommand);
            layout.Children.Add(identifyButton);

            var warningButton = new Button()
            {
                Text = "Warning",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor   = Color.FromHex("F4D03F")
            };

            warningButton.SetBinding <TrackViewModel>(Button.CommandProperty, vm => vm.WarnCommand);
            layout.Children.Add(warningButton);

            var errorButton = new Button()
            {
                Text = "Error",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor   = Color.FromHex("EF4836")
            };

            errorButton.SetBinding <TrackViewModel>(Button.CommandProperty, vm => vm.ErrorCommand);
            layout.Children.Add(errorButton);

            var crashButton = new Button()
            {
                Text = "Crash",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor   = Color.FromHex("CF000F")
            };

            crashButton.SetBinding <TrackViewModel>(Button.CommandProperty, vm => vm.CrashCommand);
            layout.Children.Add(crashButton);

            Padding = new Thickness(0, Device.RuntimePlatform == Device.iOS ? 20 : 0, 0, 0);

            foreach (var view in layout.Children)
            {
                // Hide all the children
                view.Scale = 0;
            }

            Content = new ScrollView()
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Content         = layout
            };

            // Receive and display a message in an alert
            MessagingCenter.Subscribe <TrackViewModel, string>(this, "Alert", (vm, message) => DisplayAlert("Alert", message, "OK"));
        }
Exemplo n.º 41
0
        public StoryPage()
        {
            // Page pref
            Thickness thickness = new Thickness(20, 10, 20, 20);

            if (Device.RuntimePlatform == Device.iOS)
            {
                thickness.Top += 20; // Add padding to page on iOS
            }
            this.Padding = thickness;
            //BackgroundColor = Color.DarkMagenta;

            // Create the scrollview for the long text area
            ScrollView longTextScrollView = new ScrollView();
            Label      longText           = new Label();

            longText.FontSize = 30;
            //longText.Text = "Lorem ipsum dolor sit amet, sed suscipit mauris lorem non quis id, orci volutpat porta amet est urna integer, feugiat semper at lorem aliquam ut quis, suscipit pellentesque odio felis ac malesuada sem. Magna magna enim aenean maecenas ut ultricies, odio tincidunt sed dolor turpis in, velit id ad non nec lorem, et pede aliquam amet euismod nunc, adipiscing erat phasellus leo erat urna sit. Sed nam interdum neque lorem ac vestibulum, quis cum elit fusce leo magna, nunc lectus ipsum euismod arcu sed quia, etiam maecenas esse eros convallis lectus nunc, erat non placerat integer a wisi. Massa blandit sit diam nec neque sagittis, aliquam sollicitudin velit eget ornare pellentesque, ut dui convallis eros ultrices eget, nec nulla lobortis lacus lacinia justo lacus, sed duis volutpat pharetra quis quisque.\t\nLorem ipsum dolor sit amet, urna neque voluptatem placerat in diam, ultrices vivamus commodo debitis purus consequat sed, dolor justo orci nec pretium sapien semper. Qui diam dignissim pede tristique dignissim, sodales dolor duis et rhoncus eros vivamus, taciti duis tincidunt amet velit mauris diam, orci vehicula semper lacus tortor vulputate. Sed ullamcorper in amet sem maecenas, dignissim et lectus hac blandit ut porttitor, ad risus donec massa vel vivamus quam, nulla et hac dui vestibulum lorem, eleifend velit ut elit faucibus suscipit. Egestas mauris aliquam vel facilisi augue, mollis leo vestibulum volutpat amet per, accumsan placerat et sed voluptatem ultricies pellentesque.";
            longText.Text = "The muffled noises you heard came gushing out once you opened the door, bringing with it the all too familiar bright sights and strong smells a traveller can meat only in a tavern. An old drinking song rules the hearts of the drinkers and you almost don't notice the woman to your right, calling for you. Her voice does not ring any bells, then again, the fuss at the inn might dim anything less loud than itself.";
            longTextScrollView.Content   = longText;
            longTextScrollView.Scrolled += (object sender, ScrolledEventArgs e) => {
                System.Diagnostics.Debug.WriteLine("Scrolled!");
            };
            //longTextScrollView.BackgroundColor = Color.DarkGoldenrod;

            // Create the subtext
            Frame subtextFrame = new Frame();
            Label subtext      = new Label();

            subtext.Text           = "You're mission is get more information about the hijackings of late.";
            subtext.FontAttributes = FontAttributes.Italic;
            subtext.FontSize       = 20;
            subtextFrame.Content   = subtext;
            //subtextFrame.BackgroundColor = Color.LightSlateGray;
            subtextFrame.OutlineColor = Color.Transparent;
            subtext.TextColor         = Color.LightGray;
            subtextFrame.HasShadow    = false;

            // Siri read
            var speak = new Button
            {
                Text              = "Read with Siri!",
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };

            speak.Clicked += async(sender, e) => {
                if (longTextScrollView.ScrollY.CompareTo(0) != 0)
                {
                    await longTextScrollView.ScrollToAsync(0, 0, true);
                }
                DependencyService.Get <ITextToSpeech>().Speak(longText.Text);
                await Task.Delay(8000);

                //await longTextScrollView.ScrollToAsync(0,longTextScrollView.Height, true);
                await AutoScrol(longTextScrollView, 7);

                await Task.Delay(1400);

                DependencyService.Get <ITextToSpeech>().Speak(subtext.Text);
            };

            // Content
            Content = new StackLayout
            {
                Spacing  = 20,
                Children =
                {
                    longTextScrollView,
                    speak,
                    subtextFrame,
                    new StackLayout {
                        Children =
                        {
                            new Button {
                                Text            = "Action1 ----",
                                BackgroundColor = Color.LightGray
                            },
                            new Button {
                                Text            = "Action2 ----",
                                BackgroundColor = Color.LightGray
                            },
                            new Button {
                                Text            = "Action3 ----",
                                BackgroundColor = Color.LightGray
                            }
                        }
                    }
                }
            };
        }
Exemplo n.º 42
0
        protected override void Init()
        {
            var actionGrid = new Grid()
            {
                Padding         = new Thickness(10),
                BackgroundColor = Color.Aquamarine
            };

            actionGrid.AddChild(new Button()
            {
                Text    = "Index desc",
                Command = new Command(() => IndexDesc())
            }, 0, 0);
            actionGrid.AddChild(new Button()
            {
                Text    = "All indexes equal 0",
                Command = new Command(() => listViews.ForEach(c => c.TabIndex = 0))
            }, 1, 0);
            actionGrid.AddChild(new Button()
            {
                Text    = "Negative indexes",
                Command = new Command(() => IndexNegative())
            }, 2, 0);
            actionGrid.AddChild(new Button()
            {
                Text    = "TabStops = True",
                Command = new Command(() => listViews.ForEach(c => c.IsTabStop = true))
            }, 0, 1);
            actionGrid.AddChild(new Button()
            {
                Text    = "TabStops = False",
                Command = new Command(() => listViews.ForEach(c => c.IsTabStop = false))
            }, 1, 1);
            actionGrid.AddChild(new Button()
            {
                Text    = "TabStops every second",
                Command = new Command(() =>
                {
                    for (int i = 0; i < listViews.Count; i++)
                    {
                        listViews[i].IsTabStop = i % 2 == 0;
                    }
                })
            }, 2, 1);

            var pickerStopped = new Picker
            {
                Title     = $"[+] Picker - Tab stop enable",
                IsTabStop = true
            };
            var pickerNotStopped = new Picker
            {
                Title     = "[-] Picker - Tab stop disable",
                IsTabStop = false
            };

            for (var i = 1; i < 3; i++)
            {
                pickerNotStopped.Items.Add("Sample Option " + i);
                pickerStopped.Items.Add("Sample Option " + i);
            }

            var stack = new StackLayout
            {
                Children =
                {
                    actionGrid,
                    pickerStopped,
                    pickerNotStopped,
                    new Button
                    {
                        Text      = $"TabIndex 90",
                        IsTabStop = true,
                        TabIndex  = 90
                    },
                    new Button
                    {
                        Text      = $"TabIndex 100",
                        IsTabStop = true,
                        TabIndex  = 100
                    },
                    new Button
                    {
                        Text      = $"TabIndex 100",
                        IsTabStop = true,
                        TabIndex  = 100
                    },
                    new Button
                    {
                        Text      = $"TabIndex 90",
                        IsTabStop = true,
                        TabIndex  = 90
                    },
                    new Button
                    {
                        Text      = $"[+] Button - TabStop enable",
                        IsTabStop = true
                    },
                    new Button
                    {
                        Text      = "Button - Non stop",
                        IsTabStop = false
                    },
                    new CheckBox
                    {
                        IsTabStop = true
                    },
                    new CheckBox
                    {
                        IsTabStop = false
                    },
                    new DatePicker
                    {
                        IsTabStop = true
                    },
                    new DatePicker
                    {
                        IsTabStop = false
                    },
                    new Editor
                    {
                        Text      = $"[+] Editor - Tab stop enable",
                        IsTabStop = true
                    },
                    new Editor
                    {
                        Text      = "Editor - Non stop",
                        IsTabStop = false
                    },
                    new Entry
                    {
                        Text      = $"[+] Entry - Tab stop enable",
                        IsTabStop = true
                    },
                    new Entry
                    {
                        Text      = "Entry - Non stop",
                        IsTabStop = false
                    },
                    new ProgressBar
                    {
                        IsTabStop     = true,
                        HeightRequest = 40,
                        Progress      = 80
                    },
                    new ProgressBar
                    {
                        IsTabStop     = false,
                        HeightRequest = 40,
                        Progress      = 40
                    },
                    new SearchBar
                    {
                        Text      = $"[+] SearchBar - TabStop enable",
                        IsTabStop = true
                    },
                    new SearchBar
                    {
                        Text      = "SearchBar - TabStop disable",
                        IsTabStop = false
                    },
                    new Slider
                    {
                        IsTabStop = true
                    },
                    new Slider
                    {
                        IsTabStop = false
                    },
                    new Stepper
                    {
                        IsTabStop = true
                    },
                    new Stepper
                    {
                        IsTabStop = false
                    },
                    new Switch
                    {
                        IsTabStop = true
                    },
                    new Switch
                    {
                        IsTabStop = false
                    },
                    new TimePicker
                    {
                        IsTabStop = true
                    },
                    new TimePicker
                    {
                        IsTabStop = false
                    },
                }
            };

            listViews = stack.Children;

            foreach (var item in listViews)
            {
                item.Focused += (_, e) =>
                {
                    BackgroundColor       = e.VisualElement.IsTabStop ? Color.Transparent : Color.OrangeRed;
                    Title                 = $"{e.VisualElement.TabIndex} - " + (e.VisualElement.IsTabStop ? "[+]" : "WRONG");
                    e.VisualElement.Scale = 0.7;
                };
                item.Unfocused += (_, e) =>
                {
                    BackgroundColor       = Color.Transparent;
                    Title                 = string.Empty;
                    e.VisualElement.Scale = 1;
                };
            }

            IndexDesc();

            Content = new ScrollView()
            {
                Content = stack
            };
        }
        public AddPhotoPage()
        {
            Disappearing                 += HandleAddPhotoPageDisappearing;
            ViewModel.NoCameraFound      += HandleNoCameraFound;
            ViewModel.SavePhotoCompleted += HandleSavePhotoCompleted;
            ViewModel.SavePhotoFailed    += HandleSavePhotoFailed;

            var photoTitleEntry = new Entry
            {
                ClearButtonVisibility = ClearButtonVisibility.WhileEditing,
                Placeholder           = "Title",
                BackgroundColor       = Color.White,
                TextColor             = ColorConstants.TextColor,
                HorizontalOptions     = LayoutOptions.FillAndExpand,
            };

            photoTitleEntry.SetBinding(Entry.TextProperty, nameof(AddPhotoViewModel.PhotoTitle));

            var takePhotoButton = new AddPhotoPageButton("Take Photo");

            takePhotoButton.Clicked += HandleTakePhotoButtonClicked;
            takePhotoButton.SetBinding(IsEnabledProperty, new Binding(nameof(AddPhotoViewModel.IsPhotoSaving), BindingMode.Default, new InverseBooleanConverter(), ViewModel.IsPhotoSaving));

            var photoImage = new CachedImage();

            photoImage.SetBinding(CachedImage.SourceProperty, nameof(AddPhotoViewModel.PhotoImageSource));

            var activityIndicator = new ActivityIndicator();

            activityIndicator.SetBinding(IsVisibleProperty, nameof(AddPhotoViewModel.IsPhotoSaving));
            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, nameof(AddPhotoViewModel.IsPhotoSaving));

            this.SetBinding(TitleProperty, nameof(AddPhotoViewModel.PhotoTitle));

            Title   = PageTitles.AddPhotoPage;
            Padding = new Thickness(20);

            var stackLayout = new StackLayout
            {
                Spacing = 20,

                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.FillAndExpand,

                Children =
                {
                    photoImage,
                    photoTitleEntry,
                    takePhotoButton,
                }
            };

            if (Device.RuntimePlatform is Device.iOS)
            {
                //Add title to UIModalPresentationStyle.FormSheet on iOS
                var titleLabel = new Label
                {
                    FontAttributes = FontAttributes.Bold,
                    FontSize       = 24,
                    Margin         = new Thickness(0, 24, 5, 0)
                };
                titleLabel.SetBinding(Label.TextProperty, nameof(AddPhotoViewModel.PhotoTitle));
                titleLabel.Text = PageTitles.AddPhotoPage;

                var savePhotoButton = new AddPhotoPageButton("Save");
                savePhotoButton.SetBinding(Button.CommandProperty, nameof(AddPhotoViewModel.SavePhotoCommand));

                stackLayout.Children.Insert(0, titleLabel);
                stackLayout.Children.Add(savePhotoButton);
            }
            else
            {
                //Cancel Button only needed for Android becuase iOS can swipe down to return to previous page
                var cancelToolbarItem = new ToolbarItem
                {
                    Text         = "Cancel",
                    Priority     = 1,
                    AutomationId = AutomationIdConstants.CancelButton
                };
                cancelToolbarItem.Command = new AsyncCommand(ExecuteCancelButtonCommand);

                //Save Button can be added to the Navigation Bar
                var saveToobarItem = new ToolbarItem
                {
                    Text         = "Save",
                    Priority     = 0,
                    AutomationId = AutomationIdConstants.AddPhotoPage_SaveButton,
                };
                saveToobarItem.SetBinding(MenuItem.CommandProperty, nameof(AddPhotoViewModel.SavePhotoCommand));

                ToolbarItems.Add(saveToobarItem);
                ToolbarItems.Add(cancelToolbarItem);
            }

            stackLayout.Children.Add(activityIndicator);

            Content = new ScrollView {
                Content = stackLayout
            };
        }
Exemplo n.º 44
0
        public static void LoadProfile(this ContentPage page)
        {
            Profile.Stop();
            foreach (var datum in Profile.Data)
            {
                Data.Add(new ProfileDatum()
                {
                    Name  = datum.Name,
                    Id    = datum.Id,
                    Depth = datum.Depth,
                    Ticks = datum.Ticks < 0 ? 0L : (long)datum.Ticks
                });
            }
            var i          = 0;
            var profiledMs = GatherTicks(ref i) / MS;

            var scrollView = new ScrollView();
            var label      = new Label();

            var controls = new Grid();
            var buttonA  = new Button()
            {
                Text = "0s", HeightRequest = 62
            };

            controls.Children.AddHorizontal(new[] { buttonA });

            var grid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                },
                ColumnDefinitions = new ColumnDefinitionCollection {
                    new ColumnDefinition {
                        Width = GridLength.Star
                    },
                }
            };

            page.Content = grid;
            grid.Children.Add(scrollView, 0, 0);
            grid.Children.Add(controls, 0, 1);

            scrollView.Content = label;

            var showZeros = false;

            Action update = delegate()
            {
                var sb = new StringBuilder();
                sb.AppendLine($"Profiled: {profiledMs}ms");
                AppendProfile(sb, profiledMs, showZeros);
                label.Text = sb.ToString();
            };

            buttonA.Clicked += delegate
            { showZeros = !showZeros; update(); };

            update();
        }
Exemplo n.º 45
0
        public void Initialize()
        {
            NUIApplication.GetDefaultWindow().KeyEvent += OnKeyEvent;

            Size2D stageSize = NUIApplication.GetDefaultWindow().WindowSize;

            // Background
            mRootActor = CreateBackground("LauncherBackground");

            // Add logo
            ImageView logo = new ImageView(LOGO_PATH);

            logo.Name = "LOGO_IMAGE";
            logo.PositionUsesPivotPoint = true;
            logo.PivotPoint             = PivotPoint.TopCenter;
            logo.ParentOrigin           = new Position(0.5f, 0.1f, 0.5f);
            logo.WidthResizePolicy      = ResizePolicyType.UseNaturalSize;
            logo.HeightResizePolicy     = ResizePolicyType.UseNaturalSize;
            float logoScale = (float)(NUIApplication.GetDefaultWindow().Size.Height) / 1080.0f;

            logo.Scale = new Vector3(logoScale, logoScale, 0);

            //// The logo should appear on top of everything.
            mRootActor.Add(logo);

            // Show version in a popup when log is tapped
            //mLogoTapDetector = new TapGestureDetector();
            //mLogoTapDetector.Attach(logo);
            //mLogoTapDetector.Detected += OnLogoTapped;

            // Scrollview occupying the majority of the screen
            mScrollView = new ScrollView();
            mScrollView.PositionUsesPivotPoint = true;
            mScrollView.PivotPoint             = PivotPoint.BottomCenter;
            mScrollView.ParentOrigin           = new Vector3(0.5f, 1.0f - 0.05f, 0.5f);
            mScrollView.WidthResizePolicy      = ResizePolicyType.FillToParent;
            mScrollView.HeightResizePolicy     = ResizePolicyType.SizeRelativeToParent;
            mScrollView.SetSizeModeFactor(new Vector3(0.0f, 0.6f, 0.0f));

            ushort buttonsPageMargin = (ushort)((1.0f - TABLE_RELATIVE_SIZE.X) * 0.5f * stageSize.Width);

            mScrollView.SetPadding(new PaddingType(buttonsPageMargin, buttonsPageMargin, 0, 0));

            mScrollView.ScrollCompleted += OnScrollComplete;
            mScrollView.ScrollStarted   += OnScrollStart;

            mPageWidth = stageSize.Width * TABLE_RELATIVE_SIZE.X * 0.5f;

            // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show
            View bubbleContainer = new View();

            bubbleContainer.WidthResizePolicy      = bubbleContainer.HeightResizePolicy = ResizePolicyType.FillToParent;
            bubbleContainer.PositionUsesPivotPoint = true;
            bubbleContainer.PivotPoint             = PivotPoint.Center;
            bubbleContainer.ParentOrigin           = ParentOrigin.Center;
            SetupBackground(bubbleContainer);

            mRootActor.Add(bubbleContainer);
            mRootActor.Add(mScrollView);

            // Add scroll view effect and setup constraints on pages
            ApplyScrollViewEffect();

            // Add pages and tiles
            Populate();

            if (mCurPage != mScrollView.GetCurrentPage())
            {
                mScrollView.ScrollTo(mCurPage, 0.0f);
            }

            // Remove constraints for inner cube effect
            ApplyCubeEffectToPages();

            // Set initial orientation
            uint degrees = 0;

            Rotate(degrees);

            // Background animation
            mAnimationTimer       = new Timer(BACKGROUND_ANIMATION_DURATION);
            mAnimationTimer.Tick += PauseBackgroundAnimation;
            mAnimationTimer.Start();
            mBackgroundAnimsPlaying = true;
        }
Exemplo n.º 46
0
        public ContentPageExample()
        {
            // Page 28
            StackLayout stackLayout = new StackLayout
            {
                Children =
                {
                    labelLarge,
                    labelSmall,
                    button,
                    entry,
                    entry2,
                    boxView,
                    image,
                    image2
                },
                HeightRequest = 1500,
                // Page 47
                // Spacing = 0, // padding between children.
                // VerticalOptions = LayoutOptions.FillAndExpand
            };
            // Replaced by code in Page 40
            // Content = stackLayout;

            // Page 39
            ScrollView scrollView = new ScrollView
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                // Page 40: Scrolls by default vertically. To scroll
                //          horizontally, use the line below.
                // Orientation = ScrollOrientation.Horizontal,
                Content = stackLayout
            };

            // Page 40
            Content = scrollView;

            // Page 29
            BackgroundColor = Color.Black;

            // Page 40
            Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);

            #region Tap Gestures

            // Page 38
            // There is an alternative by using new Command().
            var tapGestureRecognizer = new TapGestureRecognizer();
            tapGestureRecognizer.Tapped += (s, e) =>
            {
                if (image.Opacity >= .1)
                {
                    image.Opacity -= .1;
                }
                else
                {
                    image.Opacity = 0;
                }
            };
            image.GestureRecognizers.Add(tapGestureRecognizer);

            var tapGestureRecognizer2 = new TapGestureRecognizer();
            tapGestureRecognizer2.Tapped += async(sender, e) =>
            {
                image2.Opacity = .5;
                await Task.Delay(200);

                image2.Opacity = 1;
            };
            image2.GestureRecognizers.Add(tapGestureRecognizer2);

            #endregion

            // Page 32
            button.Clicked += OnButtonClicked;
        }
Exemplo n.º 47
0
        public RoundResults()
        {
            scoreMap.Add("John", 3);
            scoreMap.Add("Mark", 0);
            scoreMap.Add("Jimmy", 2);
            scoreMap.Add("Tony", 6);
            NavigationPage.SetHasBackButton(this, false);
            NavigationPage.SetHasNavigationBar(this, false);
            yourPoints = 2;
            countDown  = 15;
            StackLayout mainStack = new StackLayout();
            StackLayout textStack = new StackLayout
            {
                Padding = new Thickness(5),
                Spacing = 10
            };

            Label title = new Label
            {
                Text              = "Score Board",
                TextColor         = Color.Black,
                HorizontalOptions = LayoutOptions.Center
            };

            mainStack.Children.Add(title);

            Label p9_01 = new Label
            {
                Text = "In this round, you got :" + Environment.NewLine + Environment.NewLine + yourPoints + " Points",
                HorizontalOptions = LayoutOptions.Center,
                FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Label))
            };

            mainStack.Children.Add(p9_01);


            // Display Score
            foreach (var item in scoreMap)
            {
                player           = item.Key;
                playerPointCount = item.Value;
                Frame scoreFrame = new Frame
                {
                    OutlineColor      = Color.Black,
                    BackgroundColor   = Color.Yellow,
                    HorizontalOptions = LayoutOptions.Center,
                    VerticalOptions   = LayoutOptions.Center,
                    Content           = new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal,
                        Spacing     = 15,
                        Children    =
                        {
                            new Label
                            {
                                Text              = player,
                                FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                                FontAttributes    = FontAttributes.Bold,
                                VerticalOptions   = LayoutOptions.Center,
                                HorizontalOptions = LayoutOptions.StartAndExpand
                            },
                            new Label
                            {
                                Text              = playerPointCount.ToString(),
                                FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                                FontAttributes    = FontAttributes.Bold,
                                TextColor         = Color.Red,
                                VerticalOptions   = LayoutOptions.Center,
                                HorizontalOptions = LayoutOptions.StartAndExpand
                            }
                        }
                    }
                };
                textStack.Children.Add(scoreFrame);
            }
            ;


            Label clockLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Next round will start in " + countDown + " seconds"
            };

            textStack.Children.Add(clockLabel);

            // Start the timer going.
            Device.StartTimer(TimeSpan.FromSeconds(1), () =>
            {
                countDown       = countDown - 1;
                clockLabel.Text = "Next round will start in " + countDown + " seconds";
                if (countDown == 0)
                {
                    Button goButton = new Button
                    {
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        BorderColor       = Color.Blue,
                        BorderWidth       = 1,
                        Text = "Go"
                    };
                    goButton.Clicked += async(sender, args) =>
                    {
                        await Navigation.PushAsync(new FinalResults());
                    };
                    textStack.Children.Add(goButton);
                    return(false);
                }
                return(true);
            });



            ScrollView scrollView = new ScrollView
            {
                Content         = textStack,
                VerticalOptions = LayoutOptions.FillAndExpand,
                //Padding = new Thickness(5, 0),
            };

            mainStack.Children.Add(scrollView);


            Content = mainStack;
        }
Exemplo n.º 48
0
        public SifreDegistir()
        {
            {
                var stack = new StackLayout()
                {
                    BackgroundColor = Color.FromHex("#f6f6f6")
                };
                var stack2 = new StackLayout()
                {
                    BackgroundColor = Color.FromHex("#f6f6f6"), Margin = new Thickness(0, 40, 0, 0)
                };
                var grida = new Grid()
                {
                    BackgroundColor = Color.FromHex("#f6f6f6"), VerticalOptions = LayoutOptions.EndAndExpand
                };
                grida.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
                grida.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
                grida.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(60, GridUnitType.Absolute)
                });

                stack.Children.Add(stack2);
                var sifre1 = new CEntry
                {
                    BackgroundColor = Color.FromHex("#eee"),
                    IsPassword      = true,
                    Margin          = new Thickness(15, 0, 15, 0)
                };
                var sifre2 = new CEntry
                {
                    BackgroundColor = Color.FromHex("#eee"),
                    IsPassword      = true,
                    Margin          = new Thickness(15, 0, 15, 0)
                };
                var sifre3 = new CEntry
                {
                    BackgroundColor = Color.FromHex("#eee"),
                    IsPassword      = true,
                    Margin          = new Thickness(15, 0, 15, 0)
                };

                stack2.Children.Add(new Label
                {
                    Text = AppResource.sifredegistirlabel1,

                    Margin = new Thickness(20, 20, 0, 0)
                });
                stack2.Children.Add(sifre1);
                stack2.Children.Add(new Label
                {
                    Text = AppResource.sifredegistirlabel2,

                    Margin = new Thickness(20, 20, 0, 0)
                });
                stack2.Children.Add(sifre2);
                stack2.Children.Add(new Label
                {
                    Text = AppResource.sifredegistirlabel3,

                    Margin = new Thickness(20, 20, 0, 0)
                });
                stack2.Children.Add(sifre3);



                var butonumuz = new Image()
                {
                    Source = "degistir111.png",
                    Margin = new Thickness(0, 0, 15, 0),
                };
                var iptal = new Button()
                {
                    Text            = AppResource.iptalbuton,
                    BackgroundColor = Color.Transparent,
                    TextColor       = Color.Black
                };

                iptal.Clicked += OnButtonClicked4;

                var tapGestureRecognizer = new TapGestureRecognizer();
                tapGestureRecognizer.Tapped += async(s, e) => {
                    if (sifre1.Text == GirisSayfasi.manager.login.Password && sifre2.Text == sifre3.Text && sifre1.Text != sifre2.Text)
                    {
                        GirisSayfasi.manager.login.Password = sifre2.Text;
                        await GirisSayfasi.manager.UpdateLogin(GirisSayfasi.manager.login);
                    }
                    else
                    {
                        await DisplayAlert("Dikkat", "Yanlış Şifre Girdiniz", "Tamam");
                    }
                };
                butonumuz.GestureRecognizers.Add(tapGestureRecognizer);


                grida.Children.Add(butonumuz, 1, 0);
                grida.Children.Add(iptal, 0, 0);

                var a = new ScrollView {
                    Content = stack, Padding = new Thickness(0, 0, 0, 20)
                };
                var b = new StackLayout()
                {
                    BackgroundColor = Color.FromHex("#f6f6f6")
                };
                b.Children.Add(a);
                b.Children.Add(grida);

                Content = b;
            }
        }
Exemplo n.º 49
0
        public PlatformSpecificsPageCS()
        {
            var blurButton = new Button {
                Text = "Blur Effect (iOS only)"
            };

            blurButton.Clicked += async(sender, e) => await Navigation.PushAsync(new iOSBlurEffectPageCS());

            var translucentButton = new Button {
                Text = "Translucent Navigation Bar (iOS only) "
            };

            translucentButton.Clicked += async(sender, e) => await DisplayAlert("Alert", "Edit App.xaml.cs to view this platform specific.", "OK");

            var entryButton = new Button {
                Text = "Entry Font Size Adjusts to Text Width (iOS only)"
            };

            entryButton.Clicked += async(sender, e) => await Navigation.PushAsync(new iOSEntryPageCS());

            var hideStatusBarButton = new Button {
                Text = "Hide Status Bar (iOS only) "
            };

            hideStatusBarButton.Clicked += async(sender, e) => await Navigation.PushAsync(new iOSStatusBarPageCS());

            var pickerUpdateModeButton = new Button {
                Text = "Picker UpdateMode (iOS only)"
            };

            pickerUpdateModeButton.Clicked += async(sender, e) => await Navigation.PushAsync(new iOSPickerPageCS());

            var scrollViewButton = new Button {
                Text = "ScrollView DelayContentTouches (iOS only)"
            };

            scrollViewButton.Clicked += async(sender, e) => await DisplayAlert("Alert", "Edit App.xaml.cs to view this platform specific.", "OK");

            var statusBarTextColorModeButton = new Button {
                Text = "Navigation Page Status Bar Text Color Mode (iOS only)"
            };

            statusBarTextColorModeButton.Clicked += async(sender, e) => await DisplayAlert("Alert", "Edit App.xaml.cs to view this platform specific.", "OK");

            var inputModeButton = new Button {
                Text = "Soft Input Mode Adjust (Android only)"
            };

            inputModeButton.Clicked += async(sender, e) => await Navigation.PushAsync(new AndroidSoftInputModeAdjustPageCS());

            var lifecycleEventsButton = new Button {
                Text = "Pause and Resume Lifecycle Events (Android only)"
            };

            lifecycleEventsButton.Clicked += async(sender, e) => await Navigation.PushAsync(new AndroidLifecycleEventsPageCS());

            var tabbedPageSwipeButton = new Button {
                Text = "Tabbed Page Swipe (Android only)"
            };

            tabbedPageSwipeButton.Clicked += async(sender, e) => await DisplayAlert("Alert", "Edit App.xaml.cs to view this platform specific.", "OK");

            var listViewFastScrollButton = new Button {
                Text = "ListView FastScroll (Android only)"
            };

            listViewFastScrollButton.Clicked += async(sender, e) => await Navigation.PushAsync(new AndroidListViewFastScrollPageCS());

            var tabbedPageButton = new Button {
                Text = "Tabbed Page Toolbar Location Adjust (Windows only)"
            };

            tabbedPageButton.Clicked += async(sender, e) => await DisplayAlert("Alert", "Edit App.xaml.cs to view this platform specific.", "OK");

            var navigationPageButton = new Button {
                Text = "Navigation Page Toolbar Location Adjust (Windows only)"
            };

            navigationPageButton.Clicked += async(sender, e) => await DisplayAlert("Alert", "Edit App.xaml.cs to view this platform specific.", "OK");

            var masterDetailPageButton = new Button {
                Text = "Master Detail Page Toolbar Location Adjust (Windows only)"
            };

            masterDetailPageButton.Clicked += async(sender, e) => await DisplayAlert("Alert", "Edit App.xaml.cs to view this platform specific.", "OK");

            Title   = "Platform Specifics Demo";
            Content = new ScrollView
            {
                Content = new StackLayout
                {
                    Margin   = new Thickness(20),
                    Children = { blurButton, translucentButton, entryButton, hideStatusBarButton, pickerUpdateModeButton, scrollViewButton, statusBarTextColorModeButton, inputModeButton, lifecycleEventsButton, listViewFastScrollButton, tabbedPageButton, navigationPageButton, masterDetailPageButton }
                }
            };
        }
        void SetContent(FlowDirection direction)
        {
            var hOptions = LayoutOptions.Start;

            var imageCell = new DataTemplate(typeof(ImageCell));

            imageCell.SetBinding(ImageCell.ImageSourceProperty, ".");
            imageCell.SetBinding(ImageCell.TextProperty, ".");

            var textCell = new DataTemplate(typeof(TextCell));

            textCell.SetBinding(TextCell.DetailProperty, ".");

            var entryCell = new DataTemplate(typeof(EntryCell));

            entryCell.SetBinding(EntryCell.TextProperty, ".");

            var switchCell = new DataTemplate(typeof(SwitchCell));

            switchCell.SetBinding(SwitchCell.OnProperty, ".");
            switchCell.SetValue(SwitchCell.TextProperty, "Switch Cell!");

            var vc = new ViewCell
            {
                View = new StackLayout
                {
                    Children = { new Label {
                                     HorizontalOptions = hOptions, Text = "View Cell! I have context actions."
                                 } }
                }
            };

            var a1 = new MenuItem {
                Text = "First"
            };

            vc.ContextActions.Add(a1);
            var a2 = new MenuItem {
                Text = "Second"
            };

            vc.ContextActions.Add(a2);

            var viewCell = new DataTemplate(() => vc);

            var relayout = new Switch
            {
                IsToggled         = true,
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Center
            };

            var flipButton = new Button
            {
                Text = direction == FlowDirection.RightToLeft ? "Switch to Left To Right" : "Switch to Right To Left",
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions   = LayoutOptions.Center
            };

            flipButton.Clicked += (s, e) =>
            {
                FlowDirection newDirection;
                if (direction == FlowDirection.LeftToRight || direction == FlowDirection.MatchParent)
                {
                    newDirection = FlowDirection.RightToLeft;
                }
                else
                {
                    newDirection = FlowDirection.LeftToRight;
                }

                if (relayout.IsToggled)
                {
                    ParentPage.FlowDirection = newDirection;

                    direction = newDirection;

                    flipButton.Text = direction == FlowDirection.RightToLeft ? "Switch to Left To Right" : "Switch to Right To Left";

                    return;
                }

                if (ParentPage == this)
                {
                    FlowDirectionGalleryLandingPage.PushContentPage(newDirection);
                    return;
                }
                string parentType = ParentPage.GetType().ToString();
                switch (parentType)
                {
                case "Xamarin.Forms.Controls.FlowDirectionGalleryMDP":
                    FlowDirectionGalleryLandingPage.PushMasterDetailPage(newDirection);
                    break;

                case "Xamarin.Forms.Controls.FlowDirectionGalleryCarP":
                    FlowDirectionGalleryLandingPage.PushCarouselPage(newDirection);
                    break;

                case "Xamarin.Forms.Controls.FlowDirectionGalleryNP":
                    FlowDirectionGalleryLandingPage.PushNavigationPage(newDirection);
                    break;

                case "Xamarin.Forms.Controls.FlowDirectionGalleryTP":
                    FlowDirectionGalleryLandingPage.PushTabbedPage(newDirection);
                    break;
                }
            };

            var horStack = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    = { flipButton, new Label {
                                    Text = "Relayout", HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center
                                },             relayout }
            };

            var grid = new Grid
            {
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                },
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(100, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(100, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(100, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(100, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(100, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(100, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(100, GridUnitType.Absolute)
                    },
                }
            };

            int col = 0;
            int row = 0;

            var ai = AddView <ActivityIndicator>(grid, ref col, ref row);

            ai.IsRunning = true;

            var box = AddView <BoxView>(grid, ref col, ref row);

            box.WidthRequest    = box.HeightRequest = 20;
            box.BackgroundColor = Color.Purple;

            var btn = AddView <Button>(grid, ref col, ref row);

            btn.Text = "Some text";

            var date = AddView <DatePicker>(grid, ref col, ref row, 2);

            var edit = AddView <Editor>(grid, ref col, ref row);

            edit.WidthRequest  = 100;
            edit.HeightRequest = 100;
            edit.Text          = "Some longer text for wrapping";

            var entry = AddView <Entry>(grid, ref col, ref row);

            entry.WidthRequest = 100;
            entry.Text         = "Some text";

            var image = AddView <Image>(grid, ref col, ref row);

            image.Source = "oasis.jpg";

            var lbl1 = AddView <Label>(grid, ref col, ref row);

            lbl1.WidthRequest            = 100;
            lbl1.HorizontalTextAlignment = TextAlignment.Start;
            lbl1.Text = "Start text";

            var lblLong = AddView <Label>(grid, ref col, ref row);

            lblLong.WidthRequest            = 100;
            lblLong.HorizontalTextAlignment = TextAlignment.Start;
            lblLong.Text = "Start text that should wrap and wrap and wrap";

            var lbl2 = AddView <Label>(grid, ref col, ref row);

            lbl2.WidthRequest            = 100;
            lbl2.HorizontalTextAlignment = TextAlignment.End;
            lbl2.Text = "End text";

            var lbl3 = AddView <Label>(grid, ref col, ref row);

            lbl3.WidthRequest            = 100;
            lbl3.HorizontalTextAlignment = TextAlignment.Center;
            lbl3.Text = "Center text";

            //var ogv = AddView<OpenGLView>(grid, ref col, ref row, hOptions, vOptions, margin);

            var pkr = AddView <Picker>(grid, ref col, ref row);

            pkr.ItemsSource = Enumerable.Range(0, 10).ToList();

            var sld = AddView <Slider>(grid, ref col, ref row);

            sld.WidthRequest = 100;
            sld.Maximum      = 10;
            Device.StartTimer(TimeSpan.FromSeconds(1), () =>
            {
                sld.Value += 1;
                if (sld.Value == 10d)
                {
                    sld.Value = 0;
                }
                return(true);
            });

            var stp = AddView <Stepper>(grid, ref col, ref row);

            var swt = AddView <Switch>(grid, ref col, ref row);

            var time = AddView <TimePicker>(grid, ref col, ref row, 2);

            var prog = AddView <ProgressBar>(grid, ref col, ref row, 2);

            prog.WidthRequest    = 200;
            prog.BackgroundColor = Color.DarkGray;
            Device.StartTimer(TimeSpan.FromSeconds(1), () =>
            {
                prog.Progress += .1;
                if (prog.Progress == 1d)
                {
                    prog.Progress = 0;
                }
                return(true);
            });

            var srch = AddView <SearchBar>(grid, ref col, ref row, 2);

            srch.WidthRequest = 200;
            srch.Text         = "Some text";

            TableView tbl = new TableView
            {
                Intent = TableIntent.Menu,
                Root   = new TableRoot
                {
                    new TableSection("TableView")
                    {
                        new TextCell
                        {
                            Text = "A",
                        },

                        new TextCell
                        {
                            Text = "B",
                        },

                        new TextCell
                        {
                            Text = "C",
                        },

                        new TextCell
                        {
                            Text = "D",
                        },
                    }
                }
            };

            var stack = new StackLayout
            {
                Children = { new Button   {
                                 Text = "Go back to Gallery home", Command = new Command(() =>{ ((App)Application.Current).SetMainPage(((App)Application.Current).CreateDefaultMainPage());                                                        })
                             },
                             new Label    {
                                 Text = $"Device Direction: {DeviceDirection}"
                             },
                             horStack,
                             grid,
                             new Label    {
                                 Text = "TableView", FontSize = 10, TextColor = Color.DarkGray
                             },
                             tbl,
                             new Label    {
                                 Text = "ListView w/ TextCell", FontSize = 10, TextColor = Color.DarkGray
                             },
                             new ListView {
                                 HorizontalOptions = hOptions, ItemsSource = Enumerable.Range(0, 3).Select(c => "Text Cell!"), ItemTemplate = textCell
                             },
                             new Label    {
                                 Text = "ListView w/ SwitchCell", FontSize = 10, TextColor = Color.DarkGray
                             },
                             new ListView {
                                 HorizontalOptions = hOptions, ItemsSource = Enumerable.Range(0, 3).Select(c => true), ItemTemplate = switchCell
                             },
                             new Label    {
                                 Text = "ListView w/ EntryCell", FontSize = 10, TextColor = Color.DarkGray
                             },
                             new ListView {
                                 HorizontalOptions = hOptions, ItemsSource = Enumerable.Range(0, 3).Select(c => "Entry Cell!"), ItemTemplate = entryCell
                             },
                             new Label    {
                                 Text = "ListView w/ ImageCell", FontSize = 10, TextColor = Color.DarkGray
                             },
                             new ListView {
                                 HorizontalOptions = hOptions, ItemsSource = Enumerable.Range(0, 3).Select(c => "coffee.png"), ItemTemplate = imageCell
                             },
                             new Label    {
                                 Text = "ListView w/ ViewCell", FontSize = 10, TextColor = Color.DarkGray
                             },
                             new ListView {
                                 HorizontalOptions = hOptions, ItemsSource = Enumerable.Range(0, 3), ItemTemplate = viewCell
                             }, },

                HorizontalOptions = hOptions
            };

            Content = new ScrollView
            {
                Content = stack
            };
        }
Exemplo n.º 51
0
        public ThumbTintColorPage()
        {
            /*
             * This is a bit of a hack. Android's renderer for TableView always adds an empty header for a
             * TableSection declaration, while iOS doesn't. To compensate, I'm using a Label to display info text
             * on iOS, and the TableSection on Android since there is no easy way to get rid of it.This is a
             * long-standing bug in the XF TableView on Android.
             * (https://forums.xamarin.com/discussion/18037/tablesection-w-out-header)
             */
            TableSection section;

            if (Device.OS == TargetPlatform.Android)
            {
                section = new TableSection("SwitchCell ThumbTintColor values set in C#:");
            }
            else
            {
                section = new TableSection();
            }
            section.Add(CreateThumbTintColorCell("Red", Color.Red));
            section.Add(CreateThumbTintColorCell("Green", Color.Green));
            section.Add(CreateThumbTintColorCell("Blue", Color.Blue));

            var stack = new StackLayout {
                Padding = 10
            };

            // Slider demo

            stack.Children.Add(new Label {
                Text = "Slider ThumbTintColor values set in C#", Margin = new Thickness(10)
            });
            stack.Children.Add(CreateThumbTintColorSlider(25, Color.Red));
            stack.Children.Add(CreateThumbTintColorSlider(50, Color.Green));
            stack.Children.Add(CreateThumbTintColorSlider(75, Color.Blue));

            if (Device.OS == TargetPlatform.iOS)
            {
                stack.Children.Add(new Label {
                    Text = "SwitchCell ThumbTintColor values set in C#:", Margin = new Thickness(10)
                });
            }

            stack.Children.Add(new TableView()
            {
                HeightRequest = Device.OnPlatform <double>(132, 190, 0),
                Root          = new TableRoot()
                {
                    section
                }
            });
            stack.Children.Add(new Label()
            {
                Text   = "Switch ThumbTintColor values set in C#:",
                Margin = 10
            });

            stack.Children.Add(CreateThumbTintColorSwitch("Red", Color.Red));
            stack.Children.Add(CreateThumbTintColorSwitch("Green", Color.Green));
            stack.Children.Add(CreateThumbTintColorSwitch("Blue", Color.Blue));

            Content = new ScrollView()
            {
                Content = stack
            };
        }
Exemplo n.º 52
0
    void SelectCollection(BaseItemCollection selectedCollection)
    {
        _currentSelectedCollection         = selectedCollection;
        _collectionContainer.style.display = DisplayStyle.None;

        _itemContainer = _root.Q("SpellsContainer") as ScrollView;
        _itemContainer.Clear();
        _title.text = _currentSelectedCollection.name;

        var scrollViews = new VisualElement[ItemLevels.Length];

        for (var i = 0; i < ItemLevels.Length; i++)
        {
            var scrollView = new VisualElement();
            scrollView.AddToClassList("ScrollItemContainer");
            scrollView.styleSheets.Add(_styleSheet);
            scrollViews[i] = scrollView;

            var levelTitle = new Label("Level " + ItemLevels[i] + "+");
            levelTitle.AddToClassList("ItemLevelTitle");
            levelTitle.styleSheets.Add(_styleSheet);

            _itemContainer.Add(levelTitle);
            _itemContainer.Add(scrollView);
        }

        for (var u = 0; u < ItemLevels.Length; u++)
        {
            foreach (var item in _currentSelectedCollection.Items)
            {
                var button = new Button();
                button.AddToClassList("SkillButton");
                button.styleSheets.Add(_styleSheet);

                var label = new Label(item.name);
                label.AddToClassList("SkillButtonTitle");
                label.styleSheets.Add(_styleSheet);
                button.Add(label);

                var icon = new Image();
                icon.AddToClassList("SkillButtonIcon");
                icon.styleSheets.Add(_styleSheet);
                var itemicon = item.GetIcon(ItemLevels[u]);
                if (itemicon == null)
                {
                    itemicon = _defaultIcon;
                }
                icon.image = itemicon.texture;
                button.Add(icon);

                var field = new ObjectField();
                field.value      = item.GetIcon(ItemLevels[u]) ?? _defaultIcon;
                field.objectType = typeof(Sprite);
                var id = u;
                field.RegisterValueChangedCallback(changeEvent =>
                {
                    icon.image = ((Sprite)changeEvent.newValue)?.texture;
                    item.SetIcon(id, (Sprite)changeEvent.newValue);
                });
                button.Add(field);

                scrollViews[u].Add(button);
            }
        }
        _itemContainer.style.display          = DisplayStyle.Flex;
        _backToCollectionButton.style.display = DisplayStyle.Flex;
    }
Exemplo n.º 53
0
            public BackButtonPage()
            {
                Title             = $"Page {Shell.Current?.Navigation?.NavigationStack?.Count ?? 0}";
                _commandParameter = new Entry()
                {
                    Placeholder  = "Command Parameter",
                    AutomationId = EntryCommandParameter
                };

                _commandParameter.TextChanged += (_, __) =>
                {
                    if (String.IsNullOrWhiteSpace(_commandParameter.Text))
                    {
                        behavior.ClearValue(BackButtonBehavior.CommandParameterProperty);
                    }
                    else
                    {
                        behavior.CommandParameter = _commandParameter.Text;
                    }
                };

                StackLayout layout = new StackLayout();

                Button toggleFlyoutBehaviorButton = null;

                toggleFlyoutBehaviorButton = new Button()
                {
                    Text         = "Flyout Behavior: Flyout",
                    Command      = new Command((o) => ToggleFlyoutBehavior(o, toggleFlyoutBehaviorButton)),
                    AutomationId = "ToggleFlyoutBehavior"
                };

                layout.Children.Add(toggleFlyoutBehaviorButton);

                layout.Children.Add(new Label()
                {
                    Text = "Test setting different Back Button Behavior properties"
                });

                layout.Children.Add(new Button()
                {
                    Text         = "Toggle Behavior",
                    Command      = new Command(ToggleBehavior),
                    AutomationId = ToggleBehaviorId
                });
                layout.Children.Add(new Button()
                {
                    Text         = "Toggle Command",
                    Command      = new Command(ToggleCommand),
                    AutomationId = ToggleCommandId
                });

                layout.Children.Add(new Button()
                {
                    Text         = "Toggle Command Can Execute",
                    Command      = new Command(ToggleCommandIsEnabled),
                    AutomationId = ToggleCommandCanExecuteId
                });

                layout.Children.Add(_commandParameter);
                layout.Children.Add(_commandResult);
                layout.Children.Add(new Button()
                {
                    Text         = "Toggle Text",
                    Command      = new Command(ToggleBackButtonText),
                    AutomationId = ToggleTextId
                });
                layout.Children.Add(new Button()
                {
                    Text         = "Toggle Icon",
                    Command      = new Command(ToggleIcon),
                    AutomationId = ToggleIconId
                });
                layout.Children.Add(new Button()
                {
                    Text         = "Toggle Is Enabled",
                    Command      = new Command(ToggleIsEnabled),
                    AutomationId = ToggleIsEnabledId
                });

                layout.Children.Add(new Button()
                {
                    Text         = "Push Page",
                    Command      = new Command(PushPage),
                    AutomationId = PushPageId
                });


                Content = new ScrollView()
                {
                    Content = layout
                };
                ToggleBehavior();
            }
Exemplo n.º 54
0
 /// <summary>
 /// 设置要监听的ScrollView
 /// </summary>
 /// <param name="scrollView"></param>
 public void SetScrollView(ScrollView scrollView)
 {
     m_ScrollView = scrollView;
     SetupPivotAndAnchor();
     RefreshAllItem();
 }
Exemplo n.º 55
0
        public CalendarView(DateTime date)
        {
            // set Button
            beforeBtn.Clicked += BeforeBtn_Clicked;
            nextBtn.Clicked   += NextBtn_Clicked;

            // set grid layout for calendar
            RowDefinitionCollection rowDef = new RowDefinitionCollection();

            for (int i = 0; i < 6; i++)
            {
                rowDef.Add(new RowDefinition {
                    Height = new GridLength(30, GridUnitType.Absolute)
                });
            }
            ColumnDefinitionCollection colDef = new ColumnDefinitionCollection();

            for (int i = 0; i < 7; i++)
            {
                colDef.Add(new ColumnDefinition {
                    Width = new GridLength(20, GridUnitType.Star)
                });
            }
            calenderGrid.RowDefinitions    = rowDef;
            calenderGrid.ColumnDefinitions = colDef;

            // set variables
            selectDate = date;
            changedMonth();

            Grid topLayout = new Grid
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(20, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(20, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(20, GridUnitType.Star)
                    },
                }
            };

            topLayout.Children.Add(beforeBtn, 0, 0);
            topLayout.Children.Add(monthLB, 1, 0);
            topLayout.Children.Add(nextBtn, 2, 0);

            StackLayout layout = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Vertical,
                Children          =
                {
                    /**
                     * new StackLayout
                     * {
                     *      HorizontalOptions = LayoutOptions.CenterAndExpand,
                     *      Orientation = StackOrientation.Horizontal,
                     *      Children =
                     *      {
                     *              beforeBtn,
                     *              monthLB,
                     *              nextBtn
                     *      }
                     * },
                     */

                    topLayout,
                    calenderGrid
                }
            };

            var addBtn = new Button
            {
                Text = "+"
            };

            addBtn.Clicked += AddBtn_Clicked;

            View view = new ScrollView
            {
                Content = new StackLayout
                {
                    Children =
                    {
                        layout,
                        listView,
                        addBtn,
                    }
                }
            };

            this.Padding = new Thickness(10, 5, 10, 5);
            this.Content = view;
        }
Exemplo n.º 56
0
 protected override void OnInitialize()
 {
     scrollView = element as ScrollView;
     flags     |= LayoutBoxFlags.AlwaysUpdate;
 }
        public BlackCatSapPage()
        {
            StackLayout mainStack = new StackLayout();
            StackLayout textStack = new StackLayout
            {
                Padding = new Thickness(5),
                Spacing = 10
            };

            // Get access to the text resource.
            Assembly assembly = GetType().GetTypeInfo().Assembly;

#if __IOS__
            string resource = "BlackCatSap.iOS.Texts.TheBlackCat.txt";
#elif __ANDROID__
            string resource = "BlackCatSap.Droid.Texts.TheBlackCat.txt";
#elif WINDOWS_UWP
            string resource = "BlackCatSap.UWP.Texts.TheBlackCat.txt";
#elif WINDOWS_APP
            string resource = "BlackCatSap.Windows.Texts.TheBlackCat.txt";
#elif WINDOWS_PHONE_APP
            string resource = "BlackCatSap.WinPhone.Texts.TheBlackCat.txt";
#endif

            using (Stream stream = assembly.GetManifestResourceStream (resource)) 
            {
                using (StreamReader reader = new StreamReader (stream)) 
                {
                    bool gotTitle = false;
                    string line;

                    // Read in a line (which is actually a paragraph).
                    while (null != (line = reader.ReadLine())) 
                    {
                        Label label = new Label 
                        {
                            Text = line,

                            // Black text for ebooks!
                            TextColor = Color.Black
                        };

                        if (!gotTitle)
                        {
                            // Add first label (the title) to mainStack.
                            label.HorizontalOptions = LayoutOptions.Center;
                            label.FontSize = Device.GetNamedSize(NamedSize.Medium, label);
                            label.FontAttributes = FontAttributes.Bold;
                            mainStack.Children.Add(label);
                            gotTitle = true;
                        }
                        else
                        {
                            // Add subsequent labels to textStack.
                            textStack.Children.Add(label);
                        }
                    }
                }
            }

            // Put the textStack in a ScrollView with FillAndExpand.
            ScrollView scrollView = new ScrollView
            {
                Content = textStack,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Padding = new Thickness(5, 0),
            };

            // Add the ScrollView as a second child of mainStack.
            mainStack.Children.Add(scrollView);

            // Set page content to mainStack.
            this.Content = mainStack;

            // White background for ebooks!
            this.BackgroundColor = Color.White;
    
            // Add some iOS padding for the page
            this.Padding = new Thickness (0, Device.OnPlatform (20, 0, 0), 0, 0);
        }
        public PagePrincipaleContentPage()
        {
            #region Controllers
            InitializeComponent();

            labelEntet = new Label
            {
                Text              = "Bienvenue au Maroc",
                TextColor         = Color.Green,
                FontSize          = 40,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                BackgroundColor   = Color.Red
            };

            buttonNotification = new Button
            {
                ImageSource       = "image/drapeaux-maroc.jpg",
                ContentLayout     = new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Right, 20),
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                WidthRequest      = 300,
                HeightRequest     = 200
            };

            buttonRepas = new Button
            {
                ImageSource       = "image/Repas.jpg",
                ContentLayout     = new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Right, 20),
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                WidthRequest      = 300,
                HeightRequest     = 200
            };

            buttonEvenement = new Button
            {
                ImageSource       = "image/Evenement.jpg",
                ContentLayout     = new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Right, 20),
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                WidthRequest      = 300,
                HeightRequest     = 200
            };

            buttonVilles = new Button
            {
                ImageSource       = "image/Villes.jpg",
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                WidthRequest      = 300,
                HeightRequest     = 200
            };

            labelMember = new Label
            {
                Text              = "Ziad Biram",
                TextColor         = Color.Green,
                FontSize          = 40,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                BackgroundColor   = Color.Red
            };
            #endregion

            #region Evenement Click partagé

            buttonNotification.Clicked += OnClick;
            buttonRepas.Clicked        += OnClick;
            buttonEvenement.Clicked    += OnClick;
            buttonVilles.Clicked       += OnClick;

            #endregion

            #region StackLayout oScrollView

            StackLayout oStackLayout = new StackLayout
            {
                Children =
                {
                    labelEntet,
                    buttonNotification,
                    buttonRepas,
                    buttonEvenement,
                    buttonVilles,
                    labelMember
                },
            };

            ScrollView oScrollView = new ScrollView
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Content         = oStackLayout
            };

            this.Content = oScrollView;

            #endregion
        }
Exemplo n.º 59
0
        public CaveUI(CaveModel cave)
        {
            this.cave = cave;
            Title     = "Cave " + cave.caveID;
            StackLayout contentStack = new StackLayout
            {
                Padding = 16
            };
            Frame generalCaveFrame = new Frame
            {
                HasShadow       = true,
                BackgroundColor = Color.White
            };

            StackLayout generalCaveStack     = new StackLayout();
            Label       generalHeadlineLabel = new Label
            {
                FontSize  = 20,
                Text      = "General",
                TextColor = Color.Black
            };

            generalCaveStack.Children.Add(generalHeadlineLabel);

            Label nameLabel = new Label();
            var   nameText  = new FormattedString();

            nameText.Spans.Add(new Span {
                Text = "Historical Name: ", FontAttributes = FontAttributes.Bold
            });
            nameText.Spans.Add(new Span {
                Text = cave.historicalName
            });
            nameLabel.FormattedText = nameText;
            generalCaveStack.Children.Add(nameLabel);

            if (!String.IsNullOrEmpty(cave.optionalHistoricalName))
            {
                Label optHistoricalNameLabel = new Label();
                var   optNameText            = new FormattedString();
                optNameText.Spans.Add(new Span {
                    Text = "Optional Historical Name: ", FontAttributes = FontAttributes.Bold
                });
                optNameText.Spans.Add(new Span {
                    Text = cave.optionalHistoricalName
                });
                optHistoricalNameLabel.FormattedText = optNameText;
                generalCaveStack.Children.Add(optHistoricalNameLabel);
            }

            Label siteLabel = new Label();
            var   siteText  = new FormattedString();

            siteText.Spans.Add(new Span {
                Text = "Site: ", FontAttributes = FontAttributes.Bold
            });
            siteText.Spans.Add(new Span {
                Text = Kucha.GetCaveSiteStringByID(cave.siteID)
            });
            siteLabel.FormattedText = siteText;
            generalCaveStack.Children.Add(siteLabel);

            Label districtLabel = new Label();
            var   districtText  = new FormattedString();

            districtText.Spans.Add(new Span {
                Text = "District: ", FontAttributes = FontAttributes.Bold
            });
            districtText.Spans.Add(new Span {
                Text = Kucha.GetCaveDistrictStringByID(cave.districtID)
            });
            districtLabel.FormattedText = districtText;
            generalCaveStack.Children.Add(districtLabel);

            Label regionLabel = new Label();
            var   regionText  = new FormattedString();

            regionText.Spans.Add(new Span {
                Text = "Region: ", FontAttributes = FontAttributes.Bold
            });
            regionText.Spans.Add(new Span {
                Text = Kucha.GetCaveRegionStringByID(cave.regionID)
            });
            regionLabel.FormattedText = regionText;
            generalCaveStack.Children.Add(regionLabel);

            Label typeLabel = new Label();
            var   typeText  = new FormattedString();

            typeText.Spans.Add(new Span {
                Text = "Type: ", FontAttributes = FontAttributes.Bold
            });
            typeText.Spans.Add(new Span {
                Text = Kucha.GetCaveTypeStringByID(cave.caveTypeID)
            });
            typeLabel.FormattedText = typeText;
            generalCaveStack.Children.Add(typeLabel);

            if (!String.IsNullOrEmpty(cave.measurementString))
            {
                Label measurementLabel = new Label();
                var   measurementText  = new FormattedString();
                measurementText.Spans.Add(new Span {
                    Text = "Measurement:\n", FontAttributes = FontAttributes.Bold
                });
                measurementText.Spans.Add(new Span {
                    Text = cave.measurementString
                });
                measurementLabel.FormattedText = measurementText;
                generalCaveStack.Children.Add(measurementLabel);
            }
            generalCaveFrame.Content = generalCaveStack;
            contentStack.Children.Add(generalCaveFrame);

            Frame caveSketchFrame = new Frame
            {
                HasShadow       = true,
                BackgroundColor = Color.White
            };

            StackLayout caveSketchStack    = new StackLayout();
            Label       caveSketchHeadline = new Label
            {
                FontSize  = 20,
                Text      = "Cave Sketch",
                TextColor = Color.Black
            };

            caveSketchStack.Children.Add(caveSketchHeadline);
            if (!String.IsNullOrEmpty(cave.optionalCaveSketch))
            {
                Image caveSketch = new Image
                {
                    WidthRequest = 200,
                    Aspect       = Aspect.AspectFit,
                    Source       = ImageSource.FromUri(new Uri(Internal.Connection.GetCaveSketchURL(cave.optionalCaveSketch)))
                };
                caveSketchStack.Children.Add(caveSketch);
            }

            Image caveBackground = new Image
            {
                WidthRequest  = 200,
                HeightRequest = 200,
                Source        = ImageSource.FromUri(new Uri(Internal.Connection.GetCaveBackgroundImageURL(cave.caveTypeID)))
            };

            caveSketchStack.Children.Add(caveBackground);

            caveSketchFrame.Content = caveSketchStack;
            contentStack.Children.Add(caveSketchFrame);

            Frame notesFrame = new Frame
            {
                BackgroundColor = Color.White,
                HasShadow       = true
            };
            StackLayout notesStack = new StackLayout();

            Label notesLabel = new Label
            {
                TextColor = Color.Black,
                FontSize  = 20,
                Text      = "Private Notes"
            };

            notesStack.Children.Add(notesLabel);

            notesEditor = new Editor
            {
                BackgroundColor = Color.White,
                HeightRequest   = 100
            };
            var index = Settings.SavedNotesSetting.FindIndex(c => c.ID == cave.caveID && c.Type == NotesSaver.NOTES_TYPE.NOTE_TYPE_CAVE);

            if (index != -1)
            {
                notesEditor.Text = Settings.SavedNotesSetting[index].Note;
            }
            notesStack.Children.Add(notesEditor);
            notesFrame.Content = notesStack;
            contentStack.Children.Add(notesFrame);

            ScrollView scrollView = new ScrollView
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Content         = contentStack
            };

            Content = scrollView;
        }
Exemplo n.º 60
0
        protected override void Init()
        {
            int sizes  = 200;
            var radius = new ImageButton()
            {
                BorderColor       = Color.Brown,
                BorderWidth       = 5,
                BackgroundColor   = Color.Yellow,
                Aspect            = Aspect.Fill,
                CornerRadius      = 10,
                Source            = "coffee.png",
                HorizontalOptions = LayoutOptions.Center,
                HeightRequest     = sizes,
                WidthRequest      = sizes,
            };

            radius.On <Android>().SetShadowColor(Color.Green);
            radius.On <Android>().SetIsShadowEnabled(true);
            radius.On <Android>().SetShadowOffset(new Size(25, 25));

            var radiusBackground = new ImageButton()
            {
                BorderColor       = Color.Brown,
                BorderWidth       = 5,
                Source            = "coffee.png",
                CornerRadius      = 10,
                HorizontalOptions = LayoutOptions.Center,
                BackgroundColor   = Color.Pink,
                HeightRequest     = sizes,
                WidthRequest      = sizes
            };

            radiusBackground.On <Android>().SetShadowColor(Color.Green);
            radiusBackground.On <Android>().SetIsShadowEnabled(true);
            radiusBackground.On <Android>().SetShadowOffset(new Size(5, 5));


            StackLayout layout = new StackLayout()
            {
                Children =
                {
                    new Label()
                    {
                        Text = "No padding?"
                    },
                    new ImageButton()
                    {
                        Source          = "coffee.png",
                        BackgroundColor = Color.GreenYellow
                    },
                    new Label()
                    {
                        Text = "Do I have left padding? I should have left padding."
                    },
                    new ImageButton()
                    {
                        Source          = "coffee.png",
                        BackgroundColor = Color.Green,
                        Padding         = new Thickness(100, 0, 0, 0)
                    },
                    new Label()
                    {
                        Text = "Do I have top padding? I should have top padding."
                    },
                    new ImageButton()
                    {
                        Source          = "coffee.png",
                        BackgroundColor = Color.LawnGreen,
                        Padding         = new Thickness(0, 30, 0, 0)
                    },
                    new Label()
                    {
                        Text = "Do I have right padding? I should have right padding."
                    },
                    new ImageButton()
                    {
                        Source          = "coffee.png",
                        BackgroundColor = Color.LightGreen,
                        Padding         = new Thickness(0, 0, 100, 0)
                    },
                    new Label()
                    {
                        Text = "Do I have bottom padding? I should have bottom padding."
                    },
                    new ImageButton()
                    {
                        Source          = "coffee.png",
                        BackgroundColor = Color.ForestGreen,
                        Padding         = new Thickness(0, 0, 0, 30)
                    },
                    new Label()
                    {
                        Text = "Do you see image from a Uri?"
                    },
                    new ImageButton()
                    {
                        Source          = "https://raw.githubusercontent.com/xamarin/Xamarin.Forms/master/Xamarin.Forms.Controls/coffee.png",
                        BackgroundColor = Color.ForestGreen
                    },
                    new Label()
                    {
                        Text = "Invalid Image Uri just to test it doesn't crash"
                    },
                    new ImageButton()
                    {
                        Source          = "http://xamarin.com/imginvalidf@#$R(P&fb.png",
                        BackgroundColor = Color.ForestGreen
                    },
                    new Label()
                    {
                        Text = "Aspect: Aspect.Fill with shadows"
                    },
                    radius,
                    new Label()
                    {
                        Text = "Aspect: Aspect.AspectFit with shadows"
                    },
                    radiusBackground,
                    new Label()
                    {
                        Text = "BorderColor:Color.Green, BorderWidth:10"
                    },
                    new ImageButton()
                    {
                        Source            = "coffee.png",
                        HorizontalOptions = LayoutOptions.Center,
                        HeightRequest     = sizes,
                        WidthRequest      = sizes,
                        BorderColor       = Color.Green,
                        BorderWidth       = 10
                    },
                    new Label()
                    {
                        Text = "BorderColor:Color.Green, BorderWidth:10, Aspect:Aspect.Fill"
                    },
                    new ImageButton()
                    {
                        Source            = "coffee.png",
                        HorizontalOptions = LayoutOptions.Center,
                        HeightRequest     = sizes,
                        WidthRequest      = sizes,
                        BorderColor       = Color.Green,
                        BorderWidth       = 10,
                        Aspect            = Aspect.Fill
                    },
                    new Label()
                    {
                        Text = "BackgroundColor:Green"
                    },
                    new ImageButton()
                    {
                        Source            = "coffee.png",
                        HorizontalOptions = LayoutOptions.Center,
                        HeightRequest     = sizes,
                        WidthRequest      = sizes,
                        BackgroundColor   = Color.Green
                    },
                    new Label()
                    {
                        Text = "BorderWidth: 5, CornerRadius:10, BorderColor:Brown"
                    },
                    new ImageButton()
                    {
                        BorderColor       = Color.Brown,
                        BorderWidth       = 5,
                        Source            = "coffee.png",
                        CornerRadius      = 10,
                        HorizontalOptions = LayoutOptions.Center,
                        HeightRequest     = sizes,
                        WidthRequest      = sizes
                    }
                }
            };

            var buttons = layout.Children.OfType <ImageButton>();

            layout.Children.Insert(0, ActionGrid(buttons.ToList()));
            PaddingAnimation(buttons).Start();

            Content = new ScrollView()
            {
                Content = layout
            };
        }