private void ConfigureBusyOverlayAlert()
        {
            // Custom UI to show an indicator that route work is in progress.
            LinearLayout alertLayout = new LinearLayout(this)
            {
                Orientation = Orientation.Vertical
            };

            LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MatchParent,
                ViewGroup.LayoutParams.MatchParent,
                1.0f
                );
            param.SetMargins(0, 10, 0, 10);

            TextView processingText = new TextView(this)
            {
                Text             = "Calculating route...",
                LayoutParameters = param,
                Gravity          = GravityFlags.Center,
            };

            ProgressBar progressBar = new ProgressBar(this)
            {
                Indeterminate    = true,
                LayoutParameters = param,
                TextAlignment    = TextAlignment.Center
            };

            // Add the text and progress bar to the Linear Layout.
            alertLayout.AddView(processingText);
            alertLayout.AddView(progressBar);

            // Create the alert dialog.
            _busyIndicator = new AlertDialog.Builder(this).Create();
            _busyIndicator.SetCanceledOnTouchOutside(false);
            _busyIndicator.Show();
            _busyIndicator.Cancel();

            // Add the layout to the alert
            _busyIndicator.AddContentView(alertLayout, param);
        }
        private void CreateLayout()
        {
            // Create a new vertical layout for the app.
            LinearLayout layout = new LinearLayout(this)
            {
                Orientation = Orientation.Vertical
            };

            LinearLayout.LayoutParams buttonParam = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MatchParent,
                ViewGroup.LayoutParams.MatchParent,
                1.0f
                );
            LinearLayout.LayoutParams labelParam = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MatchParent,
                ViewGroup.LayoutParams.MatchParent,
                3.0f
                );

            // Create a horizontal sub layout for the start date.
            LinearLayout startDateSubLayout = new LinearLayout(this)
            {
                Orientation = Orientation.Horizontal
            };

            // Label for the start date.
            TextView startDateLabel = new TextView(this)
            {
                Text             = "Start Date:",
                LayoutParameters = labelParam,
                Gravity          = GravityFlags.Center
            };

            startDateSubLayout.AddView(startDateLabel);

            // Button for the start date.
            _startDateButton = new Button(this)
            {
                Text             = "1/01/1998",
                LayoutParameters = buttonParam
            };
            _startDateButton.Click += OnDateClicked;
            startDateSubLayout.AddView(_startDateButton);

            // Add the start date information to the general layout.
            layout.AddView(startDateSubLayout);

            // Create a horizontal sub layout for the end date.
            LinearLayout endDateSubLayout = new LinearLayout(this)
            {
                Orientation = Orientation.Horizontal
            };

            // Label for the end date.
            TextView endDateLabel = new TextView(this)
            {
                Text             = "End Date:",
                LayoutParameters = labelParam,
                Gravity          = GravityFlags.Center
            };

            endDateSubLayout.AddView(endDateLabel);

            // Button for the end date.
            _endDateButton = new Button(this)
            {
                Text             = "1/31/1998",
                LayoutParameters = buttonParam
            };
            _endDateButton.Click += OnDateClicked;
            endDateSubLayout.AddView(_endDateButton);

            // Add the start date information to the general layout.
            layout.AddView(endDateSubLayout);

            // Add a button to the run the hot spot analysis; wire up the click event as well
            Button mapsButton = new Button(this)
            {
                Text = "Run Analysis"
            };

            mapsButton.Click += OnRunAnalysisClicked;
            layout.AddView(mapsButton);

            // Create a layout to be used to alert the user when processing is happening.
            LinearLayout alertLayout = new LinearLayout(this)
            {
                Orientation = Orientation.Vertical
            };

            // Create paramaters for the items in the alert layout.
            LinearLayout.LayoutParams alertParam = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MatchParent,
                ViewGroup.LayoutParams.MatchParent,
                1.0f
                );
            alertParam.SetMargins(0, 10, 0, 10);

            // Text for the processing alert.
            TextView processingText = new TextView(this)
            {
                Text             = "Processing...",
                LayoutParameters = alertParam,
                Gravity          = GravityFlags.Center,
            };

            // Add the progress bar to indicate the geoprocessing task is running.
            ProgressBar progressBar = new ProgressBar(this)
            {
                Indeterminate    = true,
                LayoutParameters = alertParam,
                TextAlignment    = TextAlignment.Center
            };

            // Add the text and progress bar to the Linear Layout.
            alertLayout.AddView(processingText);
            alertLayout.AddView(progressBar);

            // Create the alert dialog.
            _alert = new AlertDialog.Builder(this).Create();
            _alert.SetCanceledOnTouchOutside(false);
            _alert.Show();
            _alert.Cancel();

            // Add the layout to the alert.
            _alert.AddContentView(alertLayout, buttonParam);

            // Add the map view to the layout.
            _myMapView = new MapView(this);
            layout.AddView(_myMapView);

            // Show the layout in the app.
            SetContentView(layout);
        }
Пример #3
0
        private void CreateLayout()
        {
            // Create a new vertical layout for the app
            LinearLayout layout = new LinearLayout(this)
            {
                Orientation = Orientation.Vertical
            };

            // Label for the user instructions
            TextView textview_Label1 = new TextView(this)
            {
                Text = "Click a location on the map to perform the viewshed analysis."
            };

            layout.AddView(textview_Label1);

            // Add the map view to the layout
            layout.AddView(_myMapView);

            // Show the layout in the app
            SetContentView(layout);

            // Create a layout to be used to alert the user when processing is happening.
            LinearLayout alertLayout = new LinearLayout(this)
            {
                Orientation = Orientation.Vertical
            };

            // Create paramaters for the items in the alert layout.
            LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MatchParent,
                ViewGroup.LayoutParams.MatchParent,
                1.0f
                );
            param.SetMargins(0, 10, 0, 10);

            // Text for the alert.
            TextView processingText = new TextView(this)
            {
                Text             = "Processing...",
                LayoutParameters = param,
                Gravity          = GravityFlags.Center,
            };

            // Add the progress bar to indicate the geoprocessing task is running; make invisible by default
            ProgressBar progressBar = new ProgressBar(this)
            {
                Indeterminate = true,
                //Visibility = ViewStates.Invisible,
                LayoutParameters = param,
                TextAlignment    = TextAlignment.Center
            };

            // Add the text and progress bar to the Linear Layout.
            alertLayout.AddView(processingText);
            alertLayout.AddView(progressBar);

            // Create the alert dialog.
            _alert = new AlertDialog.Builder(this).Create();
            _alert.SetCanceledOnTouchOutside(false);
            _alert.Show();
            _alert.Cancel();

            // Add the layout to the alert
            _alert.AddContentView(alertLayout, param);
        }