public override void onReceive(Context context, Intent intent)
	  {
		/* Once the application identifier is known */
		if ("com.microsoft.azure.engagement.intent.action.APPID_GOT".Equals(intent.Action))
		{
		  /* Init the native push agent */
		  string appId = intent.getStringExtra("appId");
		  EngagementNativePushAgent.getInstance(context).onAppIdGot(appId);

		  /*
		   * Request GCM registration identifier, this is asynchronous, the response is made via a
		   * broadcast intent with the <tt>com.google.android.c2dm.intent.REGISTRATION</tt> action.
		   */
		  string sender = EngagementUtils.getMetaData(context).getString("engagement:gcm:sender");
		  if (sender != null)
		  {
			/* Launch registration process */
			Intent registrationIntent = new Intent("com.google.android.c2dm.intent.REGISTER");
			registrationIntent.Package = "com.google.android.gsf";
			registrationIntent.putExtra("app", PendingIntent.getBroadcast(context, 0, new Intent(), 0));
			registrationIntent.putExtra("sender", sender.Trim());
			try
			{
			  context.startService(registrationIntent);
			}
			catch (Exception)
			{
			  /* Abort if the GCM service can't be accessed. */
			}
		  }
		}
	  }
		public override void onListItemClick(ListView l, View v, int position, long id)
		{
			string path = mCurrentPath + mArrayList[position];
			File file = new File(path);

			if (file.Directory)
			{
				if (path.IndexOf(PARENT_DIRECTORY_PATH, StringComparison.Ordinal) > 0)
				{
					mCurrentPath = file.ParentFile.Parent + DIRECTORY_DELIMITER;
				}
				else
				{
					mCurrentPath = path;
				}
				createDirectoryList(new File(mCurrentPath));

				mTextView.Text = mCurrentPath;
				mAdapter.notifyDataSetChanged();
			}
			else
			{
				if (!path.EndsWith(".fls", StringComparison.Ordinal) && !path.EndsWith(".bin", StringComparison.Ordinal))
				{
					Toast.makeText(this, "Must choose .fls or .bin file", Toast.LENGTH_SHORT).show();
				}
				else
				{
					Intent data = new Intent();
					data.putExtra(MainActivity.FIRMWARE_FILE_NAME, path);
					setResult(MainActivity.RESULT_CODE_SELECT_FIRMWARE, data);
					finish();
				}
			}
		}
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     var intent = new Intent(this, typeof(MainActivity));
     //System.Threading.Thread.Sleep(2000);
     this.StartActivity(typeof(MainActivity));
 }
 public void startActivity(Intent intent, int delayMillis = 0)
 {
     new Handler ().PostDelayed (new Runnable (delegate {
         this.activity.StartActivity (intent);
         this.activity.Finish ();
     }), delayMillis);
 }
		public override void onStart()
		{
			base.onStart();
			//����δ�򿪣�������
			if (mService.BTopen == false)
			{
				Intent enableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
				startActivityForResult(enableIntent, REQUEST_ENABLE_BT);
			}
			try
			{
				btnSendDraw = (Button) this.findViewById(R.id.btn_test);
				btnSendDraw.OnClickListener = new ClickEvent(this);
				btnSearch = (Button) this.findViewById(R.id.btnSearch);
				btnSearch.OnClickListener = new ClickEvent(this);
				btnSend = (Button) this.findViewById(R.id.btnSend);
				btnSend.OnClickListener = new ClickEvent(this);
				btnClose = (Button) this.findViewById(R.id.btnClose);
				btnClose.OnClickListener = new ClickEvent(this);
				edtContext = (EditText) findViewById(R.id.txt_content);
				btnClose.Enabled = false;
				btnSend.Enabled = false;
				btnSendDraw.Enabled = false;
			}
			catch (Exception ex)
			{
				Log.e("������Ϣ",ex.Message);
			}
		}
		public override RemoteViews getViewAt(int position)
		{
			// TODO Auto-generated method stub
			RemoteViews contentView = new RemoteViews(mContext.PackageName, R.layout.widget_item);
			Bundle extras = new Bundle();
			Intent fillInIntent = new Intent();
			if ((position % 2) == 0)
			{
				PendingIntent pIntent = PendingIntent.getActivity(mContext, 0, new Intent(Intent.ACTION_DIAL), PendingIntent.FLAG_UPDATE_CURRENT);
				extras.putParcelable(Constants.EXTRA_CONTENT_INTENT, pIntent);
				fillInIntent.putExtras(extras);
				contentView.setOnClickFillInIntent(R.id.widget_item_layout, fillInIntent);
			}
			else
			{
				Intent intent = new Intent(Intent.ACTION_VIEW);
				intent.Type = "vnd.android-dir/mms-sms";
				PendingIntent pIntent = PendingIntent.getActivity(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
				extras.putParcelable(Constants.EXTRA_CONTENT_INTENT, pIntent);
				fillInIntent.putExtras(extras);
				contentView.setOnClickFillInIntent(R.id.widget_item_layout, fillInIntent);
			}
			try
			{
				contentView.setTextViewText(R.id.tv_item, mDbHelper.getData(position));
			}
			catch (System.IndexOutOfRangeException)
			{

			}
			return contentView;
		}
        protected override void onActivityResult(int requestCode, int resultCode, Intent intent)
        {
            base.onActivityResult(requestCode, resultCode, intent);

            if (ActivityResult != null)
                ActivityResult(requestCode, resultCode, intent);
        }
	  public override void onReceive(Context context, Intent intent)
	  {
		/* Once the application identifier is known */
		if ("com.microsoft.azure.engagement.intent.action.APPID_GOT".Equals(intent.Action))
		{
		  /* Init the native push agent */
		  string appId = intent.getStringExtra("appId");
		  EngagementNativePushAgent.getInstance(context).onAppIdGot(appId);

		  /*
		   * Request ADM registration identifier if enabled, this is asynchronous, the response is made
		   * via a broadcast intent with the <tt>com.amazon.device.messaging.intent.REGISTRATION</tt>
		   * action.
		   */
		  if (EngagementUtils.getMetaData(context).getBoolean("engagement:adm:register"))
		  {
			try
			{
			  Type admClass = Type.GetType("com.amazon.device.messaging.ADM");
			  object adm = admClass.GetConstructor(typeof(Context)).newInstance(context);
			  admClass.GetMethod("startRegister").invoke(adm);
			}
			catch (Exception)
			{
			  /* Abort if ADM not available */
			}
		  }
		}
	  }
	  /// <summary>
	  /// Get the Engagement service intent to bind to. </summary>
	  /// <param name="context"> any application context. </param>
	  /// <returns> an explicit intent that can used to bind to the service. </returns>
	  public static Intent getServiceIntent(Context context)
	  {
		/* Build the base intent */
		Intent intent = new Intent();
		intent.setClassName(context, SERVICE_CLASS);
		return intent;
	  }
		public Transform (Profile input, Format input_format,
				  Profile output, Format output_format,
				  Intent intent, uint flags)
		{
			this.handle = new HandleRef (this, NativeMethods.CmsCreateTransform (input.Handle, input_format,
									       output.Handle, output_format,
									       (int)intent, flags));
		}
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if (requestCode == RequestCodeResolution)
            {
                this.resultResolutionSubject.Disposable.OnNext(resultCode == Result.Ok);
            }
        }
	  internal override Intent buildIntent()
	  {
		Intent intent = new Intent(INTENT_ACTION);
		intent.Type = Type;
		string category = Category;
		if (category != null)
		{
		  intent.addCategory(category);
		}
		return intent;
	  }
