private async Task ConnectToServiceAsync(IUICommand command)
 {
     DeviceInformation serviceInfo = (DeviceInformation)command.Id;
     this.State = BluetoothConnectionState.Connecting;
     try
     {
         // Initialize the target Bluetooth RFCOMM device service
         connectService = RfcommDeviceService.FromIdAsync(serviceInfo.Id);
         rfcommService = await connectService;
         if (rfcommService != null)
         {
             // Create a socket and connect to the target 
             socket = new StreamSocket();
             connectAction = socket.ConnectAsync(rfcommService.ConnectionHostName, rfcommService.ConnectionServiceName, SocketProtectionLevel.BluetoothEncryptionAllowNullAuthentication);
             await connectAction;//to make it cancellable
             writer = new DataWriter(socket.OutputStream);
             reader = new DataReader(socket.InputStream);
             Task listen = ListenForMessagesAsync();
             this.State = BluetoothConnectionState.Connected;
         }
         else
             OnExceptionOccuredEvent(this, new Exception("Unable to create service.\nMake sure that the 'bluetooth.rfcomm' capability is declared with a function of type 'name:serialPort' in Package.appxmanifest."));
     }
     catch (TaskCanceledException)
     {
         this.State = BluetoothConnectionState.Disconnected;
     }
     catch (Exception ex)
     {
         this.State = BluetoothConnectionState.Disconnected;
         OnExceptionOccuredEvent(this, ex);
     }
 }
Example #2
0
        private void YesBtnClick(IUICommand command)
        {
            Code c = new Code();
            c.CPRStartTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, int.Parse(txtHour.Text), int.Parse(txtMinute.Text), 0);

            this.Frame.Navigate(typeof(HomePage), c);
        }
Example #3
0
 private static void startTutorial(IUICommand command)
 {
     //if (mapView.Frame != null)
     //{
     //    mapView.Frame.Navigate(typeof(View.TutorialView));
     //}
 }
Example #4
0
 private void OnSetGameType(IUICommand command)
 {
     if (command.Label.Equals("Two player"))
         playerX.IsPerson = true;
     else
         playerX.IsPerson = false;
 }
        private void OnSettingsCommandInvoker(IUICommand command)
        {
            settingsPopup = new Popup();
            settingsPopup.Closed += SettingsPopupOnClosed;
            Window.Current.Activated += OnWindowActivated;
            settingsPopup.IsLightDismissEnabled = true;
            settingsPopup.Width = settingsWidth;
            settingsPopup.Height = windowBounds.Height;

            settingsPopup.ChildTransitions = new TransitionCollection();
            settingsPopup.ChildTransitions.Add(new PaneThemeTransition()
            {
                Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ?
                       EdgeTransitionLocation.Right :
                       EdgeTransitionLocation.Left
            });

            // Create a SettingsFlyout the same dimenssions as the Popup.
            var mypane = new SettingsFlyoutPage
            {
                DataContext = this.Settings
            };

            mypane.Width = settingsWidth;
            mypane.Height = windowBounds.Height;

            settingsPopup.Child = mypane;

            settingsPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (windowBounds.Width - settingsWidth) : 0);
            settingsPopup.SetValue(Canvas.TopProperty, 0);
            settingsPopup.IsOpen = true;            
        }
 void onSettingsCommand(IUICommand command)
 {
     // TODO 2.3: execute the corresponding setting
     //           --> usually based on the SettingsCommand.Id value
     SettingsCommand settingsCommand = (SettingsCommand)command;
     rootPage.NotifyUser("You selected the " + settingsCommand.Label + " settings command", NotifyType.StatusMessage);
 }
 private async void Save_Popup_Yes(IUICommand command)
 {
     var viewModel = DataContext as CreateOrderPageViewModel;
     Tuple<bool,string> answer = viewModel.SaveOrder();
     if (answer.Item1 == false) CreateAndShowMessageDialog(answer.Item2);
     Frame.Navigate(typeof(OrderPage));
 }
Example #8
0
 private async void OpenStoreRating(IUICommand command)
 {
     string name = Package.Current.Id.FamilyName;
     await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-windows-store:REVIEW?PFN=" + name));
     //await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-windows-store:REVIEW?PFN=6b7b722b-a69d-42fc-8fba-f1b30776edec"));
     //SaveAppRatingSetting();
 }
 private static async void CommandInvokedHandler(IUICommand command)
 {
     if (command.Label == Utils.Utils.ResourceLoader.GetString("Text_Review"))
     {
         await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-windows-store:reviewapp?appid=" + CurrentApp.AppId));
     }
 }
