I am making a windows phone application, and have divided my solution up in 4 projects.
WebService
MainProject
SecondaryProject
PortableLibrary
I share models between all projects using the Portable Library. But how to share information, I know I can share variables and other elements using Uri Scheme:
NavigationService.Navigate(new Uri("/Project;component/URI.xaml", UriKind.Relative));
But what if I want to parse Complex objects?
An Example with pseudo code and program flow:
**STARTUP->MainProject**
UILoad(); //Login UI shown
MobileService.Authenticate(); //Authentication stored in Isolated storage through CreditVault.
NavigateTo->MainMenu(); //
**MainMenu->SecondaryProject**
NavigationService.Navigate(new Uri("/SecondaryProject;component/URI.xaml", UriKind.Relative));
MobileService.AccessRestrictedInformation(); //How to still be authenticated here?
SavePictureAndInformation(); //How to make Information available to all projects in the solution?
The authentication I have on the startupPage, allows me to automatically re-authenticate users, which is why I store it encrypted.
Questions
Can the other Project access the IsolatedStorage of the first project, if so how?
If I authenticate the user upon startup, will a created mobileservice in another project within the solution also be authenticated?
Am I missing somethine smart?
External Information
I need the setup of multiple projects with pages and cannot insert them in the same project. So it is not a solution to have it in the same project.
You can share information between projects using IsolatedStorage or use the application.current.resources, from this link http://mikaelkoskinen.net/windows-phone-pass-data-between-pages-application-resources/
Hope somebody find it useful :)
Related
Recently our team has decided to implement micro front end architecture in our legacy product. It has been developed using Asp.Net aspx pages along with javascript/jquery.
Last year we started using angular in our application for some of the views. To load angular we are placing the prod build files in .net project and we are loading the component in aspx master page.
We are planning to migrate our rest pending older views to angular using micro front end architecture.
So I did a small poc for the same and was able to achieve the architecture to somewhere close to it.
I followed this url for implementation and ran it on port 4400.
https://medium.com/swlh/build-micro-frontends-using-angular-elements-the-beginners-guide-75ffeae61b58
And in my existing angular project i am loading this using customElements
this.appendCustomElementWithUrls('app-positions','http://localhost:4400/main-es5.js', (<HTMLElement>document.getElementById("chartAppContainerNamInqA")) );
appendCustomElementWithUrls(name: string,url: string,target: HTMLElement){
if (!customElements.get(name)) {
const script = document.createElement('script');
script.src = url;
document.head.appendChild(script);
}
const component = document.createElement(name);
target.appendChild(component);
}
And this works as expected and I am able to load customElements in my dev env. But for production I am really not sure how to implement.
My concern:
Will I have to run app on some port in prod as well? If yes how to do that and can it be dynamic such that user has ability to change the port. The way we have in .net application. Since client may have something already running on that port
The way I am trying to achieve is correct or not.
Thanks in advance.
For those who might have requirement like this.
I did lot of research and went through lot of articles and came out with a solution.
So I created a separate application using Angular elements and generated single bundle using cmd;
ng build --prod --output-hashing none --single-bundle true
then I created an application in IIS and placed all the prod generated files in it on port 9091. You can use any port for that.
In my web.config file I created a key such that if user changes the port number then they directly update web.config:
<add key="MicroFrontEnd" value="http://localhost:9190"/>
Since port should be configurable so I created an api to fetch the port number.
Then I used this in my shell app and it works like a charm.
i'm making 2 UWP apps, and i want to make them share 1 DB.
i'm using Microsoft.Data.SQLite
however, is there any way to share the same DB??
SqliteConnection db = new SqliteConnection("Filename=data.db"));
"Filename=data.db" path was c:\Users(user
name)\AppData\Local\Packages(App ID)\LocalState\data.db
However, I know UWP app can only access that c:\Users\ (username)\AppData\Local\Packages(App ID)\LocalState\ folder except shared app data folders.
So, can you tell me how to direct the shared app data folder to Connection String?
Are two ways to that:
1) Creates a button to call user action to select the common folder using a Picker to file or folder. Your application stores the access token returned by this explicit authorization and use that in future with no new user interaction.
2) Have a few ways to app get store authorization, but some that needs an enterprise Windows Store association (like Documents Library). I not sure, but for some locations, in the app validation you will be required to justify the needs before to publish your app.
More details in here: https://learn.microsoft.com/en-us/windows/uwp/files/file-access-permissions. See the title "Accessing additional locations".
I'm developing a dll that is supposed to be commonly used (in nuget for example). Simple description: my DLL simplifies message exchange with a particular service. It allows to send a request, then retrieve a response. Service is asynchronous and it can create a response in a hour or a day after accepting a request, so after making a request my dll calls service every few minutes to check out for response. The problem is that the app that uses the dll can be restarted therefore storing a request queue in memory isn't a good option (I don't want to lose info about requests). Neither is serializing it to file, because I can't know for sure where my dll will be used - it could be pc app, mvc. My main options is: serialize to file, but give an option to set a address where to place serialized files via web/app.config or make a user to think about it. But maybe there is some better solution about how to store requests queue?
I would put theses type of configuration or data files in a subfolder to the %appdata% folder. You will have write access to files in this folder and the documentation is extensive. Read more here.
in C# you can easily get this folder using:
var appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
Or use Program Data:
var programdata = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
I'm using the AllScripts HelloWorld TouchWorks C# Project, as provided on their site. I've also created a valid application, using the svcUsername and svcPassword on the app.config file to log and added my own appName instead of the default web20.
Didnt change anything else, tried with many different application ID's, all trying to log into the default sandbox server in the example and some trying other sandboxes.
Regardless of what I do, I keep getting
Error: Service Application not licensed on this server!
Despite this being a sandbox server, thus suppouseably accessable to all applications.
What did I do wrong?
edit: Tried to do the same in Slueth, I get the same error.
It's more simple than it seems. Sandbox servers DO require licenses. Talked with the staff, they're nice people, so they manually added me after a few explanations of my requirements.
I have a project based on the Chris Hammond, Christoc, module template. I have a ton of code that I use to access data an external database. In my repositories I change the database from the default to whichever I need for that particular object. I do so with code that looks like this:
using (IDataContext ctx = DataContext.Instance(MyModuleSettingsBase.DATABASE_CONNECTION_STRING_KEY))
{
var rep = ctx.GetRepository<Product>();
products = rep.Get().ToList();
}
The default database is switched in the call to .Instance(). The repositories are used by my custom DNN modules. The repository is part of the solution that contains multiple custom modules. When I compile and install using the Extensions part of DNN, everything works well. In the code above, MyModuleSettingsBase.DATABASE_CONNECTION_STRING_KEY is found in a file MyModuleSettingsBase.cs file of my module solution. It is set to a simple string like "ProductDatabase". In the solution for the base DNN install (not the module solution), within the web.config file, there is a value in <connectionStrings> with name="ProductDatabase" which contains the actual connection string. This all links up fine on the DNN website.
Now I am writing a console application that does some monitoring of the site. I want to access the database to check values in the product table. I would like to reuse all of the repository code I have written. In an attempt to do so, I added a reference to the MyModules.dll file so I would only have one copy of the base code. This works to give me access to all the objects and the associated repositories but when I attempt to query data it fails. When debugging I can see that it fails on the line:
using (IDataContext ctx = DataContext.Instance(MyModuleSettingsBase.DATABASE_CONNECTION_STRING_KEY))
When viewed in a debugger, the string value MyModuleSettingsBase.DATABASE_CONNECTION_STRING_KEY is correctly set to "ProductDatabase" but the code is unable to link this with the actual connection string. I don't know where it would be checking for the connections string when running from my console application. I attempted to put a <connectionStrings> section into my App.config file but this didn't do the trick.
Is it possible to have MyModuleSettingsBase.DATABASE_CONNECTION_STRING_KEY map to the connection string in an external application which references the DLL?
If so, where can I set the value of my connection string so it matches up to the key value stored in MyModuleSettingsBase.DATABASE_CONNECTION_STRING_KEY?
I was faced similar problem 3 months ago, at that time I want to use DNN core libraries in my console application but I was failed.
I placed my queries in DNN official forum website and I got a valid response from Wes Tatters (DNN MVP).
Here is the post link: Reference URL
As your requirement of monitoring, I suggest you to create DNN Schedule Application. You can schedule it within DNN (Host->AdvancedSettings->Schedule), even good point is that you can use your repositories (DNN Libraries) in that schedule application.
I hope it solved your problem. Let me know if you have any questions.