Exemple #13
0
        public Transform(Profile input, Format input_format,
				  Profile output, Format output_format,
				  Intent intent, uint flags)
        {
            if (input == null)
                throw new ArgumentNullException ("input");
            if (output == null)
                throw new ArgumentNullException ("output");

            this.handle = new HandleRef (this, NativeMethods.CmsCreateTransform (input.Handle, input_format,
                                           output.Handle, output_format,
                                           (int)intent, flags));
        }
	  internal override Intent buildIntent()
	  {
		/*
		 * Unlike interactive contents whose content is either cached in RAM (current content) or
		 * retrieved from SQLite from its identifier (to handle application restart for system
		 * notifications), we drop the content as soon as the first broadcast receiver that handles
		 * datapush acknowledges or cancel the content. We need to put data in the intent to handle
		 * several broadcast receivers.
		 */
		Intent intent = new Intent(INTENT_ACTION);
		intent.putExtra("category", mCategory);
		intent.putExtra("body", mBody);
		intent.putExtra("type", mType);
		return intent;
	  }
		public Transform (Profile [] profiles,
				  Format input_format,
				  Format output_format,
				  Intent intent, uint flags)
		{
			HandleRef [] handles = new HandleRef [profiles.Length];
			for (int i = 0; i < profiles.Length; i++) {
				handles [i] = profiles [i].Handle;
			}
			
			this.handle = new HandleRef (this, NativeMethods.CmsCreateMultiprofileTransform (handles, handles.Length, 
											   input_format,
											   output_format, 
											   (int)intent, flags));
		}
		private void answerClicked()
		{
			mAudioPlayer.stopRingtone();
			Call call = SinchServiceInterface.getCall(mCallId);
			if (call != null)
			{
				call.answer();
				Intent intent = new Intent(this, typeof(CallScreenActivity));
				intent.putExtra(SinchService.CALL_ID, mCallId);
				startActivity(intent);
			}
			else
			{
				finish();
			}
		}
		protected internal override void onHandleIntent(Intent intent)
		{
			try
			{
				InstanceID instanceID = InstanceID.getInstance(this);
				string token = instanceID.getToken(getString([email protected]_defaultSenderId), GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
				sendGCMTokenToActivity(token);
			}
			catch (Exception e)
			{
				/*
				 * If we are unable to retrieve the GCM token we notify the Activity
				 * letting the user know this step failed.
				 */
				Log.e(TAG, "Failed to retrieve GCM token", e);
				sendGCMTokenToActivity(null);
			}
		}
Exemple #18
0
        public Transform(Profile [] profiles,
				  Format input_format,
				  Format output_format,
				  Intent intent, uint flags)
        {
            if (profiles == null)
                throw new ArgumentNullException ("profiles");

            HandleRef [] handles = new HandleRef [profiles.Length];
            for (int i = 0; i < profiles.Length; i++) {
                handles [i] = profiles [i].Handle;
            }

            this.handle = new HandleRef (this, NativeMethods.CmsCreateMultiprofileTransform (handles, handles.Length,
                                               input_format,
                                               output_format,
                                               (int)intent, flags));
        }
		public override void onClick(View v)
		{
			switch (v.Id)
			{
			case R.id.buttonGallery:
				string externalStorageState = Environment.ExternalStorageState;
				if (externalStorageState.Equals(Environment.MEDIA_MOUNTED))
				{
					Intent intent = new Intent(Intent.ACTION_PICK);
					intent.Type = MediaStore.Images.Media.CONTENT_TYPE;
					Activity.startActivityForResult(intent, MainActivity.REQUEST_CODE_ACTION_PICK);
				}
				break;

			case R.id.buttonPrintBitmap:
				printBitmap();
				break;
			}
		}
Exemple #20
0
	    protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			SetContentView (Resource.Layout.Main);
			EditText invocador = FindViewById<EditText> (Resource.Id.inputNomeInvocador);
			Button button = FindViewById<Button> (Resource.Id.btnBuscarInvocador);

			button.Click += (sender, e) => {
				string url = string.Format ("https://br.api.pvp.net/api/lol/br/{0}/summoner/by-name/{1}?api_key={2}",Version, invocador.Text, ApiKey);
				JsonValue result = GetResumePlayer (url);
				if(result != null)
				{
					var resumePlayer = new Intent (this, typeof(ResumePlayerActivity));
					resumePlayer.PutExtra ("MyData", "Data from Activity1");
					StartActivity (resumePlayer);
				}
			};
		}
			public override void onReceive(Context context, Intent intent)
			{
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String action = intent.getAction();
				string action = intent.Action;
				if (SpassFingerprint.ACTION_FINGERPRINT_RESET.Equals(action))
				{
					Toast.makeText(outerInstance.mContext, "all fingerprints are removed", Toast.LENGTH_SHORT).show();
				}
				else if (SpassFingerprint.ACTION_FINGERPRINT_REMOVED.Equals(action))
				{
					int fingerIndex = intent.getIntExtra("fingerIndex", 0);
					Toast.makeTextuniquetempvar.show();
				}
				else if (SpassFingerprint.ACTION_FINGERPRINT_ADDED.Equals(action))
				{
					int fingerIndex = intent.getIntExtra("fingerIndex", 0);
					Toast.makeTextuniquetempvar.show();
				}
			}
		// This onReceive will be call when a OneSignal Background Data Notification is received(before clicking) by the device.
		// You can read the additionalData and do anything you need here with it.
		// You may consider adding a wake lock here if you need to make sure the devices doesn't go to sleep while processing.
		// The following must also be in your AndroidManifest.xml for this to fire:
		/*
		 <receiver
		    android:name="com.onesignal.example.BackgroundDataBroadcastReceiver"
		    android:exported="false">
			<intent-filter>
		    	<action android:name="com.onesignal.BackgroundBroadcast.RECEIVE" />
		 	</intent-filter>
		 </receiver>
		 
		 Make sure to keep android:exported="false" so other apps can't call can this.
		*/
		public override void onReceive(Context context, Intent intent)
		{
			Bundle dataBundle = intent.getBundleExtra("data");

			try
			{
				Log.i("OneSignalExample", "Notification content: " + dataBundle.getString("alert"));
				Log.i("OneSignalExample", "Notification title: " + dataBundle.getString("title"));
				Log.i("OneSignalExample", "Is Your App Active: " + dataBundle.getBoolean("isActive"));

				JSONObject customJSON = new JSONObject(dataBundle.getString("custom"));
				if (customJSON.has("a"))
				{
					Log.i("OneSignalExample", "additionalData: " + customJSON.getJSONObject("a").ToString());
				}
			}
			catch (Exception t)
			{
				Console.WriteLine(t.ToString());
				Console.Write(t.StackTrace);
			}
		}
		public override int onStartCommand(Intent intent, int flags, int startId)
		{
			Log.d(TAG, "onStartCommand");
			if (intent != null)
			{
				if (this.mServiceConnected)
				{
					handleIntent(intent);
				}
				else
				{
					this.mDelayedIntents.AddLast(intent);
				}
			}

			// Connection to remote service of ProfessionalAudio system is set.
			if (this.mSapaAppService == null)
			{
				connectConnectionBridge();
			}

			return base.onStartCommand(intent, flags, startId);
		}
		private void answerClicked()
		{
			mAudioPlayer.stopRingtone();
			Call call = SinchServiceInterface.getCall(mCallId);
			if (call != null)
			{
				try
				{
					call.answer();
					Intent intent = new Intent(this, typeof(CallScreenActivity));
					intent.putExtra(SinchService.CALL_ID, mCallId);
					startActivity(intent);
				}
				catch (MissingPermissionException e)
				{
					ActivityCompat.requestPermissions(this, new string[]{e.RequiredPermission}, 0);
				}
			}
			else
			{
				finish();
			}
		}
		public override int onStartCommand(Intent intent, int flags, int startId)
		{
			if (intent != null)
			{
				//When application is activated from ProfessionalAudio system it receives SapaAppInfo object describing it.
				//To obtain this object static method getSapaAppInfo() is to be used.
				SapaAppInfo info = SapaAppInfo.getAppInfo(intent);
				mCallerPackageName = intent.getStringExtra("com.samsung.android.sdk.professionalaudio.key.callerpackagename");
				//Toast.makeText(this, mCallerPackageName, Toast.LENGTH_SHORT).show();
				if (info != null)
				{
					//Received SapaAppInfo is saved to class field.
					mMyInfo = info;
				}
			}

			//Connection to remote service of ProfessionalAudio system is set.
			if (mSapaAppService == null)
			{
				connectConnectionBridge();
			}

			return base.onStartCommand(intent, flags, startId);
		}
		/// <summary>
		/// этот метод вызывается после того, как будет вызван intent.GoBackWithResult() от дочерней вьюшки -- ( реализация от собственной либы CoCore)
		/// </summary>
		/// <returns><c>true</c>, if with result was returned, <c>false</c> otherwise.</returns>
		/// <param name="intent">Intent.</param>
		public bool ReturnWithResult (Intent intent)
		{
			var context = intent.Get<string> ("context");
			var station = intent.Get<Station> ("station");
			if (context == "to") {
				ToSchedule = station.StationTitle;
			} else if (context == "from") {
				FromSchedule = station.StationTitle;
			}
			return true;
		}
        public override SkillResponse HandleIntent(Intent intent, Session session, ILambdaContext lambdaContext)
        {
            long nodeIndex = long.Parse(intent.Slots["NodeIndex"].Value);

            return(Story.CreateResponseForNode(nodeIndex, intent, session, lambdaContext));
        }
