11
votes
Accepted
Task timer async
Initial observation is that you should avoid async void like
private async void start() {
//...
}
except for event ...
10
votes
Accepted
Using Mutex to prevent multiple WPF application launches
Thing that make me more unhappy is mixing UI logic of your MainWindow class with this single instance logic that really belongs to process (and then ...
10
votes
Countdown control with arc animation
There are a couple of things which could be more consistent.
...
10
votes
Accepted
9
votes
Accepted
Find a value in a comma delimited String
This could be a better/cooler way:
return (parameter as string)?.Split(',').Contains(value as string) ?? (object)false;
Your example is so short that I don't ...
9
votes
Accepted
Simple pack Uri builder
Your code looks pretty got but there are some things that you can simplify, probably the switch cases are the most unwanted part of your code.
Verbatim strings
...
8
votes
Accepted
MVVM - ObservableCollection & Entity Framework DbContext
An EF DbContext is an IDisposable object that should be as short-lived as possible.
There are a number of problems with this:
<...
8
votes
Accepted
Non-Entity framework database interaction model
Application Architecture
The architecture of the application is divided into models and views to separate the data and business model
from the user interface. Within the models there is an ...
7
votes
Shuffles male or females names based on Fisher Yates algorthim
The logic part of your code should definitely be re-written, but since it's one big mess I'm not going to touch that. See whether you really need that many options. You probably don't. I might expand ...
Mast♦
- 13.4k
7
votes
Accepted
WPF Mvvm async function ViewModel
General
Your model should not return an ObservableCollection because that collection should be used only if its change notification ability is needed (e.g. with ...
7
votes
Accepted
WPF Multiscreen Media Application
A way to reduce the amount of code in initialize and allow it to be more flexible is by putting your MediaElements into an array:
...
7
votes
Countdown control with arc animation
1) DispatcherTimer is good for periodic UI updates, but it should not be used to measure time, because it is just not accurate enough. For precise time measurement ...
6
votes
Another DataGrid (ObservableCollection) Filtering Method
You can refactor this into LINQ query for (arguably) better readability.
...
6
votes
Accepted
Optimize WPF application (2 WPF Windows and a huge mess)
I won't suggest you any miraculous improvements because the code is extremely hard to read this is, currently the worst mess in your code are the meaningless names.
...
6
votes
Accepted
Xaml Wpf Snake game
I'm going to review only the code in your post.
You don't use WPF as you have to. In WPF you don't need to perform clear/draw sequence. The right way is to use MVVM and update coordinates of the ...
6
votes
Task timer async
You're doing all your work in the 'code-behind' rather than a seperate viewmodel class, but for a project this small doing that 'right' would double the amount of code 😀
...
6
votes
Accepted
Loading a XAML file related to a control programmatically?
The conventional way of attaching default template to custom control is to specify default style inside a special resource dictionary. For this approach to work three conditions should be met:
1) ...
6
votes
Accepted
Simple calculator in C# WPF
It's common to write down access modifier for fields
Defining one field per line makes the code more readable because you dont have to scan each declaration line for multiple variables
Initialization ...
6
votes
Non-Entity framework database interaction model
I won't read this code beginning to end. Some basic advice:
Namespaces
ExperimentSimpleBkLibInvTool.ModelInMVC.DictionaryTabelBaseModel doesn't follow naming ...
6
votes
WPF Palindrome Checker Application
Specification
Palindrome
From wikipedia:
A palindrome is a word, number, phrase, or other sequence of
characters which reads the same backward as forward, such as madam or
racecar or the ...
6
votes
Accepted
TreeView class in WPF class
Review
I see no reason to have 3 constructors, each invoking the other, when two of them are private and only called by another constructor. Keep it simple.
You check for ...
6
votes
Loading BitmapImages out of a Zip file
var zipFile = ZipFile.OpenRead(ChapterLocation);
...
zipFile.Dispose();
One word: using.
...
6
votes
Accepted
WPF login screen and share username and access id across other forms
Some quick remarks:
If you're doing WPF, you should be using MVVM. There is a learning curve, but your code will be vastly easier to maintain once you add more and more features.
Much of the code ...
6
votes
Using default implementations to superpower flags enums with C#
What are you getting that you couldn't get with properties?
...
5
votes
Shuffles male or females names based on Fisher Yates algorthim
Instead of two lists like @Mast proposed, you could use a Dictionary and a List like:
...
5
votes
Simple pack Uri builder
You're likely to run across 101 different little gotchyas by rolling your own here. For example, you're not escaping any invalid characters in your solution.
I would build your implementation on top ...
5
votes
Accepted
MVVM Navigation WPF
One of the basic principals of MVVM is, that the view model doesn't know the view. My experience is, that this principal can be (and should be) applied for the most cases. However, it is possible that ...
5
votes
Using SQLite in WPF Project
Refactoring for Modularity
The whole point of using classes is making your code more modular. The ViewModel doesn't care about the database type. It could be SQLite, but it could also be PostgreSQL, ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
wpf × 331c# × 320
mvvm × 90
xaml × 67
.net × 34
beginner × 20
performance × 14
event-handling × 13
multithreading × 12
design-patterns × 10
async-await × 10
asynchronous × 9
entity-framework × 8
rubberduck × 7
databinding × 7
object-oriented × 6
image × 6
dependency-injection × 6
tic-tac-toe × 5
active-directory × 5
game × 4
linq × 4
database × 4
calculator × 4
generics × 4