Exemplo n.º 1
0
        // ----------------------------------------------------------------------------------------------------

        private void BtnWriteLaunchApp_Click(object sender, RoutedEventArgs e)
        {
            // Create a new LaunchApp record to launch this app
            // The app will print the arguments when it is launched (see MainPage.OnNavigatedTo() method)
            var record = new NdefLaunchAppRecord { Arguments = "Hello World" };
            // WindowsPhone is the pre-defined platform ID for WP8.
            // You can get the application ID from the WMAppManifest.xml file
            record.AddPlatformAppId("WindowsPhone", "{544ec154-b521-4d73-9405-963830adb213}");
            // The app platform for a Windows 8 computer is Windows. 
            // The format of the proximity app Id is <package family name>!<app Id>. 
            // You can get the package family name from the Windows.ApplicationModel.Package.Current.Id.FamilyName property. 
            // You must copy the app Id value from the Id attribute of the Application element in the 
            // package manifest for your app.
            record.AddPlatformAppId("Windows", Windows.ApplicationModel.Package.Current.Id.FamilyName + "!" + "NdefDemoWin");

            // Publish the record using the proximity device
            PublishRecord(record, true);
        }
Exemplo n.º 2
0
        private void map_Click(object sender, System.Windows.RoutedEventArgs e)
        {

            //Sup = 1;
            var record = new NdefLaunchAppRecord { Arguments = "map1234" };
            // WindowsPhone is the pre-defined platform ID for WP8.
            // You can get the application ID from the WMAppManifest.xml file
            record.AddPlatformAppId("WindowsPhone", "{544ec154-b521-4d73-9405-963830adb213}");
            // Publish the record using the proximity device
            recordresult = record.Arguments;
            PublishRecord(record, true);




        }
Exemplo n.º 3
0
        private async void ListenBtn_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            Sup = 0;
            if(check==false){
                check = true;
                SetStatusOutput(string.Format("RECORDING"));
            // Start speech recognition and wait for the async process to finish
            var recoResult = await _recognizer.RecognizeAsync();
            // Inform the user about the result and the next steps
            SetStatusOutput(string.Format("You said \"{0}\"\nPlease touch a tag to write the message.", recoResult.Text));
            // Create a LaunchApp record, specifying our recognized text as arguments
         
           var record = new NdefLaunchAppRecord { Arguments = recoResult.Text };
            // Add the app ID of your app!
          record.AddPlatformAppId("WindowsPhone", "{544ec154-b521-4d73-9405-963830adb213}");
            // Wrap the record into a message, which can be written to a tag       

            recordresult = recoResult.Text;
            PublishRecord(record, true);
            check = false;
            Sup = 1;
            }
           
        }
Exemplo n.º 4
0
 private void BtnWriteLaunchApp_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     Sup = 0;
     // Create a new LaunchApp record to launch this app
     // The app will print the arguments when it is launched (see MainPage.OnNavigatedTo() method)
     var record = new NdefLaunchAppRecord { Arguments = write_to_tag_box.Text};
     // WindowsPhone is the pre-defined platform ID for WP8.
     // You can get the application ID from the WMAppManifest.xml file
     record.AddPlatformAppId("WindowsPhone", "{544ec154-b521-4d73-9405-963830adb213}");
     // Publish the record using the proximity device
     recordresult = record.Arguments;
     PublishRecord(record, true);
     Sup = 1;
    
 }
Exemplo n.º 5
0
        private NdefRecord GetPublishingMessage(Type type, string data)
        {
            NdefRecord retValue = null;

            if (type == typeof(NdefTextRecord))
            {
                var oRecord = new NdefTextRecord();
                oRecord.Text = data;
                retValue = oRecord;
            }
            else if (type == typeof(NdefSpRecord))
            {
                var oRecord = new NdefSpRecord();
                //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Uri:" + oRecord.Uri + ")");
            }
            else if (type == typeof(NdefUriRecord))
            {
                var oRecord = new NdefUriRecord();
                //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Uri:" + oRecord.Uri + ")");
            }
            else if (type == typeof(NdefTelRecord))
            {
                var oRecord = new NdefTelRecord();
                //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Tel:" + oRecord.TelNumber + ")");
            }
            else if (type == typeof(NdefMailtoRecord))
            {
                var oRecord = new NdefMailtoRecord();
                //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Subject:" + oRecord.Subject + ")");
            }
            else if (type == typeof(NdefAndroidAppRecord))
            {
                var oRecord = new NdefAndroidAppRecord();
                //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Package:" + oRecord.PackageName + ")");
            }
            else if (type == typeof(NdefLaunchAppRecord))
            {
                var oRecord = new NdefLaunchAppRecord();         
     
                string praid = CoreApplication.Id; // The Application Id value from your package.appxmanifest.
                string appName = Package.Current.Id.FamilyName + "!" + praid;

                NdefLaunchAppRecord launch = new NdefLaunchAppRecord();
                launch.AddPlatformAppId("Windows", appName);
                launch.Arguments = data;
                retValue = oRecord;
            }
            else if (type == typeof(NdefSmsRecord))
            {
                var oRecord = new NdefSmsRecord();
                //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Sms:" + oRecord.SmsBody + ")");
            }
            else if (type == typeof(NdefSmartUriRecord))
            {
                var oRecord = new NdefSmartUriRecord();
                //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Uri:" + oRecord.Uri + ")");
            }
            else
            {
                //
            }

            return retValue;
        }
Exemplo n.º 6
0
        // ----------------------------------------------------------------------------------------------------

        private void BtnWriteLaunchApp_Click(object sender, RoutedEventArgs e)
        {
            // Create a new LaunchApp record to launch this app
            // The app will print the arguments when it is launched (see MainPage.OnNavigatedTo() method)
            var record = new NdefLaunchAppRecord { Arguments = "Hello World" };

            // WindowsPhone is the pre-defined platform ID for WP8.
            // You can get the application ID from the WMAppManifest.xml file
            //record.AddPlatformAppId("WindowsPhone", "{544ec154-b521-4d73-9405-963830adb213}");

            // The app platform for a Windows 8 computer is Windows. 
            // The format of the proximity app Id is <package family name>!<app Id>. 
            // You can get the package family name from the Windows.ApplicationModel.Package.Current.Id.FamilyName property. 
            // You must copy the app Id value from the Id attribute of the Application element in the 
            // package manifest for your app.

            var familyName = Windows.ApplicationModel.Package.Current.Id.FamilyName;
            //var appId = Windows.ApplicationModel.Store.CurrentApp.AppId;    // Crashes when app is not installed from the app store!
            var appId = "8bf48432-f9c8-48cd-a014-c44d868347dc";
            // Issue on Windows 10: http://stackoverflow.com/questions/34221812/how-to-launch-my-app-via-nfc-tag
            // Issue on Windows 10: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/c9653f06-0d48-498f-9b3e-335435780fd4/cw81windows-81-app-license-error-0x803f6107?forum=wpdevelop
            record.AddPlatformAppId("Windows", "{" + familyName + "!" + appId + "}");
            record.AddPlatformAppId("WindowsPhone", appId);

            // Publish the record using the proximity device
            PublishRecord(record, true);
        }