How can i use app lifecycle methods(or lifecycle methods of an individual page) if my application is structured using MVVM?(is there any way to do this without mvvm cross or other frameworks?) I ran past this problem when i tried to implement a token auth on my app and i wanted to check if the token is valid before the menu opens.
Related
I have a website with form authentication.
I had successfully logged in that website and read data from it with WebBrowser Control in Windows.Forms.
Hoewever I need to do the same with Xamarin Forms.
Is it possible to control webview in xamarin forms like WebBrowser in Windows.Forms.
Thanks in advance
I think that Xamarin.Forms WebView do not have a deep object model to automate and achieve the same you do with WebBrowser control in WinForms, though you can do it in a "blind" way (without UI)...
You can trace HTTP trafic with an HTTP monitor to see what happens when a user uses the application:
a. https://www.charlesproxy.com/ (see post: https://stackoverflow.com/a/17685506/2117381)
b. https://www.wireshark.org/
You can automatize interaction between an application client and a web server via a HTTPclient library, simulating how the user would use the mobile application:
One option... https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=netcore-3.1
You can extract information from HTML with: HTMLAgilityPack https://github.com/zzzprojects/html-agility-pack
This library parses HTML, construcs a DOM.. you can use XPath / XSLt...
I hope this helps
I’d like to use .Net Core (Console App) and EF Core to create my business logic, a number crunching engine that loads financial data from a local database (MySQL or SQLite), process it, will store the results in the same database and show them to the user.
I want to be able to easily add in the future a GUI to manage the CRUD operations and simple commands.
How can I implement the MVVM pattern in a console application to be able to easily add a GUI in the future (Win7-10 and MacOs)?
The Terminal.Gui Nuget package includes:
Reactive Example - A sample app that shows how to use System.Reactive
and ReactiveUI with Terminal.Gui. The app uses the MVVM architecture
that may seem familiar to folks coming from WPF, Xamarin Forms, UWP,
Avalonia, or Windows Forms. In this app, we implement the data
bindings using ReactiveUI WhenAnyValue syntax and Pharmacist — a tool
that converts all events in a NuGet package into observable wrappers.
Representing a view model on the command line sound like a natural mismatch. There are engines for drawing views using the terminal, however, in my opinion you should target the command line not with a mvvm pattern. MVC where the view is the console and the controller received the command line sounds like a better fit.
Lets say I have a standalone ASP.NET Core Web API as its own project (since I don't want to merge it w/ my MVC app)
I now want to create an MVC web application (another project, but same solution) that will make calls to the API. I am aware that for ajax requests I will directly call the API through JavaScript which is straight forward.
However, I am a bit confused as to how the MVC controller would make calls to the same API to populate the ViewModel and send to the View when a user requests a page i.e. http://myurl/books/1
I am aware that if I was using something like Angular which is fully client-side I wouldn't be running into this issue.
That's a good question. There's three different approaches that I can think of:
The first is to call the same API from your MVC controller with a HTTPClient object. Might seem a bit weird calling "yourself" on the server side but it works. In my opinion this isn't a great solution, because you're losing type-checking and you'll also making an unnecessary call over the network, and you also have to parse and convert the response back from WebAPI to your .net objects.
The second approach is to move all of the logic that's inside the API into a new project and compile it all down to a DLL. Your Web Api can then call the code inside the library and your MVC project can do it too. A pretty good approach.
The third approach is to do what you've suggested - don't populate the Model at all on the server side inside your MVC project and just do it all from the client side. Yes, this will work great with Angular but you can also do this yourself using bog-standard JQuery or Knockout. This approach means much more client side javascript to write (use Typescript!) but you'll end up with a much nicer separation of concerns and cleaner solution.
I am an admin of a Facebook Page. Now it want to involve it in my MVC Project. I was wondering if it is possible to :
1)fetch its data (such as profile pic ,about,events,who is attending etc) from fb and showing it in my ASP MVC View.
2) involve all the features provided by fb (to the page)in MVC project. e.g. creating an event, adding photos and videos.
3) is there any way to Authorize forms via fb authentication.
if this is achivable how should i proceed? what are the prerequisites?
any blog/link/tutorial/study material for this?
Facebook has a clean API you can use to integrate it into your applications. It's called the Graph API, they have the docs on their site:
http://developers.facebook.com/docs/coreconcepts/
The Graph API is designed to perform various operations, if something is to be done, it can be done via the Graph API.
As for the authentication, yes, it's fairly simple, Facebook implements the OAuth2 protocol. Just google on "C# OAuth2 Facebook" or something similar and you will get links to complete tutorials.
The docs from Facebook team are here:
http://developers.facebook.com/docs/authentication/server-side/
I am really having a problem about what to use as an alternative for web flow. I have read that not all functionalities should be handled by web flow. Only those which needs complex xstate management. For those easy stuffs like just login, editing or deleting records what will I use as an alternative for web flow?
Spring Web flow is specifically designed to implement complex page flows. It is an extension of Spring MVC and a tool to specify page navigation rules and manage navigation.
Spring Web flow provides fundamental answers to the following major problems in web application development:
How to specify page navigation rules?
How to manage navigation and conversational state?
How to ensure modularity and code reuse?
It is also integrated with JSF component model and used mostly for enterprise application development. There are not so many alternatives but but for Vaadin component model you can consider Lexaden Web Flow as possible alternative.
How did you build websites before Web Flow?
My understanding is that if something needs "back" functionality that has state information stored - like a "wizard", for example - Web Flow is the way to go. If you don't have state, I'd expect you'd build those pages as you always have.