Exemple #28
0
 public override IBinder OnBind(Intent intent)
 {
     // We don't need any bindings -> Return null
     return(null);
 }
        private void MAdapter_ItemDelete(object sender, int e)
        {
            string nazivLokacije = db.Query <DID_Lokacija>(
                "SELECT * " +
                "FROM DID_Lokacija " +
                "WHERE SAN_Id = ?", lokacijaId).FirstOrDefault().SAN_Naziv;

            List <DID_Potvrda> potvrda = db.Query <DID_Potvrda>(
                "SELECT * " +
                "FROM DID_Potvrda " +
                "WHERE Lokacija = ? " +
                "AND RadniNalog = ?", lokacijaId, radniNalogId);

            int statusLokacije = db.Query <DID_RadniNalog_Lokacija>(
                "SELECT * " +
                "FROM DID_RadniNalog_Lokacija " +
                "WHERE Lokacija = ? " +
                "AND RadniNalog = ?", lokacijaId, radniNalogId).FirstOrDefault().Status;

            AlertDialog.Builder alert = new AlertDialog.Builder(this);
            alert.SetTitle("Potvrda");
            if (potvrda.Any())
            {
                alert.SetMessage("Lokacija " + nazivLokacije + " je zaključana. Jeste li sigurni da želite obrisati materijal?");
                alert.SetPositiveButton("OBRIŠI", (senderAlert, arg) =>
                {
                    DeleteMaterijal(filtriranePotrosnje[e]);

                    db.Execute(
                        "DELETE FROM DID_Potvrda_Materijal " +
                        "WHERE Potvrda = ?", potvrda.FirstOrDefault().Id);

                    db.Execute(
                        "INSERT INTO DID_Potvrda_Materijal (Potvrda, Materijal, Utroseno, MaterijalNaziv) " +
                        "SELECT pot.Id, mat.MaterijalSifra, TOTAL(mat.Kolicina), mat.MaterijalNaziv " +
                        "FROM DID_AnketaMaterijali mat " +
                        "INNER JOIN DID_LokacijaPozicija poz ON poz.POZ_Id = mat.PozicijaId " +
                        "INNER JOIN DID_Potvrda pot ON pot.RadniNalog = mat.RadniNalog " +
                        "AND pot.Lokacija = poz.SAN_Id " +
                        "WHERE pot.Id = ? " +
                        "GROUP BY mat.MaterijalSifra, mat.MjernaJedinica", potvrda.FirstOrDefault().Id);

                    var listaMaterijalaPotvrda = db.Query <DID_Potvrda_Materijal>("SELECT * FROM DID_Potvrda_Materijal WHERE Potvrda = ?", potvrda.FirstOrDefault().Id);

                    foreach (var materijal in listaMaterijalaPotvrda)
                    {
                        db.Execute(
                            "UPDATE DID_Potvrda_Materijal " +
                            "SET SinhronizacijaPrivremeniKljuc = ? " +
                            "WHERE Id = ?", materijal.Id, materijal.Id);
                    }

                    intent = new Intent(this, typeof(Activity_PotroseniMaterijali));
                    StartActivity(intent);
                });

                alert.SetNegativeButton("ODUSTANI", (senderAlert, arg) => { });
                Dialog dialog = alert.Create();
                dialog.Show();
            }
            else
            {
                alert.SetMessage("Jeste li sigurni da želite obrisati materijal?");
                alert.SetPositiveButton("OBRIŠI", (senderAlert, arg) =>
                {
                    DeleteMaterijal(filtriranePotrosnje[e]);
                    intent = new Intent(this, typeof(Activity_PotroseniMaterijali));
                    StartActivity(intent);
                });

                alert.SetNegativeButton("ODUSTANI", (senderAlert, arg) => { });
                Dialog dialog = alert.Create();
                dialog.Show();
            }
        }
Exemple #30
0
 protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
 {
     base.OnActivityResult(requestCode, resultCode, data);
 }
Exemple #31
0
 public OnActivityResultArgs(int requestCode, Result resultCode, Intent intent)
 {
     RequestCode = requestCode;
     ResultCode  = resultCode;
     Intent      = intent;
 }
        protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);
            if (requestCode == RC_SIGN_IN)//google login
            {
                var result = Auth.GoogleSignInApi.GetSignInResultFromIntent(data);

                HandleGoogleSignInResult(result);
            }
            else if (requestCode == SIGN_OUT)
            {
                //signout
                AccessToken fbToken    = AccessToken.CurrentAccessToken;
                bool        isLoggedIn = fbToken != null && !fbToken.IsExpired;
                if (isLoggedIn)
                {
                    LoginManager.Instance.LogOut();
                }
                if (mGoogleApiClient.IsConnected)
                {
                    mGoogleApiClient.Disconnect();
                }
            }
            else //facebook login
            {
                var resultCodeNum = 0;
                switch (resultCode)
                {
                case Result.Ok:
                    resultCodeNum = -1;
                    break;

                case Result.Canceled:
                    resultCodeNum = 0;
                    break;

                case Result.FirstUser:
                    resultCodeNum = 1;
                    break;
                }
                mCallbackManager.OnActivityResult(requestCode, resultCodeNum, data);
            }
        }
 public void OnActivityResult(IFileStorageSetupActivity activity, int requestCode, int resultCode, Intent data)
 {
     _baseStorage.OnActivityResult(activity, requestCode, resultCode, data);
 }