Example #10
0
 private void HandlePrivacyPolocySettingsCommand(IUICommand command)
 {
     var settings = new SettingsFlyout();
     settings.Content = new PrivacyPolicySettingsView();
     settings.HeaderText = "Privacy Policy";
     settings.IsOpen = true;
 }
Example #11
0
        private void OnAboutCommand(IUICommand command)
        {
            SettingsPopup = new Popup();
            SettingsPopup.IsLightDismissEnabled = true;
            SettingsPopup.Width = SettingsWidth;
            SettingsPopup.Height = WindowBounds.Height;

            SettingsPopup.ChildTransitions = new TransitionCollection
                                                  {
                                                      new PaneThemeTransition
                                                          {
                                                              Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right)
                                                                         ? EdgeTransitionLocation.Right
                                                                         : EdgeTransitionLocation.Left
                                                          }
                                                  };

            var mypane = new AboutFlyout { Width = SettingsWidth, Height = WindowBounds.Height };

            SettingsPopup.Child = mypane;

            SettingsPopup.SetValue(Canvas.LeftProperty,
                                    SettingsPane.Edge == SettingsEdgeLocation.Right
                                        ? (WindowBounds.Width - SettingsWidth)
                                        : 0);
            SettingsPopup.SetValue(Canvas.TopProperty, 0);
            SettingsPopup.IsOpen = true;
        }
Example #12
0
 private async void CommandInvokedHandler(IUICommand command)
 {
     if (command.Id.ToString() == "0")
     {
         await Execute();
     }
 }
Example #13
0
 static private async void CommandInvokedHandler(IUICommand command)
 {
     messageShown = false;
     if (command.Label == "Submit Feedback")
     {
         await Windows.System.Launcher.LaunchUriAsync(new Uri("mailto:[email protected]?subject=HudlRT%20Feedback"));
     }
 }
Example #14
0
 private void About_Click(IUICommand cmd) {
     SettingsFlyout settings = new SettingsFlyout();
     settings.Background = new SolidColorBrush(Colors.White);
     settings.HeaderBrush = new SolidColorBrush(Colors.Black);
     settings.Content = new AboutPanel();
     settings.HeaderText = "About";
     settings.IsOpen = true;
     RestoreCursor(); }
 private void CommandInvokedHandler(IUICommand command)
 {
     if (command.Label == "Delete")
     {
         App.DataModel.DeleteNote(note);
         Frame.Navigate(typeof(SeeHistory));
     }
 }
Example #16
0
 private void RaiseCompleted(IUICommand command)
 {
     var h = this.Completed;
     if (h != null)
     {
         h(command);
     }
 }
        private void onConfigCommand(IUICommand command)
        {
            var loader = Mvx.Resolve<IMvxViewModelLoader>();
            var vm = loader.LoadViewModel(MvxViewModelRequest<SettingsViewModel>.GetDefaultRequest(), null);
            var configurationPanel = new Views.Settings(vm);
            configurationPanel.Show();

        }
Example #18
0
 public async void CommandInvokedHandler(IUICommand command)
 {
     if (this.unhandledExceptionMessage != null)
     {
         var result = await DataPersister.SendReport(this.unhandledExceptionMessage);
         this.unhandledExceptionMessage = null;
     }
     
 }
        private void replayBtnClick(IUICommand command)
        {
            //Reset counter variables
            play = 0; counterC = 0; counterP = 0;

            //Reset string variables
            player.Text = "0"; computer.Text = "0";
            reset();
        }
 public void CommandHandlers(IUICommand commandLabel)
 {
     var Actions = commandLabel.Label;
     switch (Actions)
     {
         case "Meu GitHub":
             openBrowser();
             break;
     }
 }
Example #21
0
 private void DialogCommandhandler(IUICommand command)
 {
     if (command.Label == "OK")
     {
         var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
         localSettings.Values["TileLatitude"] = this._receivedLatitude;
         localSettings.Values["TileLongtitude"] = this._receivedLongitude;
         localSettings.Values["TileZoom"] = this._receivedZoom;
     }
 }
 private async void YesDeleteCommandInvokedHandler(IUICommand command)
 {
     if (m_oMoveList.Items.Count > 0 && m_oMoveList.SelectedIndex != -1)
     {
         await MoveList.DeleteCurrentMove();
         m_oMoveList.ItemsSource = null;
         m_oMoveList.ItemsSource = MoveList.MoveListCollection;
         m_oMoveList.SelectedItem = null;
     }
 }
