Exemplo n.º 1
0
 internal void OpenLocalPackage(string packagePath)
 {
     if (!File.Exists(packagePath))
     {
         UIServices.Show("File not found at " + packagePath, MessageLevel.Error);
         return;
     }
     PackageSourceItem.SetCurrentValue(ContentControl.ContentProperty, "Loading " + packagePath + "...");
     Dispatcher.BeginInvoke(new Action <string>(OpenLocalPackageCore), DispatcherPriority.Loaded, packagePath);
 }
Exemplo n.º 2
0
        internal async Task OpenLocalPackage(string packagePath)
        {
            if (!File.Exists(packagePath))
            {
                UIServices.Show("File not found at " + packagePath, MessageLevel.Error);
                return;
            }

            object oldContent = PackageSourceItem.Content;

            PackageSourceItem.SetCurrentValue(ContentProperty, "Loading " + packagePath + "...");

            bool succeeded = await Dispatcher.InvokeAsync(
                () => OpenLocalPackageCore(packagePath), DispatcherPriority.Loaded);

            if (!succeeded)
            {
                // restore old content
                PackageSourceItem.SetCurrentValue(ContentProperty, oldContent);
            }
        }