private void LoadProfile()
 {
     try
     {
         Microsoft.Win32.OpenFileDialog openFileDialog = new Win32.OpenFileDialog();
         openFileDialog.Filter = StringResources.TestProfileFilter;
         string initialDir = System.IO.Path.Combine(util.AppConfig.AppDataDirectory, StringResources.TestProfileFolder);
         if (Directory.Exists(initialDir))
         {
             openFileDialog.InitialDirectory = initialDir;
         }
         if (openFileDialog.ShowDialog() != true)
         {
             return;
         }
         LoadProfile(openFileDialog.FileName);
     }
     catch (Exception e)
     {
         MessageBox.Show(
             e.Message,
             "Error",
             MessageBoxButton.OK,
             MessageBoxImage.Error,
             MessageBoxResult.None);
         return;
     }
 }
Пример #2
0
        private async void addB_Click(object sender, RoutedEventArgs e)
        {
            var ofd = new Win32.OpenFileDialog();

            ofd.Filter = "Mission Files (*.xml)|*.xml";

            if (ofd.ShowDialog(this) == true)
            {
                using (StreamReader reader = new StreamReader(ofd.FileName))
                {
                    try
                    {
                        MissionSpec mission = new MissionSpec(await reader.ReadToEndAsync(), true);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Error Parsing Mission", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }
                }

                this.addItem(ofd.FileName);

                this.updateButtons();
            }
        }
Пример #3
0
        private void LoadProfile()
        {
            try
            {
                Microsoft.Win32.OpenFileDialog openFileDialog = new Win32.OpenFileDialog();
                openFileDialog.Filter = StringResources.TestProfileFilter;
                string initialDir = System.IO.Path.Combine(util.AppConfig.AppDataDirectory, StringResources.TestProfileFolder);
                if (Directory.Exists(initialDir))
                {
                    openFileDialog.InitialDirectory = initialDir;
                }
                if (openFileDialog.ShowDialog() != true)
                {
                    return;
                }

                string profile = openFileDialog.FileName, newProfile;
                if (util.TryUpgradeProfileSettings(profile, out newProfile))
                {
                    UserPromptWindow.Show(StringResources.Information, String.Format(StringResources.PtmProfileUpgraded, newProfile), UserPromptWindow.IconType.Information);

                    profile = newProfile;
                }
                LoadProfile(profile);
            }
            catch (Exception e)
            {
                UserPromptWindow.Show(StringResources.Error, e.Message, UserPromptWindow.IconType.Error);

                return;
            }
        }
Пример #4
0
        private async void openMI_Click(object sender, RoutedEventArgs e)
        {
            var ofd = new Win32.OpenFileDialog();

            ofd.Filter = "Mission Files (*.xml)|*.xml";

            if (ofd.ShowDialog(this) == true)
            {
                MissionSpec mission = await loadMission(ofd.FileName);

                if (mission != null)
                {
                    _score = 0;

                    openMI.IsEnabled = false;
                    startB.IsEnabled = false;
                    startB.Content   = "Ready";
                    await Task.Run(() => runMission(mission));

                    startB.IsEnabled = true;
                    startB.Content   = "Start";
                    openMI.IsEnabled = true;
                }
            }
        }
Пример #5
0
        private void AddPartition_Click(object sender, RoutedEventArgs e)
        {
            var session = ((MenuItem)sender).DataContext as Session;

            Win32.OpenFileDialog dlg = new Win32.OpenFileDialog();
            dlg.DefaultExt = ".psi";
            dlg.Filter     = "Psi Store (.psi)|*.psi|Psi Annotation Store (.pas)|*.pas";
            bool?result = dlg.ShowDialog();

            if (result == true)
            {
                var fileInfo = new FileInfo(dlg.FileName);
                var name     = fileInfo.Name.Split('.')[0];

                if (fileInfo.Extension == ".psi")
                {
                    session.AddStorePartition(name, fileInfo.DirectoryName);
                }
                else if (fileInfo.Extension == ".pas")
                {
                    session.AddAnnotationPartition(name, fileInfo.DirectoryName);
                }
                else
                {
                    throw new ApplicationException("Invalid file type selected when adding partition.");
                }

                this.context.Dataset.CurrentSession = session;
                this.context.VisualizationContainer.ZoomToRange(session.OriginatingTimeInterval);
            }
        }
Пример #6
0
        private async void addB_Click(object sender, RoutedEventArgs e)
        {
            var ofd = new Win32.OpenFileDialog();
            ofd.Filter = "Mission Files (*.xml)|*.xml";

            if (ofd.ShowDialog(this) == true)
            {
                using (StreamReader reader = new StreamReader(ofd.FileName))
                {
                    try
                    {
                        MissionSpec mission = new MissionSpec(await reader.ReadToEndAsync(), true);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Error Parsing Mission", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }
                }

                this.addItem(ofd.FileName);

                this.updateButtons();
            }
        }
Пример #7
0
        private void LoadProfile()
        {
            try
            {
                Microsoft.Win32.OpenFileDialog openFileDialog = new Win32.OpenFileDialog();
                openFileDialog.Filter = StringResources.TestProfileFilter;
                string initialDir = System.IO.Path.Combine(util.AppConfig.AppDataDirectory, StringResources.TestProfileFolder);
                if (Directory.Exists(initialDir))
                {
                    openFileDialog.InitialDirectory = initialDir;
                }
                if (openFileDialog.ShowDialog() != true)
                {
                    return;
                }

                string profile = openFileDialog.FileName, newProfile;
                if (util.TryUpgradeProfileSettings(profile, out newProfile))
                {
                    MessageBox.Show(this, String.Format(StringResources.PtmProfileUpgraded, newProfile));
                    profile = newProfile;
                }
                LoadProfile(profile);
            }
            catch (Exception e)
            {
                MessageBox.Show(
                    e.Message,
                    "Error",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error,
                    MessageBoxResult.None);
                return;
            }
        }
Пример #8
0
        private void FirstAppBrowseBtn_Click(object sender, RoutedEventArgs e)
        {
            var ofd = new Win32.OpenFileDialog()
            {
                Filter = "PowerApps Files (*.msapp)|*.msapp"
            };
            var result = ofd.ShowDialog();

            if (result == false)
            {
                return;
            }
            FirstAppPathtxtBox.Text = ofd.FileName;

            appData1 = mergeProcessor.Extract(ofd.FileName);

            MainViewModel model = this.DataContext as MainViewModel;

            model.ScreensFromApp1 = new System.Collections.ObjectModel.ObservableCollection <EntityModel>(appData1.Screens.Select(s => new EntityModel()
            {
                Screen = s, Source = "App 1"
            }));

            model.ScreensForMergedApp.Clear();

            foreach (var item in model.ScreensFromApp1)
            {
                model.ScreensForMergedApp.Add(item);
            }

            foreach (var item in model.ScreensFromApp2)
            {
                model.ScreensForMergedApp.Add(item);
            }
        }
 private void ImportPlaylist_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Microsoft.Win32.OpenFileDialog openfile = new Win32.OpenFileDialog();
         openfile.Filter = StringResources.PlaylistFilter;
         if (openfile.ShowDialog() == true)
         {
             int checkedNumber, notFound;
             Pages.util.ImportPlaylist(openfile.FileName);
             Pages.util.ApplyPlaylist(out checkedNumber, out notFound);
             if (notFound > 0)
             {
                 MessageBox.Show(string.Format(StringResources.NotFoundCaseMessage, notFound));
             }
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(
             exception.Message,
             "Error",
             MessageBoxButton.OK,
             MessageBoxImage.Error,
             MessageBoxResult.None);
         return;
     }
 }
Пример #10
0
        private void BrowseBtn_Click(object sender, RoutedEventArgs e)
        {
            var ofd = new Win32.OpenFileDialog()
            {
                Filter = "PowerApps Files (*.msapp)|*.msapp"
            };
            var result = ofd.ShowDialog();

            if (result == false)
            {
                return;
            }
            PathtxtBox.Text = ofd.FileName;
        }
Пример #11
0
        private void LoadLayout_Click(object sender, RoutedEventArgs e)
        {
            Win32.OpenFileDialog dlg = new Win32.OpenFileDialog();
            dlg.DefaultExt = ".plo";
            dlg.Filter     = "Psi Layout (.plo)|*.plo";

            bool?result = dlg.ShowDialog();

            if (result == true)
            {
                string filename = dlg.FileName;
                this.context.OpenLayout(filename);
                this.TabControl.SelectedItem = this.Visualizations;
            }
        }
Пример #12
0
        private void OpenStore_Click(object sender, RoutedEventArgs e)
        {
            Win32.OpenFileDialog dlg = new Win32.OpenFileDialog();
            dlg.DefaultExt = ".psi";
            dlg.Filter     = "Psi Store (.psi)|*.psi";

            bool?result = dlg.ShowDialog();

            if (result == true)
            {
                string filename = dlg.FileName;
                this.context.OpenDataset(filename);
                this.TabControl.SelectedItem = this.Datasets;
            }
        }
Пример #13
0
        private void CreateSessionFromExistingStore_Click(object sender, RoutedEventArgs e)
        {
            var dataset = ((MenuItem)sender).DataContext as Dataset;

            Win32.OpenFileDialog dlg = new Win32.OpenFileDialog();
            dlg.DefaultExt = ".psi";
            dlg.Filter     = "Psi Store (.psi)|*.psi";

            bool?result = dlg.ShowDialog();

            if (result == true)
            {
                var fileInfo = new FileInfo(dlg.FileName);
                var name     = fileInfo.Name.Split('.')[0];
                dataset.AddSessionFromExistingStore(name, name, fileInfo.DirectoryName);
            }
        }
Пример #14
0
        private void OpenMetadataFileButton_OnClick(object sender, RoutedEventArgs e)
        {
            var openFileDialog = new Win32.OpenFileDialog
            {
                DefaultExt      = ".xml",
                Filter          = "OData Metadata Files (.xml)|*.xml",
                Title           = "Open OData Metadata File",
                CheckFileExists = true,
                CheckPathExists = true,
                Multiselect     = false
            };

            if (openFileDialog.ShowDialog() == true)
            {
                Endpoint.Text = openFileDialog.FileName;
            }
        }
Пример #15
0
        private void ImportPlaylist_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Microsoft.Win32.OpenFileDialog openfile = new Win32.OpenFileDialog();
                openfile.Filter = StringResources.PlaylistFilter;
                if (openfile.ShowDialog() == true)
                {
                    int checkedNumber, notFound;
                    Pages.util.ImportPlaylist(openfile.FileName);
                    Pages.util.ApplyPlaylist(out checkedNumber, out notFound);
                    if (notFound > 0)
                    {
                        UserPromptWindow.Show(StringResources.Error, string.Format(StringResources.NotFoundCaseMessage, notFound), UserPromptWindow.IconType.Error);
                    }
                }
            }
            catch (Exception exception)
            {
                UserPromptWindow.Show(StringResources.Error, exception.Message, UserPromptWindow.IconType.Error);

                return;
            }
        }
        //private string name = null;



        private void browseButton_Click(object sender, RoutedEventArgs e)
        {
            Win32.OpenFileDialog dlg = new Win32.OpenFileDialog();
            dlg.FileName   = "";
            dlg.DefaultExt = ".gbd";                                       // Default file extension
            dlg.Filter     = "Gesture build data" + " " + "(*.gbd)|*.gbd"; // Filter files by extension
            dlg.Title      = "Importar postura";
            bool?result = dlg.ShowDialog();

            if (result == true)
            {
                //Console.WriteLine("filePath: " + dlg.FileName);
                this.fileNameTextBox.Text = dlg.SafeFileName;
                this.path = dlg.FileName;

                //File.Copy(this.playingFilePath, @"Database\"+dlg.N);

                //this.kstudio.ImportScene(dlg.FileName);
                //enableButtons();
                //this.Title = "Visualizador Multimodal - " + Scene.Instance.name;
                //sceneTitleLabel.Content = Scene.Instance.name;
                //sceneDurationLabel.Content = Scene.Instance.duration.ToString(@"hh\:mm\:ss");
            }
        }
 private void LoadProfile()
 {
     try
     {
         Microsoft.Win32.OpenFileDialog openFileDialog = new Win32.OpenFileDialog();
         openFileDialog.Filter = StringResources.TestProfileFilter;
         string initialDir = System.IO.Path.Combine(util.AppConfig.AppDataDirectory, StringResources.TestProfileFolder);
         if (Directory.Exists(initialDir)) openFileDialog.InitialDirectory = initialDir;
         if (openFileDialog.ShowDialog() != true) return;
         LoadProfile(openFileDialog.FileName);
     }
     catch (Exception e)
     {
         MessageBox.Show(
             e.Message,
             "Error",
             MessageBoxButton.OK,
             MessageBoxImage.Error,
             MessageBoxResult.None);
         return;
     }
 }