private void CommandInvokedHandler(IUICommand command)
{
    if (command.Label == "Yes")
    {
        string loc;
        loc = objLoc.getCurrentLocatino();
        Frame.Navigate(typeof(commentPage));
    }
    throw new NotImplementedException();
} 
Example #24
0
        async void OnSettingsCommand(IUICommand command)
        {
            Messenger.Default.Send<OverlayDialogMessage>(new OverlayDialogMessage()
            {
                Showing = true
            });
            
            // BUGFIX: Delay in the webview screenshotting process. Allows for
            // UI repaint.
            await Task.Delay(100);

            double settingsWidth = 346;
            double settingsHeight = Window.Current.Bounds.Height;

            // Create a Popup window which will contain our flyout.
            settingsPopup = new Popup()
            {
                IsLightDismissEnabled = true,
                Width = settingsWidth,
                Height = settingsHeight
            };

            // Add the proper animation for the panel.
            settingsPopup.ChildTransitions = new TransitionCollection();
            settingsPopup.ChildTransitions.Add(new PaneThemeTransition()
            {
                Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ?
                       EdgeTransitionLocation.Right :
                       EdgeTransitionLocation.Left
            });

            // Create a SettingsFlyout the same dimenssions as the Popup.
            SettingsFlyoutView settingsFlyout = new SettingsFlyoutView()
            {
                Width = settingsWidth,
                Height = settingsHeight
            };

            // Place the SettingsFlyout inside our Popup window.
            settingsPopup.Child = settingsFlyout;

            // Let's define the location of our Popup.
            settingsPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (Window.Current.Bounds.Width - settingsWidth) : 0);
            settingsPopup.SetValue(Canvas.TopProperty, 0);
            settingsPopup.IsOpen = true;

            settingsPopup.Closed += delegate
            {
                Messenger.Default.Send<OverlayDialogMessage>(new OverlayDialogMessage()
                {
                    Showing = false
                });
            };
        }
Example #25
0
        private void HandleProfileSettingsCommandRequest(IUICommand command)
        {
            var settings = new SettingsFlyout();
            settings.Content = settingsView;
            settingsView.DataContext = settingsViewModel;
            settingsViewModel.LoadProperties();
            settingsViewModel.PictureReceived += (sender, args) => HandleProfileSettingsCommandRequest(command);
            settings.HeaderText = "Profile Settings";
            settings.IsOpen = true;

        }
        private async static void rate_RateNow_Click(IUICommand command)
        {
            AppSettings.StoreSettingBool(Constants.FeedbackReminderSetting, false);
            string familyName = Package.Current.Id.FamilyName;
#if DEBUG
            await Launcher.LaunchUriAsync(new Uri("http://dev.windows.com"));
#else
            await Launcher.LaunchUriAsync(new Uri(string.Format("ms-windows-store:REVIEW?PFN={0}", familyName)));
#endif

        }
Example #27
0
        private  void dO2(IUICommand command)
        {
           about.IsOpen = true;
           about.FlyoutWidth = 600;
            about.Width=200;
           about.Heading = "[email protected]";
            
        


        }
Example #28
0
        /// <summary>Initializes a new instance of DialogButton.</summary>
        /// <param name="command">The associated UI command.</param>
        /// <param name="dialogHost">The assoicated dialog host.</param>
        internal DialogButton(IUICommand command, IDialogHost dialogHost)
        {
            if (command == null) throw new ArgumentNullException("command");
            if (dialogHost == null) throw new ArgumentNullException("dialogHost");
            Debug.Assert(command is IHasDialogResult);
            Debug.Assert(command is INotifyPropertyChanged);
            Debug.Assert(command is IInvokeCommand);

            _command = command;
            _dialogHost = dialogHost;
            ((INotifyPropertyChanged) _command).PropertyChanged += CommandPropertyChanged;
        }
Example #29
0
        public void CommandInvokedHandlerInternet(IUICommand command)
        {         
            if (command.Label == "Try again")
            {
             
            }
            else
            {
              Application.Current.Exit();
            }

        }
Example #30
0
 private void OnCommandAct(IUICommand command)
 {
     int cmdid = (int)command.Id;
     if(cmdid == 1)
     {
         result.Text = "您已经确认执行任务";
     }
     else
     {
         result.Text = "您已经放弃执行任务";
     }
 }