MEF : Use Export and Import from other project - silverlight-4.0

I am using MEF in my silverlight project to download Xap file of other project on a button click.
But I have to give reference of that project in my current project and after that when I run my project it includes dll file of my other project in my current xap file and then I can use export and import of other project in my current project.
But I dont want dll of other project in my curent xap file and when I click ok button then after I want to download xap file of other and want to use Import and export without giving reference of other project.
I can download other project's xap file on button click event but i can not use Export and Import which i did in other project if I did not give reference.
Without giving reference can I use import and export of other project?
If yes then how can I do this?
I used below code to download xap file of other project it works
PackageCatalog cat = new PackageCatalog();
var catalog = new PackageCatalog();
catalog.AddPackage(Package.Current);
Package.DownloadPackageAsync(new Uri("Test.xap", UriKind.Relative),
(args, p) => cat.AddPackage(p));
var container = new CompositionContainer(catalog);
container.ComposeParts(this);
}
Thanks,
HItesh

Related

Is it possible to download a file to the directory folder and then import it?

I have a problem and I can't solve it! My App in React-Native has a bunch of screens. One screen uses a JSON file that right now is inside a the App Project Folder:
import test from "../test.json"
I want to replace this because obviously if I want to change the JSON I need to change the file inside the App Project Folder. So I wanted to download the file and then import it the same way. I successfully downloaded the file in a temporary directory but I could not import it because it was not inside the App Project Folder.
I'm using a React-Native library called react-native-blob-util. One function of the library (ReactNativeBlobUtil.fs.dirs) tells me all the directories:
{"ApplicationSupportDir": "/Users/testuser/Library/Developer/CoreSimulator/Devices/2CDC9FD4-9CA6-4FDC-BBBA-12A17D7523C2/data/Containers/Data/Application/CF3BF7FD-CE84-439E-9BB9-EF318D685F81/Library/Application Support", "CacheDir": "/Users/testuser/Library/Developer/CoreSimulator/Devices/2CDC9FD4-9CA6-4FDC-BBBA-12A17D7523C2/data/Containers/Data/Application/CF3BF7FD-CE84-439E-9BB9-EF318D685F81/Library/Caches", "DCIMDir": undefined, "DocumentDir": "/Users/testuser/Library/Developer/CoreSimulator/Devices/2CDC9FD4-9CA6-4FDC-BBBA-12A17D7523C2/data/Containers/Data/Application/CF3BF7FD-CE84-439E-9BB9-EF318D685F81/Documents", "DownloadDir": "/Users/testuser/Library/Developer/CoreSimulator/Devices/2CDC9FD4-9CA6-4FDC-BBBA-12A17D7523C2/data/Containers/Data/Application/CF3BF7FD-CE84-439E-9BB9-EF318D685F81/Downloads", "LibraryDir": "/Users/testuser/Library/Developer/CoreSimulator/Devices/2CDC9FD4-9CA6-4FDC-BBBA-12A17D7523C2/data/Containers/Data/Application/CF3BF7FD-CE84-439E-9BB9-EF318D685F81/Library", "MainBundleDir": "/Users/testuser/Library/Developer/CoreSimulator/Devices/2CDC9FD4-9CA6-4FDC-BBBA-12A17D7523C2/data/Containers/Bundle/Application/C6148120-2378-44B7-BE2A-B4FFBDE6668D/TypeTest.app", "MovieDir": "/Users/testuser/Library/Developer/CoreSimulator/Devices/2CDC9FD4-9CA6-4FDC-BBBA-12A17D7523C2/data/Containers/Data/Application/CF3BF7FD-CE84-439E-9BB9-EF318D685F81/Movies", "MusicDir": "/Users/testuser/Library/Developer/CoreSimulator/Devices/2CDC9FD4-9CA6-4FDC-BBBA-12A17D7523C2/data/Containers/Data/Application/CF3BF7FD-CE84-439E-9BB9-EF318D685F81/Music", "PictureDir": "/Users/testuser/Library/Developer/CoreSimulator/Devices/2CDC9FD4-9CA6-4FDC-BBBA-12A17D7523C2/data/Containers/Data/Application/CF3BF7FD-CE84-439E-9BB9-EF318D685F81/Pictures", "SDCardApplicationDir": undefined, "SDCardDir": undefined}
Is it possible to download the JSON inside the project folder or some other directory when the user logs and then import the file in another screen?
You can not import a file that you downloaded to the device storage in runtime. You need to read it from the file system to use that file.
But depending on your setup there are easier ways to do what you want to accomplish.
I'd recommend you save your json file content to your application state (like redux or any other state management solution) and update your state after fetching the new json. If you want to persist the updated state between launches, you can use redux-persist so you wouldn't have to worry about the content being up to date.