Exemple #34
0
        private void CreateNoti()
        {
            try
            {
                BigViews   = new RemoteViews(PackageName, Resource.Layout.CustomNotificationLayout);
                SmallViews = new RemoteViews(PackageName, Resource.Layout.CustomNotificationSmallLayout);

                Intent notificationIntent = new Intent(this, typeof(SplashScreenActivity));
                notificationIntent.SetAction(Intent.ActionMain);
                notificationIntent.AddCategory(Intent.CategoryLauncher);
                notificationIntent.PutExtra("isnoti", true);
                PendingIntent pendingIntent = PendingIntent.GetActivity(this, 0, notificationIntent, PendingIntentFlags.UpdateCurrent);

                Intent previousIntent = new Intent(this, typeof(PlayerService));
                previousIntent.SetAction(ActionRewind);
                PendingIntent ppreviousIntent = PendingIntent.GetService(this, 0, previousIntent, 0);

                Intent playIntent = new Intent(this, typeof(PlayerService));
                playIntent.SetAction(ActionToggle);
                PendingIntent pplayIntent = PendingIntent.GetService(this, 0, playIntent, 0);

                Intent nextIntent = new Intent(this, typeof(PlayerService));
                nextIntent.SetAction(ActionSkip);
                PendingIntent pnextIntent = PendingIntent.GetService(this, 0, nextIntent, 0);

                Intent closeIntent = new Intent(this, typeof(PlayerService));
                closeIntent.SetAction(ActionStop);
                PendingIntent pcloseIntent = PendingIntent.GetService(this, 0, closeIntent, 0);

                Notification = new NotificationCompat.Builder(this, NotificationChannelId)
                               .SetLargeIcon(BitmapFactory.DecodeResource(Resources, Resource.Mipmap.icon))
                               .SetContentTitle(AppSettings.ApplicationName)
                               .SetPriority((int)NotificationPriority.Max)
                               .SetContentIntent(pendingIntent)
                               .SetSmallIcon(Resource.Drawable.icon_notification)
                               .SetTicker(Constant.ArrayListPlay[Constant.PlayPos]?.Title)
                               .SetChannelId(NotificationChannelId)
                               .SetOngoing(true)
                               .SetAutoCancel(true)
                               .SetOnlyAlertOnce(true);

                NotificationChannel mChannel;
                if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
                {
                    NotificationImportance importance = NotificationImportance.Low;
                    mChannel = new NotificationChannel(NotificationChannelId, AppSettings.ApplicationName, importance);
                    MNotificationManager.CreateNotificationChannel(mChannel);

                    MediaSessionCompat mMediaSession = new MediaSessionCompat(Application.Context, AppSettings.ApplicationName);
                    mMediaSession.SetFlags(MediaSessionCompat.FlagHandlesMediaButtons | MediaSessionCompat.FlagHandlesTransportControls);

                    Notification.SetStyle(new Android.Support.V4.Media.App.NotificationCompat.MediaStyle()
                                          .SetMediaSession(mMediaSession.SessionToken).SetShowCancelButton(true)
                                          .SetShowActionsInCompactView(0, 1, 2)
                                          .SetCancelButtonIntent(MediaButtonReceiver.BuildMediaButtonPendingIntent(Application.Context, PlaybackStateCompat.ActionStop)))
                    .AddAction(new NotificationCompat.Action(Resource.Xml.ic_skip_previous, "Previous", ppreviousIntent))
                    .AddAction(new NotificationCompat.Action(Resource.Xml.ic_pause, "Pause", pplayIntent))
                    .AddAction(new NotificationCompat.Action(Resource.Xml.ic_skip_next, "Next", pnextIntent))
                    .AddAction(new NotificationCompat.Action(Resource.Drawable.ic_action_close, "Close", pcloseIntent));
                }
                else
                {
                    string songName   = Methods.FunString.DecodeString(Constant.ArrayListPlay[Constant.PlayPos]?.Title);
                    string genresName = Methods.FunString.DecodeString(Constant.ArrayListPlay[Constant.PlayPos]?.CategoryName) + " " + Application.Context.Resources.GetString(Resource.String.Lbl_Music);

                    BigViews.SetOnClickPendingIntent(Resource.Id.imageView_noti_play, pplayIntent);
                    BigViews.SetOnClickPendingIntent(Resource.Id.imageView_noti_next, pnextIntent);
                    BigViews.SetOnClickPendingIntent(Resource.Id.imageView_noti_prev, ppreviousIntent);
                    BigViews.SetOnClickPendingIntent(Resource.Id.imageView_noti_close, pcloseIntent);
                    SmallViews.SetOnClickPendingIntent(Resource.Id.status_bar_collapse, pcloseIntent);

                    BigViews.SetImageViewResource(Resource.Id.imageView_noti_play, Android.Resource.Drawable.IcMediaPause);
                    BigViews.SetTextViewText(Resource.Id.textView_noti_name, songName);
                    SmallViews.SetTextViewText(Resource.Id.status_bar_track_name, songName);
                    BigViews.SetTextViewText(Resource.Id.textView_noti_artist, genresName);
                    SmallViews.SetTextViewText(Resource.Id.status_bar_artist_name, genresName);
                    BigViews.SetImageViewResource(Resource.Id.imageView_noti, Resource.Mipmap.icon);
                    SmallViews.SetImageViewResource(Resource.Id.status_bar_album_art, Resource.Mipmap.icon);
                    Notification.SetCustomContentView(SmallViews).SetCustomBigContentView(BigViews);
                }

                ShowNotification();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            _design.ApplyTheme();
            base.OnCreate(bundle);


            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            SetContentView(Resource.Layout.create_database);
            _appTask = AppTask.GetTaskInOnCreate(bundle, Intent);

            SetDefaultIoc();

            FindViewById(Resource.Id.keyfile_filename).Visibility = ViewStates.Gone;


            var keyfileCheckbox = FindViewById <CheckBox>(Resource.Id.use_keyfile);

            if (bundle != null)
            {
                _keyfileFilename = bundle.GetString(KeyfilefilenameBundleKey, null);
                if (_keyfileFilename != null)
                {
                    FindViewById <TextView>(Resource.Id.keyfile_filename).Text = FileSelectHelper.ConvertFilenameToIocPath(_keyfileFilename);
                    FindViewById(Resource.Id.keyfile_filename).Visibility      = ViewStates.Visible;
                    keyfileCheckbox.Checked = true;
                }

                if (bundle.GetString(Util.KeyFilename, null) != null)
                {
                    _ioc = new IOConnectionInfo
                    {
                        Path         = bundle.GetString(Util.KeyFilename),
                        UserName     = bundle.GetString(Util.KeyServerusername),
                        Password     = bundle.GetString(Util.KeyServerpassword),
                        CredSaveMode = (IOCredSaveMode)bundle.GetInt(Util.KeyServercredmode),
                    };
                }
            }

            UpdateIocView();

            keyfileCheckbox.CheckedChange += (sender, args) =>
            {
                if (keyfileCheckbox.Checked)
                {
                    if (_restoringInstanceState)
                    {
                        return;
                    }

                    Util.ShowBrowseDialog(this, RequestCodeKeyFile, false, true);
                }
                else
                {
                    FindViewById(Resource.Id.keyfile_filename).Visibility = ViewStates.Gone;
                    _keyfileFilename = null;
                }
            };


            FindViewById(Resource.Id.btn_change_location).Click += (sender, args) =>
            {
                Intent intent = new Intent(this, typeof(FileStorageSelectionActivity));
                StartActivityForResult(intent, RequestCodeDbFilename);
            };

            Button generatePassword = (Button)FindViewById(Resource.Id.generate_button);

            generatePassword.Click += (sender, e) =>
            {
                GeneratePasswordActivity.LaunchWithoutLockCheck(this);
            };

            FindViewById(Resource.Id.btn_create).Click += (sender, evt) =>
            {
                CreateDatabase(Intent.GetBooleanExtra("MakeCurrent", true));
            };

            ImageButton btnTogglePassword = (ImageButton)FindViewById(Resource.Id.toggle_password);

            btnTogglePassword.Click += (sender, e) =>
            {
                _showPassword = !_showPassword;
                MakePasswordMaskedOrVisible();
            };
            Android.Graphics.PorterDuff.Mode mMode = Android.Graphics.PorterDuff.Mode.SrcAtop;
            Android.Graphics.Color           color = new Android.Graphics.Color(224, 224, 224);
            btnTogglePassword.SetColorFilter(color, mMode);
        }
Exemple #36
0
        private void UpdateNotiPlay(bool isPlay)
        {
            try
            {
                Task.Run(() =>
                {
                    try
                    {
                        string songName   = Methods.FunString.DecodeString(Constant.ArrayListPlay[Constant.PlayPos]?.Title);
                        string genresName = Methods.FunString.DecodeString(Constant.ArrayListPlay[Constant.PlayPos]?.CategoryName) + " " + GlobalContext.GetText(Resource.String.Lbl_Music);

                        if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
                        {
                            Intent playIntent = new Intent(this, typeof(PlayerService));
                            playIntent.SetAction(ActionToggle);
                            PendingIntent pPreviousIntent = PendingIntent.GetService(this, 0, playIntent, 0);

                            if (isPlay)
                            {
                                if (Notification.MActions.Count > 0)
                                {
                                    Notification.MActions[1] = new NotificationCompat.Action(Resource.Xml.ic_pause, "Pause", pPreviousIntent);
                                }
                            }
                            else
                            {
                                if (Notification.MActions.Count > 0)
                                {
                                    Notification.MActions[1] = new NotificationCompat.Action(Resource.Xml.ic_play_arrow, "Play", pPreviousIntent);
                                }
                            }

                            if (!string.IsNullOrEmpty(songName))
                            {
                                Notification.SetContentTitle(songName);
                            }
                            if (!string.IsNullOrEmpty(genresName))
                            {
                                Notification.SetContentText(genresName);
                            }
                        }
                        else
                        {
                            if (isPlay)
                            {
                                BigViews.SetImageViewResource(Resource.Id.imageView_noti_play, Android.Resource.Drawable.IcMediaPause);
                            }
                            else
                            {
                                BigViews.SetImageViewResource(Resource.Id.imageView_noti_play, Android.Resource.Drawable.IcMediaPause);
                            }

                            if (!string.IsNullOrEmpty(songName))
                            {
                                BigViews.SetTextViewText(Resource.Id.textView_noti_name, songName);
                            }
                            if (!string.IsNullOrEmpty(genresName))
                            {
                                BigViews.SetTextViewText(Resource.Id.textView_noti_artist, genresName);
                            }
                            if (!string.IsNullOrEmpty(genresName))
                            {
                                SmallViews.SetTextViewText(Resource.Id.status_bar_artist_name, genresName);
                            }
                            if (!string.IsNullOrEmpty(songName))
                            {
                                SmallViews.SetTextViewText(Resource.Id.status_bar_track_name, songName);
                            }
                        }

                        var url = Constant.ArrayListPlay[Constant.PlayPos]?.Thumbnail?.Replace(" ", "%20");
                        if (!string.IsNullOrEmpty(url))
                        {
                            var bit = BitmapUtil.GetImageBitmapFromUrl(url);
                            if (bit != null)
                            {
                                Notification.SetLargeIcon(bit);
                            }
                        }

                        MNotificationManager.Notify(101, Notification.Build());
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemple #37
0
 protected override void OnHandleIntent(Intent intent)
 {
     Console.WriteLine("Got here!");
 }
Exemple #38
0
 protected override void OnHandleIntent(Intent intent)
 {
 }
 internal void SendIntent(Intent intent)
 {
     _stream.Write((byte)0); // Pushed packet
     _stream.Write((byte)ClientPacketType.PlayerIntent);
     _stream.WriteProtoBuf(intent);
     _stream.Flush();
 }
        public void GetLangSTT()
        {
            Intent intent = new Intent(RecognizerIntent.ActionGetLanguageDetails);

            StartActivityForResult(intent, 10);
        }
        protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            switch (requestCode)
            {
            case SelectImageRequest:
                if (resultCode == Result.Ok)
                {
                    byte[] inputData = convertImageToByte(data.Data);
                    if (pictures.Count < 3)
                    {
                        pictures.Add(new Picture {
                            PictureData = inputData
                        });
                    }
                    else
                    {
                        pictures[imageCount].PictureData = inputData;
                    }

                    switch (imageCount)
                    {
                    case 0:
                        imageView = FindViewById <ImageView>(Resource.Id.setDelivered_Picture);
                        imageCount++;
                        break;

                    case 1:
                        imageView = FindViewById <ImageView>(Resource.Id.setDelivered_Picture2);
                        imageCount++;
                        break;

                    case 2:
                        imageView  = FindViewById <ImageView>(Resource.Id.setDelivered_Picture3);
                        imageCount = 0;
                        break;

                    default:
                        break;
                    }

                    imageUri = data.Data;
                    imageView.SetImageURI(imageUri);

                    if (mLastLocation != null)
                    {
                        btnConfirm.Enabled = true;
                    }
                }
                break;

            default:
                break;
            }
        }
Exemple #42
0
 protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
 {
     base.OnActivityResult(requestCode, resultCode, data);
     if (resultCode == Result.Ok)
     {
         getGame();
     }
 }
Exemple #43
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.MenuUsuario);

            lblBemvindo = FindViewById <TextView>(Resource.Id.lbl_bemvindo);
            string id = Intent.GetStringExtra("id") ?? "Data not available";

            btnOrcamento       = FindViewById <Button>(Resource.Id.btn_orcamento);
            btnAgendamento     = FindViewById <Button>(Resource.Id.btn_agendamento);
            btnMeusAgedamentos = FindViewById <Button>(Resource.Id.btn_meusagendamentos);
            btnMateriais       = FindViewById <Button>(Resource.Id.btnMateriaisDisponiveis);


            MySqlConnection con = new MySqlConnection("Server=mysql873.umbler.com;Port=41890;database=ufscarpds;User Id=ufscarpds;Password=ufscar1993;charset=utf8");

            string email = "";
            string nome  = "";
            string senha = "";

            try
            {
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                    Console.WriteLine("Conectado com sucesso!");
                }

                MySqlCommand cmd = new MySqlCommand("Select email, id, nome, senha from pessoa where id=@id;", con);
                cmd.Parameters.AddWithValue("@id", id);

                using (MySqlDataReader reader = cmd.ExecuteReader())
                {
                    Console.WriteLine("Passou execute reader!");
                    if (reader.Read())
                    {
                        Console.WriteLine("Passou REad reader!");
                        email = reader["email"].ToString();
                        nome  = reader["nome"].ToString();
                        senha = reader["senha"].ToString();
                    }
                }
            }
            catch (MySqlException ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                con.Close();
            }

            lblBemvindo.Text = "Bem-vindo(a), " + nome + "!";

            MySqlConnection conn = new MySqlConnection("Server=mysql873.umbler.com;Port=41890;database=ufscarpds;User Id=ufscarpds;Password=ufscar1993;charset=utf8");

            try
            {
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                    Console.WriteLine("Conectado com sucesso2!");

                    MySqlCommand cmd = new MySqlCommand("select id, needNotifyClient from agendamento where id_usuario = @id_usuario AND needNotifyClient = 1", conn);
                    cmd.Parameters.AddWithValue("@id_usuario", id);

                    Console.WriteLine("Passou comando2!");

                    using (MySqlDataReader reader = cmd.ExecuteReader())
                    {
                        Console.WriteLine("OH GOSH BUGOU!");

                        while (reader.Read())
                        {
                            //   materiaisDisplay.Add(reader["nome"].ToString());
                            // Console.WriteLine("Adicionando. MateriaisDisplay: " + materiaisDisplay);


                            Console.WriteLine("Passou execute reader2!");
                            //int id2 = reader.GetOrdinal("id");
                            //int idservico = reader.GetOrdinal("id_servico");
                            //int idusuario = reader.GetOrdinal("id_usuario");
                            //int conf = reader.GetOrdinal("confirmado");
                            //String conf = reader.GetString("confirmado");
                            int needNot = reader.GetOrdinal("needNotifyClient");
                            int idAg    = reader.GetOrdinal("id");
                            Console.WriteLine(needNot);

                            if (needNot == 1)
                            {
                                Intent intent = new Intent(this, typeof(MeusAgendamentos));
                                intent.PutExtra("id", id);

                                const int     pendingIntentId = 0;
                                PendingIntent pendingIntent   =
                                    PendingIntent.GetActivity(this, pendingIntentId, intent, PendingIntentFlags.OneShot);

                                Notification.Builder builder = new Notification.Builder(this)
                                                               .SetContentIntent(pendingIntent)
                                                               .SetAutoCancel(true)
                                                               .SetContentTitle("Resposta de Agendamento")
                                                               .SetContentText("Seu agendamento recebeu uma resposta")
                                                               .SetSmallIcon(Resource.Drawable.Icon);

                                Notification not = builder.Build();

                                NotificationManager notManager = GetSystemService(Context.NotificationService) as NotificationManager;

                                const int notid = 0;

                                notManager.Notify(notid, not);

                                Console.WriteLine("id mudado ==" + idAg);
                            }
                        }
                    }

                    MySqlCommand query = new MySqlCommand("UPDATE agendamento SET needNotifyClient=0 WHERE id_usuario = @idUs AND needNotifyClient=1", conn);
                    Console.WriteLine("USER = "******" - NEEDNOT = ");
                    query.Parameters.AddWithValue("@idUs", id);
                    query.ExecuteNonQuery();
                }
            }
            catch (MySqlException ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                conn.Close();
            }

            btnOrcamento.Click += (object sender, EventArgs e) =>
            {
                var intent = new Intent(this, typeof(MeuOrcamento));
                intent.PutExtra("id", id);
                StartActivity(intent);
                //Finish();
            };

            btnAgendamento.Click += (object sender, EventArgs e) =>
            {
                var intent = new Intent(this, typeof(AgendamentoUsuario));
                intent.PutExtra("id", id);
                StartActivity(intent);
            };

            btnMeusAgedamentos.Click += (object sender, EventArgs e) =>
            {
                var intent = new Intent(this, typeof(MeusAgendamentosCalendario));
                intent.PutExtra("id", id);
                Console.WriteLine("MenuUduario ID = " + id);
                StartActivity(intent);
            };

            btnMateriais.Click += (object sender, EventArgs e) =>
            {
                var intent = new Intent(this, typeof(GridViewMateriais));
                StartActivity(intent);
            };
        }
Exemple #44
0
        protected override void OnNewIntent(Intent intent)
        {
            base.OnNewIntent(intent);

            ActivityMediator.Instance.Send(intent.DataString);
        }
Exemple #45
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            int id = item.ItemId;

            if (id == Resource.Id.nav_HslBottle)
            {
                Intent i = new Intent(this, typeof(Activity_HslBottle));
                this.StartActivity(i);
            }
            else if (id == Resource.Id.nav_HslPipeLine)
            {
                Intent i = new Intent(this, typeof(Activity_HslPipeLine));
                this.StartActivity(i);
            }
            else if (id == Resource.Id.nav_HslValves)
            {
                Intent i = new Intent(this, typeof(Activity_HslValves));
                this.StartActivity(i);
            }
            else if (id == Resource.Id.nav_HslLedDisplay)
            {
                Intent i = new Intent(this, typeof(Activity_HslLedDisplay));
                this.StartActivity(i);
            }
            else if (id == Resource.Id.nav_HslPumpOne)
            {
                Intent i = new Intent(this, typeof(Activity_HslPumpOne));
                this.StartActivity(i);
            }
            else if (id == Resource.Id.nav_HslWaterBox)
            {
                Intent i = new Intent(this, typeof(Activity_HslWaterBox));
                this.StartActivity(i);
            }
            else if (id == Resource.Id.nav_HslStatusManagement)
            {
                Intent i = new Intent(this, typeof(Activity_HslStatusManagement));
                this.StartActivity(i);
            }
            else if (id == Resource.Id.nav_HslClassifier)
            {
                Intent i = new Intent(this, typeof(Activity_HslClassifier));
                this.StartActivity(i);
            }
            else if (id == Resource.Id.nav_HslBattery)
            {
                Intent i = new Intent(this, typeof(Activity_HslBattery));
                this.StartActivity(i);
            }
            else if (id == Resource.Id.nav_HslProgress)
            {
                Intent i = new Intent(this, typeof(Activity_HslProgress));
                this.StartActivity(i);
            }
            else if (id == Resource.Id.nav_HslGanttChart)
            {
                Intent i = new Intent(this, typeof(Activity_HslGanttChart));
                this.StartActivity(i);
            }
            else if (id == Resource.Id.nav_HslLanternSimple)
            {
                Intent i = new Intent(this, typeof(Activity_HslLanternSimple));
                this.StartActivity(i);
            }
            else if (id == Resource.Id.nav_HslGauge)
            {
                Intent i = new Intent(this, typeof(Activity_HslGauge));
                this.StartActivity(i);
            }
            else if (id == Resource.Id.nav_HslPieChart)
            {
                Intent i = new Intent(this, typeof(Activity_HslPieChart));
                this.StartActivity(i);
            }
            else if (id == Resource.Id.nav_HslBarChart)
            {
                Intent i = new Intent(this, typeof(Activity_HslBarChart));
                this.StartActivity(i);
            }
            else if (id == Resource.Id.nav_HslCurve)
            {
                Intent i = new Intent(this, typeof(Activity_HslCurve));
                this.StartActivity(i);
            }
            else if (id == Resource.Id.nav_HslConveyer)
            {
                Intent i = new Intent(this, typeof(Activity_HslConveyer));
                this.StartActivity(i);
            }
            else if (id == Resource.Id.nav_HslThermometer)
            {
                Intent i = new Intent(this, typeof(Activity_HslThermometer));
                this.StartActivity(i);
            }
            else if (id == Resource.Id.nav_HslMotor)
            {
                Intent i = new Intent(this, typeof(Activity_HslMotor));
                this.StartActivity(i);
            }

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

            drawer.CloseDrawer(GravityCompat.Start);
            return(true);
        }
