コード例 #1
0
        /// <summary>
        /// If the chosen item is a file then the Select Button is enabled, and the correct path is set.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedPropertyChangedEventArgs&lt;System.Object&gt;"/> instance containing the event data.</param>
        private void PkgFileChooser_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            var file = PackageFileChooser.SelectedItem as PackageFileContentItem;

            if (file != null)
            {
                SelectButton.IsEnabled = true;
                PackageViewModel package = null;
                // Get the Package parent
                PackageContentItem parent = file.Parent;
                package = parent as PackageViewModel;
                while (package == null && parent != null)
                {
                    parent  = parent.Parent;
                    package = parent as PackageViewModel;
                }

                if (package != null)
                {
                    TraceLabSDK.PackageSystem.IPackageReference reference = new TraceLab.Core.PackageSystem.PackageReference(package.Package);

                    var path = new TraceLab.Core.Components.TraceLabFilePath();
                    path.Init(reference, file.ID);
                    Path = path;
                }
            }
            else
            {
                SelectButton.IsEnabled = false;
            }
        }
コード例 #2
0
        private static void PathChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            FilePickerDialog dialog = (FilePickerDialog)sender;

            if (args.NewValue != null)
            {
                MainWindow owner = dialog.Owner as MainWindow;
                TraceLab.Core.Components.TraceLabFilePath filePath = args.NewValue as TraceLab.Core.Components.TraceLabFilePath;
            }
        }
コード例 #3
0
        /// <summary>
        /// If the chosen item is a file then the Select Button is enabled, and the correct path is set.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedPropertyChangedEventArgs&lt;System.Object&gt;"/> instance containing the event data.</param>
        private void PkgFileChooser_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        {
            var file = PackageFileChooser.SelectedItem as PackageFileContentItem;
            if (file != null)
            {
                SelectButton.IsEnabled = true;
                PackageViewModel package = null;
                // Get the Package parent
                PackageContentItem parent = file.Parent;
                package = parent as PackageViewModel;
                while (package == null && parent != null)
                {
                    parent = parent.Parent;
                    package = parent as PackageViewModel;
                }

                if (package != null)
                {
                    TraceLabSDK.PackageSystem.IPackageReference reference = new TraceLab.Core.PackageSystem.PackageReference(package.Package);

                    var path = new TraceLab.Core.Components.TraceLabFilePath();
                    path.Init(reference, file.ID);
                    Path = path;
                }
            }
            else
            {
                SelectButton.IsEnabled = false;
            }
        }