Beispiel #1
0
        private void SlideCommandHandler(object parameter)
        {
            Reveal.Stop();
            Hide.Stop();

            if (parameter is bool)
            {
                if (!_shouldShow)
                {
                    Hide.Begin();
                    _shouldShow = true;
                }

                return;
            }

            if (_shouldShow)
            {
                Reveal.Begin();
            }
            else
            {
                Hide.Begin();
            }

            _shouldShow = !_shouldShow;
        }
Beispiel #2
0
 private void Show_Completed(object sender, object e)
 {
     if (gloablvalue.DeviceState == "-2")
     {
         Show.Stop();
         Hide.Stop();
         Devicestate_txt.Text    = "An error occurred, try again.";
         ConnectBTN.Content      = "connect";
         ConnectBTN.Tag          = "connect";
         ConnectBTN.IsEnabled    = true;
         gloablvalue.DeviceState = "-1";
     }
     else if (gloablvalue.DeviceState == "-1")
     {
         Hide.Begin();
     }
     else if (gloablvalue.DeviceState == "0")
     {
         Show.Stop();
         Hide.Stop();
         Devicestate_txt.Text    = "' " + gloablvalue.DeviceName + " ' " + " Dissconnected";
         ConnectBTN.Content      = "connect";
         ConnectBTN.Tag          = "connect";
         ConnectBTN.IsEnabled    = true;
         gloablvalue.DeviceState = "-1";
     }
     else if (gloablvalue.DeviceState == "1")
     {
         Show.Stop();
         Hide.Stop();
         Devicestate_txt.Text = "' " + gloablvalue.DeviceName + " ' " + " Connected";
         ConnectBTN.Content   = "Dissconnect";
         ConnectBTN.Tag       = "Dissconnect";
         ConnectBTN.IsEnabled = true;
         //await BluetoothConnection.SendCommand("*");
         newrec_txt.Text = gloablvalue.checksend(gloablvalue.RecivedText);
     }
     else if (gloablvalue.DeviceState == "2")
     {
         Show.Stop();
         Hide.Stop();
         Devicestate_txt.Text    = "' " + gloablvalue.DeviceName + " ' " + " Bluetooth device not found, try again.";
         ConnectBTN.Content      = "connect";
         ConnectBTN.Tag          = "connect";
         ConnectBTN.IsEnabled    = true;
         gloablvalue.DeviceState = "-1";
     }
     else if (gloablvalue.DeviceState == "3")
     {
         Show.Stop();
         Hide.Stop();
         Devicestate_txt.Text    = "Not found any device paired, try again.";
         ConnectBTN.Content      = "connect";
         ConnectBTN.Tag          = "connect";
         ConnectBTN.IsEnabled    = true;
         gloablvalue.DeviceState = "-1";
     }
 }
Beispiel #3
0
 public void Stop()
 {
     try
     {
         Busy1.IsActive = Busy2.IsActive = false;
         Hide.Begin();
     }
     catch { }
 }
Beispiel #4
0
 private void ToggleCard()
 {
     if (shown == true)
     {
         Hide.Begin();
         shown = false;
     }
     else
     {
         Reveal.Begin();
         shown = true;
     }
 }
Beispiel #5
0
 private async void ConnectBTN_Click(object sender, RoutedEventArgs e)
 {
     if (txtbxDeviceName.Text != "")
     {
         if (ConnectBTN.Tag.ToString() == "connect")
         {
             gloablvalue.DeviceName = txtbxDeviceName.Text;
             ConnectBTN.IsEnabled   = false;
             if (gloablvalue.DeviceState == "-1")//device not connect
             {
                 BluetoothConnection.ConnectToDevice();
                 Devicestate_txt.Text = "Connecting...";
                 newrec_txt.Text      = gloablvalue.checksend(gloablvalue.RecivedText);
                 Hide.Begin();
             }
         }
         else if (ConnectBTN.Tag.ToString() == "Dissconnect")
         {
             if (gloablvalue.DeviceState == "1")//device connected
             {
                 ConnectBTN.IsEnabled = false;
                 try
                 {
                     BluetoothConnection.CloseDevice();
                     Devicestate_txt.Text = "' " + gloablvalue.DeviceName + " ' " + " Dissconnected";
                     ConnectBTN.Content   = "connect";
                     ConnectBTN.Tag       = "connect";
                     ConnectBTN.IsEnabled = true;
                     //gloablvalue.DeviceState = "-1";
                 }
                 catch (Exception)
                 {
                     // ...
                 }
             }
         }
     }
     else
     {
         var dlg = new MessageDialog("please type a device name..");
         await dlg.ShowAsync();
     }
 }
Beispiel #6
0
 private void OnManipulationCompleted(GestureRecognizer sender, ManipulationCompletedEventArgs args)
 {
     Hide.Begin();
     _shouldShow = true;
 }