Exemple #46
0
        private async Task ParseAndReturnAsync()
        {
            // Extract the array of name/value results for the field name "weatherObservation".
            Models.Company c = await DbConnection.FetchCompanyAsync(this.Intent.GetStringExtra("Email"));

            // ID=Long.ParseLong(jsonR["ID"]),
            TextView CompanyName = FindViewById <TextView>(Resource.Id.company_name);

            CompanyName.Text = c.CompanyName;
            TextView CompanyFullName = FindViewById <TextView>(Resource.Id.company_fullname);

            CompanyFullName.Text = c.CompanyFullName;
            TextView CompanyAbout = FindViewById <TextView>(Resource.Id.company_about);

            CompanyAbout.Text = c.CompanyAbout;
            TextView ProductsAbout = FindViewById <TextView>(Resource.Id.company_product);

            ProductsAbout.Text = c.ProductsAbout;
            TextView ContactEmail = FindViewById <TextView>(Resource.Id.company_email);

            ContactEmail.Text   = c.ContactEmail;
            ContactEmail.Click += (s, e) =>
            {
                var uri    = Android.Net.Uri.Parse("mailto:" + c.ContactEmail);
                var intent = new Intent(Intent.ActionView, uri);
                StartActivity(intent);
            };
            TextView Phone = FindViewById <TextView>(Resource.Id.company_phone);

            Phone.Text = c.Phone.ToString();
            TextView Adress = FindViewById <TextView>(Resource.Id.company_adres);

            Adress.Text = c.Adress;
            TextView WWW = FindViewById <TextView>(Resource.Id.company_www);

            WWW.Text   = c.www;
            WWW.Click += (s, e) => {
                var uri    = Android.Net.Uri.Parse(c.www);
                var intent = new Intent(Intent.ActionView, uri);
                StartActivity(intent);
            };
            WebView     Youtube = FindViewById <WebView>(Resource.Id.company_youtube);
            WebSettings set     = Youtube.Settings;

            set.JavaScriptEnabled = true;
            Youtube.SetWebChromeClient(new WebChromeClient());
            Youtube.LoadUrl("https://www.youtube.com/embed/" + c.Youtube);
            ImageButton fb = FindViewById <ImageButton>(Resource.Id.company_facebook);

            fb.Click += (s, e) => {
                String uri    = "fb://facewebmodal/f?href=" + c.Facebook;
                Intent intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(uri));
                StartActivity(intent);
            };
            if (c.Facebook == null)
            {
                fb.Visibility = ViewStates.Invisible;
                fb.SetMaxHeight(0);
            }
            ImageButton insta = FindViewById <ImageButton>(Resource.Id.company_instagram);

            insta.Click += (s, e) => {
                String[] tab    = c.Instagram.ToString().Split('/');
                String   uri    = "instagram://user?username="******"http://expotest.somee.com/Images/Company/" + c.CompanyLogo));
            ImageView StandPhoto = FindViewById <ImageView>(Resource.Id.company_standphoto);

            StandPhoto.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/Company/" + c.StandPhoto));
            ImageView Photo1 = FindViewById <ImageView>(Resource.Id.company_photo1);

            Photo1.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/Company/" + c.Photo1));
            ImageView Photo2 = FindViewById <ImageView>(Resource.Id.company_photo2);

            Photo2.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/Company/" + c.Photo2));
            ImageView Photo3 = FindViewById <ImageView>(Resource.Id.company_photo3);

            Photo3.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/Company/" + c.Photo3));
            ImageView Photo4 = FindViewById <ImageView>(Resource.Id.company_photo4);

            Photo4.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/Company/" + c.Photo4));
            ImageView Photo5 = FindViewById <ImageView>(Resource.Id.company_photo5);

            Photo5.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/Company/" + c.Photo5));
            LayoutInflater layoutInflaterAndroid = LayoutInflater.From(this);
            View           popup = layoutInflaterAndroid.Inflate(Resource.Layout.HistoryWindowU, null);

            Android.Support.V7.App.AlertDialog.Builder alertDialogbuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
            alertDialogbuilder.SetView(popup);

            var userContent = popup.FindViewById <EditText>(Resource.Id.History_description);

            alertDialogbuilder.SetCancelable(false)
            .SetPositiveButton("Dodaj", async delegate
            {
                HistoryU h = new HistoryU();
                //h.ID = LDbConnection.GetHistoryUser(this).Count;

                if (LDbConnection.getUserType() == "Uczestnik")
                {
                    h.Description  = userContent.Text;
                    h.User         = LDbConnection.GetUser().ID;
                    h.Expo         = Java.Lang.Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString());
                    h.Wyszukiwanie = this.Intent.GetStringExtra("Search");
                    LDbConnection.InsertHistoryU(h);
                    if (await DbConnection.FetchUserHistoryAsync(h) == true)
                    {
                        Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show();
                    }
                    else
                    {
                        Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show();
                    }
                }
                else if (LDbConnection.getUserType() == "Wystawca")
                {
                    h.Description  = userContent.Text;
                    h.User         = LDbConnection.GetCompany().Id;
                    h.Expo         = Java.Lang.Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString());
                    h.Wyszukiwanie = this.Intent.GetStringExtra("Search");
                    LDbConnection.InsertHistoryU(h);
                    if (await DbConnection.FetchCompanyHistoryAsync(h) == true)
                    {
                        Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show();
                    }
                    else
                    {
                        Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show();
                    }
                }
                Toast.MakeText(this, "Wysłano", ToastLength.Long).Show();
            }
                               ).SetNegativeButton("Zamknij", async delegate
            {
                HistoryU h = new HistoryU();
                //h.ID = LDbConnection.GetHistoryUser(this).Count;

                if (LDbConnection.getUserType() == "Uczestnik")
                {
                    h.Description  = "Skanowanie Nr: " + LDbConnection.GetHistoryUser().Count;
                    h.User         = LDbConnection.GetUser().ID;
                    h.Expo         = Java.Lang.Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString());
                    h.Wyszukiwanie = this.Intent.GetStringExtra("Search");
                    LDbConnection.InsertHistoryU(h);
                    if (await DbConnection.FetchUserHistoryAsync(h) == true)
                    {
                        Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show();
                    }
                    else
                    {
                        Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show();
                    }
                }
                else if (LDbConnection.getUserType() == "Wystawca")
                {
                    h.Description  = "Skanowanie Nr: " + LDbConnection.GetHistoryUser().Count;
                    h.User         = LDbConnection.GetCompany().Id;
                    h.Expo         = Java.Lang.Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString());
                    h.Wyszukiwanie = this.Intent.GetStringExtra("Search");
                    LDbConnection.InsertHistoryU(h);
                    if (await DbConnection.FetchCompanyHistoryAsync(h) == true)
                    {
                        Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show();
                    }
                    else
                    {
                        Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show();
                    }
                }
                alertDialogbuilder.Dispose();
            });
            Android.Support.V7.App.AlertDialog alertDialogAndroid = alertDialogbuilder.Create();
            if (this.Intent.GetBooleanExtra("Show", true))
            {
                alertDialogAndroid.Show();
            }
        }
