Пример #1
0
        //location ends here


        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.MAIN_);

            locMgr = GetSystemService(Context.LocationService) as LocationManager;

            cityTextGlobal = null;

            FindViewById <Button>(Resource.Id.get_address_button).Click += FindLocBN_clicked;

            FindViewById <Button>(Resource.Id.EnterYourCity).Click += MAIN_Activity_Click;

            FindViewById <Button>(Resource.Id.closeBN).Click += MAIN_Activity_Click1;

            //Create the DB:
            DB.myDBRepo dbr = new DB.myDBRepo();
            dbr.CreateDB();
            //Create table:
            dbr.CreateTable();
            dbr.CreateIndicatorTable();
            //fonts
            var      ORtextView = FindViewById <TextView>(Resource.Id.ORtextView);
            var      enterBN    = FindViewById <Button>(Resource.Id.EnterYourCity);
            Typeface tf         = Typeface.CreateFromAsset(Assets, "dosis.book.ttf");

            ORtextView.SetTypeface(tf, TypefaceStyle.Bold);
            enterBN.SetTypeface(tf, TypefaceStyle.Bold);
            //fonts ended
            //InitializeLocationManager();
        }
Пример #2
0
        /*
         * protected override void OnResume()
         * {
         *  base.OnResume();
         *
         *  Toast.MakeText(this, "OnResumeLoading", ToastLength.Short).Show();
         * }
         */

        protected override void OnCreate(Bundle savedInstanceState)
        {
            MobileCenter.Start("005f8f23-ea2c-48ac-962f-b4929664c618",
                               typeof(Analytics), typeof(Crashes));

            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.anim_layout);

            var restartBn = FindViewById <Button>(Resource.Id.restartBN);

            //using plugin when it is the first app launch
            CrossVersionTracking.Current.Track();
            var vt = CrossVersionTracking.Current;

            vt.OnFirstLaunchOfVersion("1.0", () => firstMethod());
            //using plugin when it is the first app launch ended

            //checking internet connection
            ConnectivityManager connectivityManager = (ConnectivityManager)GetSystemService(ConnectivityService);

            NetworkInfo activeConnection = connectivityManager.ActiveNetworkInfo;
            bool        isOnline         = (activeConnection != null) && activeConnection.IsConnected;

            //checking internet connection ended

            if (isOnline == true)
            {
                restartBn.Visibility = ViewStates.Gone;

                /*_x = MAIN_Activity._x;
                *  _y = MAIN_Activity._y;*/
                //Create the DB:
                DB.myDBRepo dbr = new DB.myDBRepo();
                dbr.CreateDB();
                //Create table:
                dbr.CreateTable();
                dbr.CreateTableC_F();
                dbr.CreateIndicatorTable();
                dbr.CreateCoordsTable();

                //setting celsiusOr_fahrenheit by default
                if (dbr.GetAllRecordsC_F() == "celsius")
                {
                    SettingsActivity.c_f_Global = "celsius";
                }
                else
                {
                    SettingsActivity.c_f_Global = "fahrenheit";
                }
                //setting celsiusOr_fahrenheit by default ended

                if (MAIN_Activity.firstAppLaunchGlob == false && MAIN_Activity.ipressedGlob == false)
                {
                    dbr.GetAllRecords();
                }

                Animation myAnimation = AnimationUtils.LoadAnimation(this, Resource.Animation.MyAnimation);
                ImageView myImage     = FindViewById <ImageView>(Resource.Id.imageView1);

                myImage.StartAnimation(myAnimation);
                dbr.CreateIndicatorTable();

                string dbPath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "MyDB.db3");
                var    db     = new SQLiteConnection(dbPath);
                var    cityOrCoordIndicator = db.Table <DB.cityOrCoordIndicator>();

                MainActivity ma = new MainActivity();

                ma.city_or_coord();

                if (MAIN_Activity.cityButtonPressedIndicGlob == false)
                {
                    var coordinates = db.Table <DB.coordinates>();
                    foreach (var b in coordinates)
                    {
                        _x = b._X;
                        _y = b._Y;
                    }
                }
                if (MAIN_Activity.firstAppLaunchGlob == false)
                {
                    Displaying();
                }

                ISharedPreferences       pref = Application.Context.GetSharedPreferences("WeatherData", FileCreationMode.Private);
                ISharedPreferencesEditor edit = pref.Edit();
                if (MAIN_Activity._addressTextGlobalVariable != null)
                {
                    edit.PutString("addressTextGlobalVariable", MAIN_Activity._addressTextGlobalVariable);
                }
                if (MAIN_Activity._locationTextGlobalVariable != null)
                {
                    edit.PutString("locationTextGlobalVariable", MAIN_Activity._locationTextGlobalVariable);
                }
                edit.Apply();
            }
            else
            {
                if (MAIN_Activity.firstAppLaunchGlob == false)
                {
                    Toast.MakeText(this, "No Internet Connection.\nTurn the Internet connection on and click \"Restart\"", ToastLength.Long).Show();
                }
                //fonts
                Typeface tf = Typeface.CreateFromAsset(Assets, "dosis.book.ttf");
                restartBn.SetTypeface(tf, TypefaceStyle.Bold);
                //fonts ended
                restartBn.Visibility = ViewStates.Visible;
                restartBn.Click     += RestartBn_Click;
            }
            deleteIncorrectCity();
            FindViewById <Button>(Resource.Id.closeBN).Click += LoadingActivity_Click;
            FindViewById <Button>(Resource.Id.editBN).Click  += LoadingActivity_Click1;
        }