Пример #18
0
        private void OpenConnectedServiceJsonFileButton_Click(object sender, RoutedEventArgs e)
        {
            var fileDialogTitle = "Open OData Connected Service Config File";

            var openFileDialog = new Win32.OpenFileDialog
            {
                DefaultExt = ".json",
                Filter     = "JSON File (.json)|*.json",
                Title      = fileDialogTitle
            };

            if (!(openFileDialog.ShowDialog() == true)) // Result of ShowDialog() call is bool?
            {
                return;
            }

            if (!File.Exists(openFileDialog.FileName))
            {
                MessageBox.Show(
                    $"File \"{openFileDialog.FileName}\" does not exists.",
                    string.Format(CultureInfo.InvariantCulture, fileDialogTitle),
                    MessageBoxButton.OK,
                    MessageBoxImage.Warning);
                return;
            }

            var jsonFileText = File.ReadAllText(openFileDialog.FileName);

            if (string.IsNullOrWhiteSpace(jsonFileText))
            {
                MessageBox.Show("Config file is empty.",
                                string.Format(CultureInfo.InvariantCulture, fileDialogTitle),
                                MessageBoxButton.OK,
                                MessageBoxImage.Warning);
                return;
            }

            ConnectedServiceJsonFileData connectedServiceData;

            try
            {
                connectedServiceData = JsonConvert.DeserializeObject <ConnectedServiceJsonFileData>(jsonFileText);
            }
            catch (JsonException ex)
            {
                System.Diagnostics.Debug.Assert(ex != null);
                MessageBox.Show(
                    "Contents of the config file could not be deserialized.",
                    string.Format(CultureInfo.InvariantCulture, fileDialogTitle),
                    MessageBoxButton.OK,
                    MessageBoxImage.Warning);
                return;
            }

            // connectedServiceData not expected to be null at this point
            if (connectedServiceData.ExtendedData != null)
            {
                this.UserSettings.CopyPropertiesFrom(connectedServiceData.ExtendedData);
            }

            ODataConnectedServiceWizard connectedServiceWizard = GetODataConnectedServiceWizard();

            // get Operation Imports and bound operations from metadata for excluding ExcludedOperationImports and ExcludedBoundOperations
            try
            {
                connectedServiceWizard.ConfigODataEndpointViewModel.MetadataTempPath = connectedServiceWizard.ConfigODataEndpointViewModel.GetMetadata(out var version);
                connectedServiceWizard.ConfigODataEndpointViewModel.EdmxVersion      = version;
                if (version == Constants.EdmxVersion4)
                {
                    Edm.IEdmModel model = EdmHelper.GetEdmModelFromFile(connectedServiceWizard.ConfigODataEndpointViewModel.MetadataTempPath);

                    IEnumerable <Edm.IEdmSchemaType> entityTypes = EdmHelper.GetSchemaTypes(model);
                    IDictionary <Edm.IEdmType, List <Edm.IEdmOperation> > boundOperations = EdmHelper.GetBoundOperations(model);
                    connectedServiceWizard.SchemaTypesViewModel.LoadSchemaTypes(entityTypes, boundOperations);
                    connectedServiceWizard.ProcessedEndpointForSchemaTypes = this.UserSettings.Endpoint;
                    connectedServiceWizard.SchemaTypesViewModel.LoadFromUserSettings();

                    IEnumerable <Edm.IEdmOperationImport> operations = EdmHelper.GetOperationImports(model);
                    connectedServiceWizard.OperationImportsViewModel.LoadOperationImports(operations, new HashSet <string>(), new Dictionary <string, SchemaTypeModel>());
                    connectedServiceWizard.ProcessedEndpointForOperationImports = this.UserSettings.Endpoint;
                    connectedServiceWizard.OperationImportsViewModel.LoadFromUserSettings();
                }
            }
            catch
            {
                // ignored
            }
        }
        /// <summary>
        /// To extract the json object from msapp file and bind it to UI
        /// </summary>
        /// <param name="obj"></param>
        public async void BrowseBtnClicked(object obj)
        {
            var uiContext = SynchronizationContext.Current;

            await Task.Run(async() =>
            {
                string message = "";
                var ofd        = new Win32.OpenFileDialog()
                {
                    Filter = "PowerApps Files (*.msapp)|*.msapp"
                };
                var result = ofd.ShowDialog();
                if (result == false)
                {
                    return;
                }
                PathTxtBox = ofd.FileName;
                try
                {
                    if (string.IsNullOrWhiteSpace(PathTxtBox) ||
                        Path.GetExtension(PathTxtBox) != ".msapp")
                    {
                        message = "Select the PowerApps App!";
                    }
                    else
                    {
                        this.IsLoading = true;
                        ChangeManager changeManager = new ChangeManager();
                        searchResult = changeManager.GetModifiedControleList(PathTxtBox);

                        if (searchResult == null || searchResult.Count == 0 ||
                            (searchResult.Count == 1 && searchResult[0].ControlList.Count == 0))
                        {
                            var screenName = $"No change found in the App!";
                            searchResult   = new List <ModifiedResult>
                            {
                                new ModifiedResult
                                {
                                    ScreenName = screenName
                                }
                            };
                        }

                        //Clear the binded object everytime
                        ScreenList = new ObservableCollection <DataModel>();

                        //DataModel local variables
                        DataModel _dataModel = null;
                        Controls _controls   = null;
                        Property _property   = null;

                        //Fill the object by traversing
                        searchResult.ForEach(r =>
                        {
                            _dataModel            = new DataModel();
                            _dataModel.ScreenName = r.ScreenName;

                            r.ControlList?.ForEach(s =>
                            {
                                _controls             = new Controls();
                                _controls.ControlName = $"{s.ControlName}";
                                //_property = new Property();
                                //_property.PropertyName = $"Parent: {s.Parent}";
                                //_controls.Properties.Add(_property);
                                s.Script?.ForEach(q =>
                                {
                                    if (!string.Equals(q.DefaultSetting, q.InvariantScript,
                                                       StringComparison.OrdinalIgnoreCase))
                                    {
                                        _property = new Property();
                                        _property.PropertyName = q.Property;
                                        _property.Properties.Add(new PropertyDetails()
                                        {
                                            IsBaseLine = true, Name = "", Value = q.DefaultSetting
                                        });
                                        _property.Properties.Add(new PropertyDetails()
                                        {
                                            IsBaseLine = false, Name = "", Value = q.InvariantScript
                                        });
                                        _controls.Properties.Add(_property);
                                    }
                                });

                                _dataModel.Controls.Add(_controls);
                            });
                            uiContext.Send(x => ScreenList.Add(_dataModel), null);
                        });

                        //Clone to local list
                        OrginalScreenList = ScreenList;
                        this.IsLoading    = false;
                    }
                }
                catch (Exception ex)
                {
                    message = ex.Message;
                }

                if (!string.IsNullOrWhiteSpace(message))
                {
                    MessageBoxButton button = MessageBoxButton.OK;
                    System.Windows.MessageBox.Show(message, "Message", button);
                }
            });
        }
 private void ImportPlaylist_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Microsoft.Win32.OpenFileDialog openfile = new Win32.OpenFileDialog();
         openfile.Filter = StringResources.PlaylistFilter;
         if (openfile.ShowDialog() == true)
         {
             int checkedNumber, notFound;
             Pages.util.ImportPlaylist(openfile.FileName);
             Pages.util.ApplyPlaylist(out checkedNumber, out notFound);
             if (notFound > 0) MessageBox.Show(string.Format(StringResources.NotFoundCaseMessage, notFound));
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(
             exception.Message,
             "Error",
             MessageBoxButton.OK,
             MessageBoxImage.Error,
             MessageBoxResult.None);
         return;
     }
 }
Пример #21
0
        private async void openMI_Click(object sender, RoutedEventArgs e)
        {
            var ofd = new Win32.OpenFileDialog();
            ofd.Filter = "Mission Files (*.xml)|*.xml";

            if (ofd.ShowDialog(this) == true)
            {
                MissionSpec mission = await loadMission(ofd.FileName);
                if (mission != null)
                {
                    _score = 0;

                    openMI.IsEnabled = false;
                    startB.IsEnabled = false;
                    startB.Content = "Ready";
                    await Task.Run(() => runMission(mission));
                    startB.IsEnabled = true;
                    startB.Content = "Start";
                    openMI.IsEnabled = true;
                }
            }
        }