Exemple #47
0
        // Initiates adapter, viewpager and layout.
        private void InitiateViewPager()
        {
            Dictionary <string, Dictionary <string, string> > answers = JsonConvert.DeserializeObject <Dictionary <string, Dictionary <string, string> > >(Intent.GetStringExtra(resultsKey));
            decimal percentageMatch            = AnalyseAnswers(answers);
            Dictionary <string, Fragment> tabs = new Dictionary <string, Fragment>()
            {
                { "Overview", new OverviewFragment(percentageMatch) },
                { "Answers", new AnswersFragment(answers) }
            };

            ViewPager viewPager = FindViewById <ViewPager>(Resource.Id.view_pager);

            viewPager.Adapter = new ResultsPageAdapter(SupportFragmentManager, tabs);
            viewPager.Adapter.NotifyDataSetChanged();

            TabLayout tabLayout = FindViewById <TabLayout>(Resource.Id.tabs);

            tabLayout.SetupWithViewPager(viewPager);
            tabLayout.GetTabAt(0).SetIcon(Resource.Drawable.baseline_assessment_black_36dp);
            tabLayout.GetTabAt(1).SetIcon(Resource.Drawable.baseline_toc_black_36dp);
        }
        protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if (resultCode == Result.Canceled)
            {
                // Notify user file picking was cancelled.
                OnFilePickCancelled();
                this.Finish();
            }
            else if (requestCode == READ_REQUEST_CODE && resultCode == Result.Ok)
            {
                try
                {
                    ActivityFlags takeFlags = data.Flags & (ActivityFlags.GrantReadUriPermission |
                                                            ActivityFlags.GrantWriteUriPermission);
                    this.context.ContentResolver.TakePersistableUriPermission(data.Data, takeFlags);

                    FilePickerEventArgs args = new FilePickerEventArgs(data.Data.ToString(), this.GetFileName(data.Data), this.ReadData(data.Data));
                    OnFilePicked(args);
                }
                catch (Exception exc)
                {
                    System.Diagnostics.Debug.Write(exc);
                    // Notify user file picking failed.
                    OnFilePickCancelled();
                }
                finally
                {
                    this.Finish();
                }
            }
            else if (requestCode == WRITE_REQUEST_CODE && resultCode == Result.Ok)
            {
                try
                {
                    FilePickerEventArgs args = new FilePickerEventArgs(data.Data.ToString(), this.GetFileName(data.Data), this.data);
                    this.WriteData(data.Data);
                    OnFilePicked(args);
                }
                catch (Exception)
                {
                    // Notify user file picking failed.
                    OnFilePickCancelled();
                }
                finally
                {
                    this.Finish();
                }
            }
        }
		public override IBinder onBind(Intent intent)
		{
			return mBinder;
		}
        private async Task AcquireTokenInternalAsync(IDictionary <string, string> brokerPayload)
        {
            try
            {
                if (brokerPayload.ContainsKey(BrokerParameter.BrokerInstallUrl))
                {
                    _logger.Info("Android Broker - broker payload contains install url");

                    var appLink = AndroidBrokerHelper.GetValueFromBrokerPayload(brokerPayload, BrokerParameter.BrokerInstallUrl);
                    _logger.Info("Android Broker - Starting ActionView activity to " + appLink);
                    _activity.StartActivity(new Intent(Intent.ActionView, AndroidNative.Net.Uri.Parse(appLink)));

                    throw new MsalClientException(
                              MsalError.BrokerApplicationRequired,
                              MsalErrorMessage.BrokerApplicationRequired);
                }
                await _brokerHelper.InitiateBrokerHandshakeAsync(_activity).ConfigureAwait(false);

                brokerPayload[BrokerParameter.BrokerAccountName] = AndroidBrokerHelper.GetValueFromBrokerPayload(brokerPayload, BrokerParameter.Username);

                // Don't send silent background request if account information is not provided
                if (brokerPayload.ContainsKey(BrokerParameter.IsSilentBrokerRequest))
                {
                    _logger.Verbose("User is specified for silent token request. Starting silent broker request.");
                    string silentResult = await _brokerHelper.GetBrokerAuthTokenSilentlyAsync(brokerPayload, _activity).ConfigureAwait(false);

                    if (!string.IsNullOrEmpty(silentResult))
                    {
                        s_androidBrokerTokenResponse = CreateMsalTokenResponseFromResult(silentResult);
                    }
                    else
                    {
                        s_androidBrokerTokenResponse = new MsalTokenResponse
                        {
                            Error            = MsalError.BrokerResponseReturnedError,
                            ErrorDescription = "Failed to acquire token silently from the broker." + MsalErrorMessage.AndroidBrokerCannotBeInvoked,
                        };
                    }
                    return;
                }
                else
                {
                    _logger.Verbose("User is not specified for silent token request");
                }

                _logger.Verbose("Starting Android Broker interactive authentication");

                // onActivityResult will receive the response for this activity.
                // Lauching this activity will switch to the broker app.

                Intent brokerIntent = await _brokerHelper
                                      .GetIntentForInteractiveBrokerRequestAsync(brokerPayload, _activity)
                                      .ConfigureAwait(false);

                if (brokerIntent != null)
                {
                    try
                    {
                        _logger.Info(
                            "Calling activity pid:" + AndroidNative.OS.Process.MyPid()
                            + " tid:" + AndroidNative.OS.Process.MyTid() + "uid:"
                            + AndroidNative.OS.Process.MyUid());

                        _activity.StartActivityForResult(brokerIntent, 1001);
                    }
                    catch (ActivityNotFoundException e)
                    {
                        _logger.ErrorPiiWithPrefix(e, "Unable to get android activity during interactive broker request");
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.ErrorPiiWithPrefix(ex, "Broker invocation failed.");
                throw;
            }

            await s_readyForResponse.WaitAsync().ConfigureAwait(false);
        }
 public override void OnBackPressed()
 {
     intent = new Intent(this, typeof(Activity_Pocetna));
     StartActivity(intent);
 }
 private void MileageBack_Click(object sender, EventArgs e)
 {
     var intent = new Intent(this, typeof(VehicleSelectionActivity));
     StartActivity(intent);
 }
		public override void onPause()
		{
			base.onPause();

			if (mSession != null)
			{
				mSession.onPause();

				if (mSubscriber != null)
				{
					mSubscriberViewContainer.removeView(mSubscriber.View);
				}
			}

			mNotifyBuilder = (new NotificationCompat.Builder(this)).setContentTitle(this.Title).setContentText(Resources.getString([email protected])).setSmallIcon(R.drawable.ic_launcher).setOngoing(true);

			Intent notificationIntent = new Intent(this, typeof(HelloWorldActivity));
			notificationIntent.Flags = Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP;
			PendingIntent intent = PendingIntent.getActivity(this, 0, notificationIntent, 0);

			mNotifyBuilder.ContentIntent = intent;
			if (mConnection == null)
			{
				mConnection = new ServiceConnectionAnonymousInnerClassHelper(this);
			}

			if (!mIsBound)
			{
				bindService(new Intent(HelloWorldActivity.this, typeof(ClearNotificationService)), mConnection, Context.BIND_AUTO_CREATE);
				mIsBound = true;
				startService(notificationIntent);
			}

		}
Exemple #54
0
 public static void RunIntentInService(Context context, Intent intent)
 {
     AcquireWakeLock(context);
     intent.SetClass(context, typeof(PushHandlerService));
     context.StartService(intent);
 }
Exemple #55
0
        protected override async void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);
            if (resultCode == Result.Ok && requestCode == 0)
            {
                string Result = data.GetStringExtra("Result");
                if (Result == "OK")
                {
                    Values.gDatos.DataBase = "LOGISTICA";
                    Values.gDatos.Server = "net.espackeuro.com";
                    Values.gDatos.User = LogonDetails.User;
                    Values.gDatos.Password = LogonDetails.Password;
                    string _mainScreenMode = "NEW";
                    //create sqlite database
                    Values.SQLidb = new SQLiteDatabase("DELIVERIES");
                    if (Values.SQLidb.Exists) //check if database exists
                    {
                        //Values.SQLidb.CreateDatabase(); //link the file to the sqlite database
                        await Values.CreateDatabase(); //create tables if not exist
                        Settings _settings = await Values.SQLidb.db.Table<Settings>().FirstOrDefaultAsync(); //get settings of persistent data
                        if (_settings != null && _settings.User == Values.gDatos.User && _settings.Password == Values.gDatos.Password) //if not empty and user and password matches the logon ones
                        {
                            //var _lastXfec = from r in Values.SQLidb.db.Table<ScannedData>().ToListAsync().Result orderby r.xfec descending select xfec;
                            try
                            {
                                var _lastRecord = await Values.SQLidb.db.QueryAsync<ScannedData>("Select * from ScannedData order by idreg desc limit 1");
                                //ScannedData _lastRecord = await Values.SQLidb.db.Table<ScannedData>().FirstOrDefaultAsync(); //get the last record time added, nullable datetime type
                                if (_lastRecord.Count !=0 && (DateTime.Now - _lastRecord[0].xfec).Minutes < 60) //if time less than one hour
                                {
                                    bool _a1, _a2 = false;
                                    _a1 = await AlertDialogHelper.ShowAsync(this, "Warning", "There are incomplete session data in the device, do you want to continue last session or erase and start a new one?", "ERASE", "CONTINUE SESSION");
                                    if (_a1) //ERASE
                                    {
                                        _a2 = await AlertDialogHelper.ShowAsync(this, "Warning", "This will erase all pending content present in the device, are you sure?", "ERASE", "CONTINUE SESSION");
                                    }
                                    if (!_a1 || !_a2)
                                    {
                                        Values.gSession = _settings.Session;
                                        Values._block = _settings.Block;
                                        Values.gOrderNumber = _settings.Order;
                                        Values.gService = _settings.Service;
                                        _mainScreenMode = "CONTINUE";
                                    } else
                                    {
                                        await Values.EmptyDatabase();
                                        await Values.CreateDatabase();
                                    }
                                }
                                else
                                {
                                    await Values.EmptyDatabase();
                                    await Values.CreateDatabase();
                                }
                            } catch(Exception ex) {
                                Console.WriteLine(ex.Message);
                            }
                        }
                        else
                        {
                            await Values.EmptyDatabase();
                            await Values.CreateDatabase();
                        }
                    }
                    else
                    {
                        await Values.CreateDatabase();
                    }
                    //

                    var intent = new Intent(this, typeof(MainScreen));
                    intent.PutExtra("MainScreenMode", _mainScreenMode);
                    StartActivityForResult(intent, 1);
                    //SetContentView(Resource.Layout.mainLayout);
                }
                else
                {
                    Finish();
                }
            }
            else
            {
                Finish();
            }
        }
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // TODO: Remove on prod? Or put in Application class?
            AndroidEnvironment.UnhandledExceptionRaiser += (sender, e) =>
            {
                Console.WriteLine(e.Exception.Message);
                Console.WriteLine(e.Exception.StackTrace);
            };

            SetContentView(Resource.Layout.Main);

            var toolbar      = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.MainToolbar);
            var drawerLayout = FindViewById <Android.Support.V4.Widget.DrawerLayout>(Resource.Id.MainDrawerLayout);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = "Quick Check In";
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, Resource.String.OpenDrawer, Resource.String.CloseDrawer);
            drawerToggle.DrawerIndicatorEnabled = true;
            drawerLayout.AddDrawerListener(drawerToggle);
            drawerToggle.SyncState();

            var drawerListView = FindViewById <ListView>(Resource.Id.DrawerListView);

            string[] items = { "On Deck", "Trending", "Lists", "History" };
            drawerListView.Adapter    = new ArrayAdapter <String>(this, Android.Resource.Layout.SimpleListItem1, items);
            drawerListView.ItemClick += (sender, e) =>
            {
                Android.Support.V4.App.Fragment fragment = null;

                // TODO: Improve, don't rely on indices
                switch (e.Position)
                {
                case 0:     // On Deck
                    fragment = new OnDeckFragment();
                    break;

                case 1:     // Trending
                    // TODO: Add TrendingFragment
                    break;

                case 2:     // Lists
                    fragment = new ListOverviewFragment();
                    break;

                case 3:     // History
                    fragment = new HistoryFragment();
                    break;
                }

                if (fragment != null)
                {
                    var drawerTransaction = SupportFragmentManager.BeginTransaction();
                    drawerTransaction.Replace(Resource.Id.MainFrameLayout, fragment);
                    drawerTransaction.AddToBackStack(null);                                               // Name?
                    drawerTransaction.Commit();
                    drawerLayout.CloseDrawer(FindViewById <LinearLayout>(Resource.Id.DrawerChildLayout)); // Parameter richtig?
                }
            };

            client = TraktApiHelper.Client;
            if (!client.Authorization.IsValid || (client.Authorization.IsValid && client.Authorization.IsExpired))
            {
                if (client.Authorization.IsRefreshPossible)
                {
                    var traktAuthorization = await client.OAuth.RefreshAuthorizationAsync();

                    TraktApiHelper.SaveAuthorization(traktAuthorization);
                }
                else
                {
                    Intent authorizationIntent = new Intent(this, typeof(AuthorizationActivity));
                    StartActivity(authorizationIntent);
                }
            }

            var logoutTextView = FindViewById <TextView>(Resource.Id.LogoutTextView);

            logoutTextView.Click += (sender, e) =>
            {
                if (client.Authorization == null || !client.Authorization.IsValid)
                {
                    Intent authorizationIntent = new Intent(this, typeof(AuthorizationActivity));
                    StartActivity(authorizationIntent);
                }
                else
                {
                    client.Authorization = null;
                    TraktApiHelper.DeleteAuthorization();
                    logoutTextView.Text = "Login";
                    var usernameTextView = FindViewById <TextView>(Resource.Id.UsernameTextView);
                    usernameTextView.Visibility = ViewStates.Gone;
                    var currentlyWatchingLayout = FindViewById <LinearLayout>(Resource.Id.CurrentlyWatchingLayout);
                    currentlyWatchingLayout.Visibility = ViewStates.Gone;
                }
            };

            var transaction = SupportFragmentManager.BeginTransaction();

            transaction.Add(Resource.Id.MainFrameLayout, new OnDeckFragment());
            transaction.SetTransition((int)FragmentTransit.FragmentOpen);
            // Do not add this transaction to the back stack because then the app would be empty when the user presses back
            transaction.Commit();
        }
        private void OnRegister_Clicked(object sender, EventArgs e)
        {
            var intent = new Intent(this, typeof(Register));

            StartActivity(intent);
        }
