Ejemplo n.º 1
0
        void LayoutAsFlyout()
        {
            var flyoutView = _flyoutView;

            if (MauiContext == null || _navigationRoot == null || flyoutView == null)
            {
                return;
            }

            _sideBySideView?.RemoveAllViews();
            _sideBySideView?.RemoveFromParent();

            if (_navigationRoot.Parent != PlatformView)
            {
                _navigationRoot.RemoveFromParent();

                var layoutParameters =
                    new LinearLayoutCompat.LayoutParams(
                        LinearLayoutCompat.LayoutParams.MatchParent,
                        LinearLayoutCompat.LayoutParams.MatchParent);

                DrawerLayout.AddView(_navigationRoot, 0, layoutParameters);
            }

            UpdateDetailsFragmentView();

            if (flyoutView.Parent != PlatformView)
            {
                flyoutView.RemoveFromParent();

                var layoutParameters =
                    new DrawerLayout.LayoutParams(
                        (int)FlyoutWidth,
                        DrawerLayout.LayoutParams.MatchParent,
                        (int)GravityFlags.Start);

                // Flyout has to get added after the content otherwise clicking anywhere
                // on the flyout will cause it to close and gesture
                // recognizers inside the flyout won't fire
                DrawerLayout.AddView(flyoutView, layoutParameters);
            }

            DrawerLayout.CloseDrawer(flyoutView);

            if (VirtualView is IToolbarElement te && te.Toolbar?.Handler is ToolbarHandler th)
            {
                th.SetupWithDrawerLayout(DrawerLayout);
            }
        }
Ejemplo n.º 2
0
        protected void TypesCommand_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            //command_executer_id = -1;
            //command_executer_parameter = null;
            int Position = TypesCommand.SelectedItemPosition;

            selected_type_command_name = Resources.GetStringArray(Resource.Array.commands_types_array)[Position];

            string command_type_array_item_port       = GetString(Resource.String.command_type_array_item_port);
            string command_type_array_item_controller = GetString(Resource.String.command_type_array_item_controller);
            string command_type_array_item_transfer   = GetString(Resource.String.command_type_array_item_transit);

            //if (AbstractSettingsManage.Command != null)
            //{
            //    switch (AbstractSettingsManage.Command.TypeCommand)
            //    {
            //        case TypesCommands.Port:
            //            command_type_array_item_port = GetString(Resource.String.command_type_array_item_port);
            //            if (selected_type_command_name != command_type_array_item_port)
            //            {
            //                return;
            //            }
            //            break;
            //        case TypesCommands.Controller:
            //            if (selected_type_command_name != command_type_array_item_controller)
            //            {
            //                return;
            //            }
            //            break;
            //        case TypesCommands.Exit:
            //            if (selected_type_command_name != command_type_array_item_transfer)
            //            {
            //                return;
            //            }
            //            break;
            //    }
            //}

            Log.Debug(TAG, $"TypesCommand_ItemSelected({selected_type_command_name}) - Position:{Position}");
            CommandConfigForm.RemoveAllViews();

            if (selected_type_command_name == command_type_array_item_port)
            {
                SelectedTypeCommand         = TypesCommands.Port;
                about_selected_command.Text = GetString(Resource.String.about_selected_command_port_title);

                CommandConfigFormBody = LayoutInflater.Inflate(Resource.Layout.FormPortCommand, CommandConfigForm, false) as LinearLayoutCompat;

                AppCompatSpinner Controllers = CommandConfigFormBody.FindViewById <AppCompatSpinner>(Resource.Id.spinnerControllerPortCommand);
                AppCompatSpinner Ports       = CommandConfigFormBody.FindViewById <AppCompatSpinner>(Resource.Id.spinnerPortCommand);
                AppCompatSpinner States      = CommandConfigFormBody.FindViewById <AppCompatSpinner>(Resource.Id.spinnerStateCommand);

                SettingsManageKit = new SettingsManagePort(this, Controllers, Ports, States);
            }
            else if (selected_type_command_name == command_type_array_item_controller)
            {
                SelectedTypeCommand         = TypesCommands.Controller;
                about_selected_command.Text = GetString(Resource.String.about_selected_command_controller_title);

                CommandConfigFormBody = LayoutInflater.Inflate(Resource.Layout.FormControllerCommand, CommandConfigForm, false) as LinearLayoutCompat;

                AppCompatSpinner Controllers = CommandConfigFormBody.FindViewById <AppCompatSpinner>(Resource.Id.spinnerControllerCommand);
                EditText         CommandText = CommandConfigFormBody.FindViewById <EditText>(Resource.Id.editTextParametrControllerCommand);

                SettingsManageKit = new SettingsManageController(this, Controllers, CommandText);
            }
            else if (selected_type_command_name == command_type_array_item_transfer)
            {
                SelectedTypeCommand         = TypesCommands.Exit;
                about_selected_command.Text = GetString(Resource.String.about_selected_command_transit_title);

                CommandConfigFormBody = LayoutInflater.Inflate(Resource.Layout.FormTransferCommand, CommandConfigForm, false) as LinearLayoutCompat;

                AppCompatSpinner Scriptes = CommandConfigFormBody.FindViewById <AppCompatSpinner>(Resource.Id.spinnerCommandScript);
                AppCompatSpinner Steps    = CommandConfigFormBody.FindViewById <AppCompatSpinner>(Resource.Id.spinnerCommandStepScript);

                SettingsManageKit = new SettingsManageTransfer(this, Scriptes, Steps);
            }
            else
            {
            }

            CommandConfigForm.AddView(CommandConfigFormBody);
        }