Sample Xamarin.Forms Project Without Using XAML - c#

Late to the party and new to Xamarin.Forms. I'm looking for an example Xamarin.Forms app (sample code) which does not use any XAML, or, as little as possible. This is because I'm translating from an existing C# project where all of the user interface elements are built in code.
The existing project has two what would be called "forms": a splash form, and an application form. The structure of the application form changes dynamically - for example, depending on the GPS coordinates of the user at start-up, hence the dynamic building of the form.
The two "forms" exist as independent classes extending ContentPage and using AbsoluteLayout. My difficulty boils down to how to get the splash screen to display at start-up, and then, after determining what my application form should look like and establishing its structure, hiding the splash form and showing the application form.
The building of the splash and application interfaces already take into account scaling for display size and orientation.
We have googled around a fair bit on this end but apparently we're not googling the right thing.

Related

C# Embedd A Non-Winforms Application into a Winform Application

I want to embedd an application (Hikvision iVMS-4200) into my winform .net application. The application appears to use custom rendering for its GUI, and a loading screen appears before the main window is launched.
In more detail, I want the window of this app to be confined within the window area of my application in a locked position (user can't move the embedded window), and display other things in the same parent window (for example a picture).
I have tried solutions such as this. It worked perfectly, but only with notepad. This solution doesn't work with the application I want (the process is opened successfuly but it is in a completely independant window).
My guess is that the app (again, Hikvision iVMS-4200) uses OpenGL for a custom GUI or another type of non-native GUI library. As a though, shouldn't any application on windows have atleast a single main window? could I access and edit its position and parenting properties? Any solution would be highly appreciated.

How do I scale hybrid (WPF / WinForms) applications correctly

I am currenlty developing a plugin for an existing 3rd part system. The plugin exposes a GUI, which is defined to be WPF by the plugin framework. However, i have to integrate a legacy WinForms control that is hidden in a library (no source code available).
Using WinFormsHost works great, as long as the Display scaling is set to 100%. If the settings are different, my embedded WinForms control scales awkward and doesn't look good anymore.
If I create a WinForms Window and embed the control, scaling is fine.
If I create the same window from a WPF application / Window and push the WinForms window into the WPF window with HwndHost, scaling is awkward again.
It seems that scaling is only correct when i start my WinForms window in a separate process outside the 'WPF' environment.
I should be able to catch the separate process' window and get proper scaling, but communication into my legacy window may become tricky then.
Is there a way to get proper scaling without the detour via a separate process? I know that similar questions have been posted here, but so far i did not find what i was looking for.
Thanks in advance.

Running two Windows Form application at a time

I have two different form applications. One form Application opens my camera and captures my head gesture, and the other application is just a game. Both the program run perfectly separately. All I need to know is how to merge this application. In short I want to run both at a time. The reason is I need to control the game application with my head gesture. There is not any code to add because I have not merge them so no error log as well. Please help me out to do this. Thanks
You need to create one windows form application which has a single form and include both forms in this app side by side. Make sure that you have all assets to be copied along with the forms otherwise you will face error outputs and design time errors.
adding both forms is into same layout is just by adding them as sub component in your new layout.

What's the equivalent of calling Activity.finish() in a WinForms application?

In Android when finished with an Activity and want to return to previous activity you use finish();.
Is there an equivalent in WinForms using C#? In my application once the user clicks the Enter button I want the user to return to previous window.
Base on a superficial understanding of an Activity in Android (sounds like a window element), you just need to call Close on the current window, then the previous one will then move to the foreground.
For future reference however, I would advise you not too create such analogies between two radically different technologies since the life cycle of an Activity in Android is radically different from a form in a Windows Form application. You should try to learn the framework rather than replicating an implementation from a different framework/platform.

Proper Windows Forms multi screen program

I'm trying to build a rather simple Windows Application for the employees that process our payroll (currently it's a vbscript/terminal combination). The logic is mostly worked out, but I'm trying to find out what the best way build a Windows Forms application that has multiple screens (login/etc). I've been using the TabControl container for this, but just wasn't sure if this was correct...or 'common'.
If this is what is normally done are the contents of the tabs generally made up of User Control object or are they just filled with different layouts on the tab?
I doubt I need much in the way of help on the coding side, but more the "how a gui" is normally laid out in the visual designer.
EDIT: Just to provide a basis of the screens that I'm needing to build. I'm currently planning on having a Login Screen and the three screens that guide the user through processing two different types of payroll and then certain accounts receivables work. Primarily I will have two user types. The ones that process payroll and the ones that do accounts receivable work. I'm wanting to make this easily expandable so that as I build in more functionality it's not a major pain to add screens and limit who can see them.
What I ended up doing is removing the "Login Screen" as hinted to in the question. Instead of a Login Screen and the corresponding logic being required I ended up doing integration with our Active Directory Server.
Once this integration was done I simply design the Screens as UserControl elements and then add each one to a tab based on if the user is in a specific group or not.
Doing this solved my main concern of having a heavy main form containing logic. Now the only logic in the main form is whether or not to add a tab based on Active Directory groups.

Categories

Resources