Exemple #58
0
 public override IBinder OnBind(Intent intent)
 {
     return(null);
 }
		protected internal override void onActivityResult(int requestCode, int resultCode, Intent data)
		{
			Log.v(TAG, "onActivityResult: " + requestCode + ", " + resultCode + ", " + data);
			base.onActivityResult(requestCode, resultCode, data);
			if (resultCode == RESULT_CANCELED)
			{
				accessEnabler.SelectedProvider = null;
			}
			else if (resultCode == RESULT_OK)
			{
				accessEnabler.AuthenticationToken;
			}
		}
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if (resultCode == KeePass.ResultOkPasswordGenerator)
            {
                String generatedPassword = data.GetStringExtra("keepass2android.password.generated_password");
                FindViewById <TextView>(Resource.Id.entry_password).Text     = generatedPassword;
                FindViewById <TextView>(Resource.Id.entry_confpassword).Text = generatedPassword;
            }

            FileSelectHelper fileSelectHelper = new FileSelectHelper(this, true, true, RequestCodeDbFilename)
            {
                DefaultExtension = "kdbx"
            };

            fileSelectHelper.OnOpen += (sender, info) =>
            {
                _ioc = info;
                (sender as CreateDatabaseActivity ?? this).UpdateIocView();
            };

            if (fileSelectHelper.HandleActivityResult(this, requestCode, resultCode, data))
            {
                return;
            }


            if (resultCode == Result.Ok)
            {
                if (requestCode == RequestCodeKeyFile)
                {
                    if (data.Data.Scheme == "content")
                    {
                        if ((int)Build.VERSION.SdkInt >= 19)
                        {
                            //try to take persistable permissions
                            try
                            {
                                Kp2aLog.Log("TakePersistableUriPermission");
                                var takeFlags = data.Flags
                                                & (ActivityFlags.GrantReadUriPermission
                                                   | ActivityFlags.GrantWriteUriPermission);
                                this.ContentResolver.TakePersistableUriPermission(data.Data, takeFlags);
                            }
                            catch (Exception e)
                            {
                                Kp2aLog.Log(e.ToString());
                            }
                        }
                    }


                    string filename = Util.IntentToFilename(data, this);
                    if (filename == null)
                    {
                        filename = data.DataString;
                    }


                    _keyfileFilename = FileSelectHelper.ConvertFilenameToIocPath(filename);
                    FindViewById <TextView>(Resource.Id.keyfile_filename).Text = _keyfileFilename;
                    FindViewById(Resource.Id.keyfile_filename).Visibility      = ViewStates.Visible;
                }
            }
            if (resultCode == (Result)FileStorageResults.FileUsagePrepared)
            {
                _ioc = new IOConnectionInfo();
                Util.SetIoConnectionFromIntent(_ioc, data);
                UpdateIocView();
            }
            if (resultCode == (Result)FileStorageResults.FileChooserPrepared)
            {
                IOConnectionInfo ioc = new IOConnectionInfo();
                Util.SetIoConnectionFromIntent(ioc, data);

                new FileSelectHelper(this, true, true, RequestCodeDbFilename)
                {
                    DefaultExtension = "kdbx"
                }
                .StartFileChooser(ioc.Path);
            }
        }