Exemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
//			SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            ActionBarDrawerToggle _actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open,
                                                                                     Resource.String.navigation_drawer_close);

            drawer.SetDrawerListener(_actionBarDrawerToggle);

            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
            navigationView.NavigationItemSelected += OnNavigationItemSelected;

            AppInstanceManager theInstance = AppInstanceManager.Instance;

            if ((AppInstanceManager.bRecycled == false) || (theInstance.getAppSetting() == null))
            {             //Newly launched application.
                this.appSetting = new AppSetting(this);
                theInstance.setAppSetting(this.appSetting);
            }
            else
            {
                this.appSetting = theInstance.getAppSetting();
            }

            setConsoleFragment();
        }
Exemplo n.º 2
0
        public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
        {
            instance = this;

            AppInstanceManager theInstance = AppInstanceManager.Instance;

            appSetting = theInstance.getAppSetting();

            if (!theInstance.isConnected)
            {
                if (appSetting != null)
                {
                    new System.Threading.Thread(new System.Threading.ThreadStart(() =>
                    {
                        theInstance.setupConnection(appSetting.getIPAddress(), int.Parse(appSetting.getTcpPort()));
                    })).Start();
                }
            }

            setupService(false);
            return(StartCommandResult.NotSticky);
        }