Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve samples #419

Open
14 tasks
TysonMN opened this issue Aug 27, 2021 · 15 comments
Open
14 tasks

Improve samples #419

TysonMN opened this issue Aug 27, 2021 · 15 comments

Comments

@TysonMN
Copy link
Member

TysonMN commented Aug 27, 2021

There are several improvements that I would like to see the samples. To make it easier for other to help improve the samples, this issue will be an epic with a checklist that I keep this first comment updated with (hopefully) simple tasks.

Primary consolidated sample

I like how Material Design in XAML Toolkit has one sample for WPF that demonstrates everything. We have a project called Capabilities that is intended to be the start of this consolidated sample.

Patterns

Integration with thirds-party controls

If licensing permits, it would be nice to have samples that show how to integrate with third party controls.

Samples that demonstrate entries points

  • Traditional (i.e. though App.xmal). Advantage: corresponding resource code automatically generated if needed.
  • Explicit entry point in C#
  • Explicit entry point in F#

Related issues and comments

@Evangelink
Copy link
Contributor

@TysonMN regarding Telerik, they recommended me to use the "trial version":

Trial License
The free trial licenses of all Telerik products are fully functional and will work for an unlimited time but with trial error messages (see below) displayed randomly on the page.

Trial Error Messages
The trial licenses will occasionally display the following message on your application:

Telerik UI for WPF trial version. Copyright Telerik © 2002-2014. To remove this message, please, purchase a developer version.

More information on their website license page).

@TysonMN
Copy link
Member Author

TysonMN commented Sep 15, 2021

That seems fine. Let's have it be a separate executable/project then so that message doesn't also get displayed to people not interested in Telerik.

@rfreytag
Copy link
Contributor

rfreytag commented Jul 18, 2022

I found the transition from SingleCounter to NewWindow samples had a learning curve as SingleCounter does not have an App.fs and I was learning the structure of Elmish.WPF solutions. I have a working AnotherNewWindow that consolidates models and functions in Program.fs.

Would that be useful to others?

I have it in a separate branch of course at https://github.com/rfreytag/Elmish.WPF, branch: "Program_only_version_of_NewWindow"

@TysonMN
Copy link
Member Author

TysonMN commented Jul 18, 2022

Sure. Share a link to a branch containing your code, and I will take a look.

@rfreytag
Copy link
Contributor

rfreytag commented May 18, 2023

I found Sample/NewWindow.Core/App.fs hard to read. I have a version in my fork, branch: Adding_fully-specified_parameter_lists that I find more readable with the following changes:

  • Every function has fully-specified parameter lists and return values. Readability is improved by not having to hover over function names to see what the function manipulates.

  • module App, module Window1 and module Window2 have been renamed module App_Window1 and module App_Window2 so their usage in App.bindings is not confused with the actual references to Window2 in App.bindings.

  • Clarified module App, module Window1 and module Window2: get, set, and map so they specify the type on which they operate for readability. They are now respectively:

    • module App, module Window1: get_Window1State1, set_Window1State1, and map_Window1State1 and
    • module App, module Window2: get_Window2, set_Window2, map_Window2.
  • Replaced all usage of function with explicit match <parameter name> with in line with adding explicit parameter lists.

I added fully-specified parameter lists to the remaining Sample/NewWindow.Core F# files while I was at it.

Doing this helped me understand what was going on. I hope it will help others adopt Elmish.WPF. I will issue a pull request if you like where I'm going.

@marner2
Copy link
Collaborator

marner2 commented May 18, 2023

@rfreytag Go ahead and open a Pull Request for it. Modify the existing sample and that will make things easier to look at. They all sound good, especially if you found it helpful (empirical testing is the best testing).

@rfreytag
Copy link
Contributor

rfreytag commented May 19, 2023

Everything I did is what I think is the minimum necessary changes for readability from the original Sample/NewWindow.Core. Perhaps I'm missing your meaning?

@marner2
Copy link
Collaborator

marner2 commented May 19, 2023

@rfreytag I'm sorry, somehow I got it in my head that you had suggested you could make it as a separate example project.

I'd say it looks good exactly as you have it, and you should definitely open a PR.

@rfreytag
Copy link
Contributor

rfreytag commented May 19, 2023

@marner2 @TysonMN Having finally found the cycles to properly understand NewWindow.Core I am thinking its placement of most of the computation in App.fs is more flexible than putting all the computation in Program.fs (as done in the rest of the Samples).

It shows us novices how one can hand control between multiple Core F# files and multiple modules. Its been a while since you were as new as I. :-)

Would you accept a change that altered Capabilities.Core to also have a terse Program.fs with a main that essentially calls into functions in App.fs as is done in NewWindow.Core?

@TysonMN
Copy link
Member Author

TysonMN commented May 19, 2023

That sounds good.

My idea with the Capabilities sample is that most of the samples would be combined into that one. Does that make sense?

World you like to do that combining?

@rfreytag
Copy link
Contributor

rfreytag commented May 19, 2023

@TysonMN That makes sense. As you can see I am returning to this after a long absence. Best if I take bites of this as I can and limit my broad commitments for now.

It is gratifying to have contributions evaluated; thank you.

@TysonMN
Copy link
Member Author

TysonMN commented May 19, 2023

No rush

poroburu added a commit to poroburu/Elmish.WPF that referenced this issue Jun 14, 2023
Improve samples elmish#419

[Syncfusion Community Licence](https://www.syncfusion.com/sales/communitylicense)

* copy directory `Samples` to `Samples.Syncfusion`

* append project directories with `Syncfusion.`
@ImaginaryDevelopment
Copy link

Is there a possibility to have an example of putting an Elmish.Wpf example into a functioning F# or C# normal Wpf solution? To show how to partially convert.

@TysonMN
Copy link
Member Author

TysonMN commented Aug 30, 2023

That is a reasonable idea. Thanks for suggesting it.

I think improving the existing samples is more important though, so I don't know when (or if) this improvement will happen.

@YkTru
Copy link

YkTru commented Dec 21, 2023

I suggest this example to guide Elmish.WPF newcomers coming from C#+MVVM; it's at least what I would have liked to have as a first tutorial (I think the abstract name says more about the general mindset to have when coming from C#, than a more specific counter-example, which is of course a good next step).

https://github.com/YkTru/Elmish.WPF-Samples-ViewModel/tree/master/ViewModel.Core

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants