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);
     }
 }
 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 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;            
        }
Esempio n. 4
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);
        }
 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));
 }
Esempio n. 6
0
 private static void startTutorial(IUICommand command)
 {
     //if (mapView.Frame != null)
     //{
     //    mapView.Frame.Navigate(typeof(View.TutorialView));
     //}
 }
Esempio n. 7
0
 private void OnSetGameType(IUICommand command)
 {
     if (command.Label.Equals("Two player"))
         playerX.IsPerson = true;
     else
         playerX.IsPerson = false;
 }
Esempio n. 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();
 }
Esempio n. 9
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;
        }
Esempio n. 10
0
 private void HandlePrivacyPolocySettingsCommand(IUICommand command)
 {
     var settings = new SettingsFlyout();
     settings.Content = new PrivacyPolicySettingsView();
     settings.HeaderText = "Privacy Policy";
     settings.IsOpen = true;
 }
Esempio n. 11
0
 private async void CommandInvokedHandler(IUICommand command)
 {
     if (command.Id.ToString() == "0")
     {
         await Execute();
     }
 }
 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));
     }
 }
Esempio n. 13
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 onConfigCommand(IUICommand command)
        {
            var loader = Mvx.Resolve<IMvxViewModelLoader>();
            var vm = loader.LoadViewModel(MvxViewModelRequest<SettingsViewModel>.GetDefaultRequest(), null);
            var configurationPanel = new Views.Settings(vm);
            configurationPanel.Show();

        }
Esempio n. 15
0
 private void RaiseCompleted(IUICommand command)
 {
     var h = this.Completed;
     if (h != null)
     {
         h(command);
     }
 }
 private void CommandInvokedHandler(IUICommand command)
 {
     if (command.Label == "Delete")
     {
         App.DataModel.DeleteNote(note);
         Frame.Navigate(typeof(SeeHistory));
     }
 }
Esempio n. 17
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"));
     }
 }
        private void replayBtnClick(IUICommand command)
        {
            //Reset counter variables
            play = 0; counterC = 0; counterP = 0;

            //Reset string variables
            player.Text = "0"; computer.Text = "0";
            reset();
        }
Esempio n. 19
0
 public async void CommandInvokedHandler(IUICommand command)
 {
     if (this.unhandledExceptionMessage != null)
     {
         var result = await DataPersister.SendReport(this.unhandledExceptionMessage);
         this.unhandledExceptionMessage = null;
     }
     
 }
 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;
     }
 }
 public void CommandHandlers(IUICommand commandLabel)
 {
     var Actions = commandLabel.Label;
     switch (Actions)
     {
         case "Meu GitHub":
             openBrowser();
             break;
     }
 }
Esempio n. 22
0
private void CommandInvokedHandler(IUICommand command)
{
    if (command.Label == "Yes")
    {
        string loc;
        loc = objLoc.getCurrentLocatino();
        Frame.Navigate(typeof(commentPage));
    }
    throw new NotImplementedException();
} 
Esempio n. 23
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;
     }
 }
Esempio n. 24
0
        private  void dO2(IUICommand command)
        {
           about.IsOpen = true;
           about.FlyoutWidth = 600;
            about.Width=200;
           about.Heading = "*****@*****.**";
            
        


        }
Esempio n. 25
0
        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

        }
Esempio n. 26
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
                });
            };
        }
Esempio n. 27
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;

        }
Esempio n. 28
0
 private void OnCommandAct(IUICommand command)
 {
     int cmdid = (int)command.Id;
     if(cmdid == 1)
     {
         result.Text = "您已经确认执行任务";
     }
     else
     {
         result.Text = "您已经放弃执行任务";
     }
 }
Esempio n. 29
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;
        }
Esempio n. 30
0
        public void CommandInvokedHandlerInternet(IUICommand command)
        {         
            if (command.Label == "Try again")
            {
             
            }
            else
            {
              Application.Current.Exit();
            }

        }
Esempio n. 31
0
        private async void btnGenerateExcel_Click(object sender, RoutedEventArgs e)
        {
            StorageFile storageFile;

            if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
            {
                FileSavePicker savePicker = new FileSavePicker();
                savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
                savePicker.SuggestedFileName      = "Edit";
                if (rdBtnXls.IsChecked.Value)
                {
                    savePicker.FileTypeChoices.Add("Excel Files", new List <string>()
                    {
                        ".xls"
                    });
                }
                else if (rdBtnXltm.IsChecked.Value)
                {
                    savePicker.FileTypeChoices.Add("Excel Files", new List <string>()
                    {
                        ".xltm"
                    });
                }
                else
                {
                    savePicker.FileTypeChoices.Add("Excel Files", new List <string>()
                    {
                        ".xlsm",
                    });
                }
                storageFile = await savePicker.PickSaveFileAsync();
            }
            else
            {
                StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
                if (rdBtnXls.IsChecked.Value)
                {
                    storageFile = await local.CreateFileAsync("Edit.xls", CreationCollisionOption.ReplaceExisting);
                }
                else if (rdBtnXltm.IsChecked.Value)
                {
                    storageFile = await local.CreateFileAsync("Edit.xltm", CreationCollisionOption.ReplaceExisting);
                }
                else
                {
                    storageFile = await local.CreateFileAsync("Edit.xlsm", CreationCollisionOption.ReplaceExisting);
                }
            }

            if (storageFile == null)
            {
                return;
            }

            //Step 1 : Instantiate the spreadsheet creation engine.
            ExcelEngine excelEngine = new ExcelEngine();
            //Step 2 : Instantiate the excel application object.
            IApplication application = excelEngine.Excel;

            Assembly  assembly     = typeof(EditMacro).GetTypeInfo().Assembly;
            string    resourcePath = "Syncfusion.SampleBrowser.UWP.XlsIO.XlsIO.Tutorials.Samples.Assets.Resources.Templates.EditMacroTemplate.xltm";
            Stream    fileStream   = assembly.GetManifestResourceStream(resourcePath);
            IWorkbook workbook     = await application.Workbooks.OpenAsync(fileStream);

            workbook.Version = ExcelVersion.Excel2016;

            #region VbaProject
            //Access Vba Project from workbook
            IVbaProject vbaProject = workbook.VbaProject;
            IVbaModule  vbaModule  = vbaProject.Modules["Module1"];
            vbaModule.Code = vbaModule.Code.Replace("xlAreaStacked", "xlLine");
            #endregion


            #region Saving the workbook
            ExcelSaveType type = ExcelSaveType.SaveAsMacro;

            if (storageFile.Name.EndsWith(".xls"))
            {
                workbook.Version = ExcelVersion.Excel97to2003;
                type             = ExcelSaveType.SaveAsMacro;
            }
            else if (storageFile.Name.EndsWith(".xltm"))
            {
                type = ExcelSaveType.SaveAsMacroTemplate;
            }

            await workbook.SaveAsAsync(storageFile, type);

            workbook.Close();
            excelEngine.Dispose();
            #endregion

            #region Launching the saved workbook
            MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");

            UICommand yesCmd = new UICommand("Yes");
            msgDialog.Commands.Add(yesCmd);
            UICommand noCmd = new UICommand("No");
            msgDialog.Commands.Add(noCmd);
            IUICommand cmd = await msgDialog.ShowAsync();

            if (cmd == yesCmd)
            {
                // Launch the saved file
                bool success = await Windows.System.Launcher.LaunchFileAsync(storageFile);
            }
            #endregion
        }
Esempio n. 32
0
 public static async void CommandInvokedHandler(IUICommand command)
 {
     await Launcher.LaunchUriAsync(new Uri("ms-windows-store://home"));
 }
Esempio n. 33
0
 /// <summary>
 /// Command handlers for the ok dialog.
 /// </summary>
 /// <param name="commandLabel">The command selected by the user.</param>
 private static void CommandOk(IUICommand commandLabel)
 {
 }
Esempio n. 34
0
 private void CommandInvokedHandler(IUICommand command)
 {
     localSettings.Values["ok"] = "ok";
 }
Esempio n. 35
0
        private async void btnGenerateExcel_Click(object sender, RoutedEventArgs e)
        {
            StorageFile storageFile;

            if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
            {
                FileSavePicker savePicker = new FileSavePicker();
                savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
                savePicker.SuggestedFileName      = "DataValidationSample";
                if (rdBtn2003.IsChecked.Value)
                {
                    savePicker.FileTypeChoices.Add("Excel Files", new List <string>()
                    {
                        ".xls"
                    });
                }
                else
                {
                    savePicker.FileTypeChoices.Add("Excel Files", new List <string>()
                    {
                        ".xlsx",
                    });
                }
                storageFile = await savePicker.PickSaveFileAsync();
            }
            else
            {
                StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
                if (rdBtn2003.IsChecked.Value)
                {
                    storageFile = await local.CreateFileAsync("DataValidationSample.xls", CreationCollisionOption.ReplaceExisting);
                }
                else
                {
                    storageFile = await local.CreateFileAsync("DataValidationSample.xlsx", CreationCollisionOption.ReplaceExisting);
                }
            }


            if (storageFile == null)
            {
                return;
            }
            //Instantiate excel Engine
            ExcelEngine  excelEngine = new ExcelEngine();
            IApplication application = excelEngine.Excel;

            if (rdBtn2003.IsChecked.Value)
            {
                application.DefaultVersion = ExcelVersion.Excel97to2003;
            }
            else
            {
                application.DefaultVersion = ExcelVersion.Excel2013;
            }

            IWorkbook  workbook = application.Workbooks.Create(1);
            IWorksheet sheet    = workbook.Worksheets[0];

            //Data validation to list the values in the first cell
            IDataValidation validation = sheet.Range["C7"].DataValidation;

            sheet.Range["B7"].Text = "Select an item from the validation list";

            validation.ListOfValues       = new string[] { "PDF", "XlsIO", "DocIO" };
            validation.PromptBoxText      = "Data Validation list";
            validation.IsPromptBoxVisible = true;
            validation.ShowPromptBox      = true;

            sheet.Range["C7"].CellStyle.Borders.LineStyle = ExcelLineStyle.Medium;
            sheet.Range["C7"].CellStyle.Borders[ExcelBordersIndex.DiagonalDown].ShowDiagonalLine = false;
            sheet.Range["C7"].CellStyle.Borders[ExcelBordersIndex.DiagonalUp].ShowDiagonalLine   = false;

            // Data Validation for Numbers
            IDataValidation validation1 = sheet.Range["C9"].DataValidation;

            sheet.Range["B9"].Text      = "Enter a Number to validate";
            validation1.AllowType       = ExcelDataType.Integer;
            validation1.CompareOperator = ExcelDataValidationComparisonOperator.Between;
            validation1.FirstFormula    = "0";
            validation1.SecondFormula   = "10";
            validation1.ShowErrorBox    = true;
            validation1.ErrorBoxText    = "Value must be between 0 and 10";
            validation1.ErrorBoxTitle   = "ERROR";
            validation1.PromptBoxText   = "Value must be between 0 and 10";
            validation1.ShowPromptBox   = true;
            sheet.Range["C9"].CellStyle.Borders.LineStyle = ExcelLineStyle.Medium;
            sheet.Range["C9"].CellStyle.Borders[ExcelBordersIndex.DiagonalDown].ShowDiagonalLine = false;
            sheet.Range["C9"].CellStyle.Borders[ExcelBordersIndex.DiagonalUp].ShowDiagonalLine   = false;

            // Data Validation for Date
            IDataValidation validation2 = sheet.Range["C11"].DataValidation;

            sheet.Range["B11"].Text     = "Enter the Date to validate";
            validation2.AllowType       = ExcelDataType.Date;
            validation2.CompareOperator = ExcelDataValidationComparisonOperator.Between;
            validation2.FirstDateTime   = new DateTime(2012, 1, 1);
            validation2.SecondDateTime  = new DateTime(2012, 12, 31);
            validation2.ShowErrorBox    = true;
            validation2.ErrorBoxText    = "Value must be from 01/1/2012 to 31/12/2012";
            validation2.ErrorBoxTitle   = "ERROR";
            validation2.PromptBoxText   = "Value must be from 01/1/2012 to 31/12/2012";
            validation2.ShowPromptBox   = true;
            sheet.Range["C11"].CellStyle.Borders.LineStyle = ExcelLineStyle.Medium;
            sheet.Range["C11"].CellStyle.Borders[ExcelBordersIndex.DiagonalDown].ShowDiagonalLine = false;
            sheet.Range["C11"].CellStyle.Borders[ExcelBordersIndex.DiagonalUp].ShowDiagonalLine   = false;

            // Data Validation for TextLength
            IDataValidation validation3 = sheet.Range["C13"].DataValidation;

            sheet.Range["B13"].Text     = "Enter the Text to validate";
            validation3.AllowType       = ExcelDataType.TextLength;
            validation3.CompareOperator = ExcelDataValidationComparisonOperator.Between;
            validation3.FirstFormula    = "1";
            validation3.SecondFormula   = "6";
            validation3.ShowErrorBox    = true;
            validation3.ErrorBoxText    = "Maximum 6 characters are allowed";
            validation3.ErrorBoxTitle   = "ERROR";
            validation3.PromptBoxText   = "Maximum 6 characters are allowed";
            validation3.ShowPromptBox   = true;
            sheet.Range["C13"].CellStyle.Borders.LineStyle = ExcelLineStyle.Medium;
            sheet.Range["C13"].CellStyle.Borders[ExcelBordersIndex.DiagonalDown].ShowDiagonalLine = false;
            sheet.Range["C13"].CellStyle.Borders[ExcelBordersIndex.DiagonalUp].ShowDiagonalLine   = false;

            // Data Validation for Time
            IDataValidation validation4 = sheet.Range["C15"].DataValidation;

            sheet.Range["B15"].Text     = "Enter the Time to validate";
            validation4.AllowType       = ExcelDataType.Time;
            validation4.CompareOperator = ExcelDataValidationComparisonOperator.Between;
            validation4.FirstFormula    = "10";
            validation4.SecondFormula   = "12";
            validation4.ShowErrorBox    = true;
            validation4.ErrorBoxText    = "Time must be between 10 and 12";
            validation4.ErrorBoxTitle   = "ERROR";
            validation4.PromptBoxText   = "Time must be between 10 and 12";
            validation4.ShowPromptBox   = true;
            sheet.Range["C15"].CellStyle.Borders.LineStyle = ExcelLineStyle.Medium;
            sheet.Range["C15"].CellStyle.Borders[ExcelBordersIndex.DiagonalDown].ShowDiagonalLine = false;
            sheet.Range["C15"].CellStyle.Borders[ExcelBordersIndex.DiagonalUp].ShowDiagonalLine   = false;
            sheet.Range["B2:C2"].Merge();
            sheet.Range["B2"].Text = "Simple Data validation";
            sheet.Range["B5"].Text = "Validation criteria";
            sheet.Range["C5"].Text = "Validation";
            sheet.Range["B5"].CellStyle.Font.Bold           = true;
            sheet.Range["C5"].CellStyle.Font.Bold           = true;
            sheet.Range["B2"].CellStyle.Font.Bold           = true;
            sheet.Range["B2"].CellStyle.Font.Size           = 16;
            sheet.Range["B2"].CellStyle.HorizontalAlignment = ExcelHAlign.HAlignCenter;
            sheet.AutofitColumn(2);
            sheet["B7"].ColumnWidth = 40.3;
            sheet.UsedRange.AutofitRows();

            await workbook.SaveAsAsync(storageFile);

            workbook.Close();
            excelEngine.Dispose();

            MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");

            UICommand yesCmd = new UICommand("Yes");

            msgDialog.Commands.Add(yesCmd);
            UICommand noCmd = new UICommand("No");

            msgDialog.Commands.Add(noCmd);
            IUICommand cmd = await msgDialog.ShowAsync();

            if (cmd == yesCmd)
            {
                // Launch the saved file
                bool success = await Windows.System.Launcher.LaunchFileAsync(storageFile);
            }
        }
 private void OnInvoked(IUICommand target, ICallback callback)
 {
     callback.Invoke(DialogModuleHelper.ActionButtonClicked, target.Id);
 }
        private async void btnGenerateExcel_Click(object sender, RoutedEventArgs e)
        {
            #region Workbook initialization
            //New instance of XlsIO is created.[Equivalent to launching MS Excel with no workbooks open].
            //The instantiation process consists of two steps.

            ExcelEngine  excelEngine = new ExcelEngine();
            IApplication application = excelEngine.Excel;

            application.DefaultVersion = ExcelVersion.Excel2013;

            IWorkbook workbook = application.Workbooks.Create(1);
            //The first worksheet object in the worksheets collection is accessed.
            IWorksheet worksheet = workbook.Worksheets[0];

            IList <Brands> list = GetVehicleDetails();

            ExcelImportDataOptions importDataOptions = new ExcelImportDataOptions();
            importDataOptions.FirstRow = 4;

            if (comboBox1.SelectedIndex == 0)
            {
                importDataOptions.NestedDataLayoutOptions = ExcelNestedDataLayoutOptions.Default;
            }
            else if (comboBox1.SelectedIndex == 1)
            {
                importDataOptions.NestedDataLayoutOptions = ExcelNestedDataLayoutOptions.Merge;
            }
            else if (comboBox1.SelectedIndex == 2)
            {
                importDataOptions.NestedDataLayoutOptions = ExcelNestedDataLayoutOptions.Repeat;
            }

            if (checkbox1.IsChecked.Value)
            {
                if (rdbExpand.IsChecked.Value)
                {
                    importDataOptions.NestedDataGroupOptions = ExcelNestedDataGroupOptions.Expand;
                }
                else if (rdbCollapse.IsChecked.Value)
                {
                    importDataOptions.NestedDataGroupOptions = ExcelNestedDataGroupOptions.Collapse;
                    if (levelTextBox.Text != string.Empty)
                    {
                        importDataOptions.CollapseLevel = int.Parse(levelTextBox.Text);
                    }
                }
            }

            worksheet.ImportData(list, importDataOptions);

            #region Define Styles
            IStyle pageHeader  = workbook.Styles.Add("PageHeaderStyle");
            IStyle tableHeader = workbook.Styles.Add("TableHeaderStyle");

            pageHeader.Font.FontName       = "Calibri";
            pageHeader.Font.Size           = 16;
            pageHeader.Font.Bold           = true;
            pageHeader.Color               = Windows.UI.Color.FromArgb(0, 146, 208, 80);
            pageHeader.HorizontalAlignment = ExcelHAlign.HAlignCenter;
            pageHeader.VerticalAlignment   = ExcelVAlign.VAlignCenter;

            tableHeader.Font.Bold     = true;
            tableHeader.Font.FontName = "Calibri";
            tableHeader.Color         = Windows.UI.Color.FromArgb(0, 146, 208, 80);

            #endregion

            #region Apply Styles
            // Apply style for header
            worksheet["A1:C2"].Merge();
            worksheet["A1"].Text      = "Automobile Brands in the US";
            worksheet["A1"].CellStyle = pageHeader;

            worksheet["A4:C4"].CellStyle = tableHeader;

            worksheet.Columns[0].ColumnWidth = 10;
            worksheet.Columns[1].ColumnWidth = 20;
            worksheet.Columns[2].ColumnWidth = 25;

            #endregion

            #endregion

            #region Save the Workbook
            StorageFile storageFile;
            if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
            {
                FileSavePicker savePicker = new FileSavePicker();
                savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
                savePicker.SuggestedFileName      = "ImportData";
                savePicker.FileTypeChoices.Add("Excel Files", new List <string>()
                {
                    ".xlsx",
                });
                storageFile = await savePicker.PickSaveFileAsync();
            }
            else
            {
                StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
                storageFile = await local.CreateFileAsync("ImportData.xlsx", CreationCollisionOption.ReplaceExisting);
            }

            if (storageFile != null)
            {
                //Saving the workbook
                await workbook.SaveAsAsync(storageFile);

                workbook.Close();
                excelEngine.Dispose();

                MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been saved successfully.");

                UICommand yesCmd = new UICommand("Yes");
                msgDialog.Commands.Add(yesCmd);
                UICommand noCmd = new UICommand("No");
                msgDialog.Commands.Add(noCmd);
                IUICommand cmd = await msgDialog.ShowAsync();

                if (cmd == yesCmd)
                {
                    // Launch the saved file
                    bool success = await Windows.System.Launcher.LaunchFileAsync(storageFile);
                }
            }
            else
            {
                workbook.Close();
                excelEngine.Dispose();
            }
            #endregion
        }
Esempio n. 38
0
 private async void PrivacyPolicy_Click(IUICommand cmd)
 {
     await Launcher.LaunchUriAsync(new Uri("http://vidya.dyndns.org/mpeg2player.html"));
 }
Esempio n. 39
0
 private void ClearHistory_Click(IUICommand cmd)
 {
     App.Current.ClearRecentlyUsed();
 }
        private async void ConvertToJson(object sender, RoutedEventArgs e)
        {
            try
            {
                StorageFile storageFile;
                if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
                {
                    FileSavePicker savePicker = new FileSavePicker();
                    savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
                    savePicker.SuggestedFileName      = "ExcelToJSON";
                    savePicker.FileTypeChoices.Add("JSON files", new List <string>()
                    {
                        ".json",
                    });
                    storageFile = await savePicker.PickSaveFileAsync();
                }
                else
                {
                    StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
                    storageFile = await local.CreateFileAsync("ExcelToJSON.json", CreationCollisionOption.ReplaceExisting);
                }

                if (storageFile == null)
                {
                    return;
                }
                ExcelEngine  excelEngine = new ExcelEngine();
                IApplication application = excelEngine.Excel;

                Assembly  assembly     = typeof(ExcelToJSON).GetTypeInfo().Assembly;
                string    resourcePath = "Syncfusion.SampleBrowser.UWP.XlsIO.XlsIO.Tutorials.Samples.Assets.Resources.Templates.ExcelToJSON.xlsx";
                Stream    fileStream   = assembly.GetManifestResourceStream(resourcePath);
                IWorkbook workbook     = await application.Workbooks.OpenAsync(fileStream);

                IWorksheet sheet = workbook.Worksheets[0];
                IRange     range = sheet.Range["A2:B10"];

                bool isSchema = check1.IsChecked.Value;

                if (combo1.SelectedIndex == 0)
                {
                    await workbook.SaveAsJsonAsync(storageFile, isSchema);
                }
                else if (combo1.SelectedIndex == 1)
                {
                    await workbook.SaveAsJsonAsync(storageFile, sheet, isSchema);
                }
                else if (combo1.SelectedIndex == 2)
                {
                    await workbook.SaveAsJsonAsync(storageFile, range, isSchema);
                }

                workbook.Close();
                excelEngine.Dispose();

                #region Launching the saved workbook
                MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");

                UICommand yesCmd = new UICommand("Yes");
                msgDialog.Commands.Add(yesCmd);
                UICommand noCmd = new UICommand("No");
                msgDialog.Commands.Add(noCmd);
                IUICommand cmd = await msgDialog.ShowAsync();

                if (cmd == yesCmd)
                {
                    // Launch the saved file
                    bool success = await Windows.System.Launcher.LaunchFileAsync(storageFile);
                }
                #endregion
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Esempio n. 41
0
 private void CommandInvokedHandler(IUICommand command)
 {
     // Display message showing the label of the command that was invoked
     //Page.NotifyUser("The '" + command.Label + "' command has been selected.");
 }
Esempio n. 42
0
 private void CommandInvokedHandler(IUICommand command)
 {
     //CoreApplication.Exit();
 }
        /// <summary>
        /// Handles context menu command selection.
        /// </summary>
        /// <param name="command">The command which was selected from the context menu</param>
        private void ContextMenuCommandHandler(IUICommand command)
        {
            // Assigning the return value of the async commands to a Task object to avoid
            // warning 4014 (call is not awaited).
            Task t;

            switch ((MonitorContextMenuCommandIds)command.Id)
            {
            case MonitorContextMenuCommandIds.DeviceInfo:
                try
                {
                    t = this.ShowDeviceInfoAsync();
                }
                catch (Exception e)
                {
                    this.StatusMessage = string.Format(
                        "Failed to display device information ({0})",
                        e.Message);
                }
                break;

            case MonitorContextMenuCommandIds.ManageApps:
                try
                {
                    t = this.ManageAppsAsync();
                }
                catch (Exception e)
                {
                    this.StatusMessage = string.Format(
                        "Failed to manage applications ({0})",
                        e.Message);
                }
                break;

            case MonitorContextMenuCommandIds.MixedRealityView:
                try
                {
                    t = this.MixedRealityViewAsync();
                }
                catch (Exception e)
                {
                    this.StatusMessage = string.Format(
                        "Failed to display Mixed Reality view ({0})",
                        e.Message);
                }
                break;

            case MonitorContextMenuCommandIds.DevicePortal:
                try
                {
                    t = this.LaunchDevicePortalAsync();
                }
                catch (Exception e)
                {
                    this.StatusMessage = string.Format(
                        "Failed to launch the Windows Device Portal ({0})",
                        e.Message);
                }
                break;

            case MonitorContextMenuCommandIds.Disconnect:
                this.Disconnect();
                break;

            default:
                Debug.Assert(false,
                             string.Format(
                                 "Unrecognized context menu command id: {0}",
                                 (int)command.Id));
                break;
            }
        }
Esempio n. 44
0
 private void CloseApp(IUICommand command)
 {
     base.Exit();
 }
Esempio n. 45
0
 public static async void GrantAccessPermissionHandler(IUICommand command)
 {
     await Launcher.LaunchUriAsync(new Uri("ms-settings:privacy-broadfilesystemaccess"));
 }
Esempio n. 46
0
 /// <summary>
 /// Called when about command clicked
 /// </summary>
 /// <param name="command"></param>
 private void AboutInvokedHandler(IUICommand command)
 {
     invadersViewModel.Paused = true;
     aboutPopup.IsOpen        = true;
 }
Esempio n. 47
0
        private async void btnGenerateExcel_Click(object sender, RoutedEventArgs e)
        {
            StorageFile storageFile;
            string      fileName = "Funnel_Chart.xlsx";

            if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
            {
                FileSavePicker savePicker = new FileSavePicker();
                savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
                savePicker.SuggestedFileName      = fileName;
                savePicker.FileTypeChoices.Add("Excel Files", new List <string>()
                {
                    ".xlsx",
                });
                storageFile = await savePicker.PickSaveFileAsync();
            }
            else
            {
                StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
                storageFile = await local.CreateFileAsync("Funnel_Chart.xlsx", CreationCollisionOption.ReplaceExisting);
            }

            if (storageFile == null)
            {
                return;
            }


            #region Initializing Workbook
            //New instance of XlsIO is created.[Equivalent to launching MS Excel with no workbooks open].
            //The instantiation process consists of two steps.

            //Step 1 : Instantiate the spreadsheet creation engine.
            ExcelEngine excelEngine = new ExcelEngine();
            //Step 2 : Instantiate the Excel application object.
            IApplication application = excelEngine.Excel;

            application.DefaultVersion = ExcelVersion.Excel2016;

            Assembly  assembly     = typeof(FunnelChart).GetTypeInfo().Assembly;
            string    resourcePath = "Syncfusion.SampleBrowser.UWP.XlsIO.XlsIO.Tutorials.Samples.Assets.Resources.Templates.FunnelChartTemplate.xlsx";
            Stream    fileStream   = assembly.GetManifestResourceStream(resourcePath);
            IWorkbook workbook     = await application.Workbooks.OpenAsync(fileStream);

            //The first worksheet object in the worksheets collection is accessed.
            IWorksheet sheet = workbook.Worksheets[0];
            #endregion

            #region Chart Creation
            IChart chart = null;

            if (this.rdBtnSheet.IsChecked != null && this.rdBtnSheet.IsChecked.Value)
            {
                chart = workbook.Charts.Add();
            }
            else
            {
                chart = workbook.Worksheets[0].Charts.Add();
            }

            #region Funnel Chart Settings
            chart.ChartType  = ExcelChartType.Funnel;
            chart.DataRange  = sheet["A2:B8"];
            chart.ChartTitle = "Sales Pipeline";
            chart.Series[0].DataPoints.DefaultDataPoint.DataLabels.IsValue = true;
            chart.Series[0].DataPoints.DefaultDataPoint.DataLabels.Size    = 8.5;
            chart.Series[0].SerieFormat.CommonSerieOptions.GapWidth        = 100;
            #endregion

            chart.Legend.Position = ExcelLegendPosition.Right;

            if (this.rdBtnSheet.IsChecked != null && this.rdBtnSheet.IsChecked.Value)
            {
                chart.Activate();
            }
            else
            {
                workbook.Worksheets[0].Activate();
                IChartShape chartShape = chart as IChartShape;
                chartShape.TopRow      = 2;
                chartShape.BottomRow   = 19;
                chartShape.LeftColumn  = 4;
                chartShape.RightColumn = 11;
            }
            #endregion

            #region Saving the workbook
            await workbook.SaveAsAsync(storageFile);

            workbook.Close();
            excelEngine.Dispose();
            #endregion

            #region Launching the saved workbook
            MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");

            UICommand yesCmd = new UICommand("Yes");
            msgDialog.Commands.Add(yesCmd);
            UICommand noCmd = new UICommand("No");
            msgDialog.Commands.Add(noCmd);
            IUICommand cmd = await msgDialog.ShowAsync();

            if (cmd == yesCmd)
            {
                // Launch the saved file
                bool success = await Windows.System.Launcher.LaunchFileAsync(storageFile);
            }
            #endregion
        }
 private static void OkBtnClick(IUICommand command)
 {
     NavigationService.GoBack();
 }
Esempio n. 49
0
 private void MessageCancel(IUICommand command)
 {
     //do nothing
 }
Esempio n. 50
0
 public static void Logout(IUICommand command)
 {
     AppDataAccessor.RemovePasswords();
     navigationService.NavigateToViewModel <LoginViewModel>();
 }
Esempio n. 51
0
 public static async void OpenPrivacyPolicy(IUICommand command)
 {
     Uri uri = new Uri("http://www.hudl.com/privacy/");
     await Windows.System.Launcher.LaunchUriAsync(uri);
 }
Esempio n. 52
0
        public void ShowRichPush(IUICommand command)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            rootFrame.Navigate(typeof(RichPush), command.Id);
        }