How to include local script files in Vue

I have a basic project in VS code, and quite a simple task. I want to include an old javascript file in my project the correct way, so it gets loaded in the browser.
The file should be located in src\assets\scripts\oldLegacyScript.js
I tried this hack: How to add external JS scripts to VueJS Components which injects a <source> tag in the document on runtime. This only works if I put the .js file in the generated public folder in where the compiled files will be. If the file is not in the public folder the browser tries to download the index.html file, which I cannot understand:
If i follow this solution: Importing javascript file for use within vue component I get syntax errors on the import statement:
So how the heck do I overcome this simple task of importing a simple javascript file in my Vue project?
Import like this
<script>
import * as myKey from '.src/..';
export default {
}
</script>

How to add javascript and d.ts file to angular 2 project

I want to integrate protobufjs into my angular 2 project, according to here, first I install protobufjs, then use the CLI and my .proto file to generate the static code (both js file and related d.ts file), e.g. I get a.js and a.d.ts.
Then I put a.js and a.d.ts to somewhere, and import a.d.ts to component file which use it. The import instruction is as below:
import { model } from "path to the a.d.ts file";
My question is:
where should the a.js be placed? and how angular 2 application link the a.d.ts to the underlying a.js file?
Note: I don't want to include a.js to index.html. and angular 2 application use yarn as package manager and webpack as module bundler.
Very appreciated for any help.

The package contents are not updating during Export Release Build

I am trying to export my project using Flash Builder and the package contents are not updating. I have tried using Project > Clean and it is not updating the contents.
tags: export release build, package contents, package setttings
It turned out that I had to refresh the directory. I clicked on the Project and selected Refresh.

How to import .XML code style into Android Studio

I'm using Android Studio on OS X, and want to import intellij-java-google-style.xml for my code format.
But I can't find import at Preferences -> Project Settings -> Code Style -> Manage only Save as, Delete, Copy to project, and Close there.
Copy intellij-java-google-style.xml into the directory $HOME/Library/Preferences/IdeaIC14/codestyles/.
In the latest Android Studio (as of this edit, 4.1.1) you can go to Preferences -> Editor -> Code Style -> Scheme -> Settings Icon (Gear) -> Import Scheme... and import the xml there.
I am using Android Studio 1.2 on Ubuntu 12.04 and in my case I have an .AndroidStudio1.2 folder in my home directory. In this folder there is a config folder. What I did was the following:
I created a new folder called codestyles in the config folder.
copied my style xml (in my case named AndroidStyle.xml) into the codestyles folder (.AndroidStudio1.2/config/codestyles/AndroidStyle.xml)
Went into File>Settings>Editor>Code Style
Chose the AndroidStyle among the listed Schemas.
NOTE: Android Studio does not give you an option to import the xml file. And before you add the file to the codestyles folder there is NO indication that you can change the Schema to your own in any way. But after you have added the file the added schema will be shown among the other schemas.
NOTE 2: In other Operating systems this folder is located elsewhere. For more info on configuration folders see here: http://tools.android.com/tech-docs/configuration
If you are on Android Studio Preview you will need to copy your style xml file to:
~/Library/Preferences/AndroidStudioPreviewX.X/codestyles
where X.X is your Preview version ie. 1.4
Also, for those who use Android Studio on windows. Copy your xml file to $USER_SPACE$\.AndroidStudio1.X\config\codeStyles. If you don't have the codeStyles folder, just create one. And then you will see it in Settings->Editor->Code Style->Scheme.
Here are steps I used to import my coding style for a project.
Place codingStyle.xml to .idea folder under your project.
In Android Studio select Project for coding style scheme, click OK.
Place original codingStyle.xml to .idea folder again (Android Studio most likely had overwritten with default settings your codingStyle.xml when you click OK on step 2)
Restart Android Sturdio.