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

Display version to popup in the Demo App #3736

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

amina-sab
Copy link

@amina-sab amina-sab commented Dec 4, 2024

Related to the issue #3734
Review please @corvinsz @Keboo :)

@@ -45,6 +45,9 @@ jobs:
MDIXColorsVersion: ${{ inputs.mdix-colors-version }}
MDIXMahAppsVersion: ${{ inputs.mdix-mahapps-version }}

- name: Generate Version File
run: echo ${{ inputs.mdix-version }} > src/MainDemo.Wpf/version.txt

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels kinda hacky, but I unfortunately can't suggest a better way because I don't have much experience with pipelines.

@@ -36,6 +36,7 @@
<Button Content="Hello World" />
<Button Content="Nice Popup" />
<Button Content="Goodbye" />
<Button Content="Version" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this should also be a button since there is no functionality behind it, but I guess it's so this fits in with the rest of the items (Buttons) above

@@ -38,6 +38,7 @@
<ListBoxItem Content="Hello World" />
<ListBoxItem Content="Nice Popup" />
<ListBoxItem Content="Goodbye" />
<ListBoxItem Content="Version" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having something app-specific on a page which showcases a Material Design component is debatable, but I don't mind that much

Comment on lines +119 to +138
private void LoadVersion()
{
try
{
string versionFilePath = Path.Combine(Directory.GetCurrentDirectory(), "version.txt");
if (File.Exists(versionFilePath))
{
string version = File.ReadAllText(versionFilePath).Trim();
VersionText.Text = $"Version: {version}";
}
else
{
VersionText.Text = "Version file not found";
}
}
catch (Exception ex)
{
VersionText.Text = $"Error reading version: {ex.Message}";
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though the demo app isn't there to showcase best practices/design patterns, I would argue being consistent and binding a Version property in a MVVM way, rather than having all that logic in the code behind, is preferred.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for comments, yoj mean that is preferable to have a class only to load the version and link it to the MVVM class? Did I understand correctly?

@Keboo
Copy link
Member

Keboo commented Dec 5, 2024

Hey @amina-sab, while reviewing your PR, I'd suggest the following code changes:

👉 Code Suggestion for #3736

#3736

I added some suggestions as a cloud patch (let me know if you have any trouble viewing it).

Some key changes here:

  1. You can access the environment variables to get the versions. I left some code showing how to do this.
  2. You can setup a string property in the view model and bind that in the XAML rather than the code behind.
  3. There are several TODO items I left in the cloud patch, let me know if you have any questions on them.
  4. If you want to see my review of this, I did it it live on twitch. It is at the beginning of this stream. https://www.twitch.tv/videos/2318667161

You can also review and apply these suggestions locally on your machine.

Learn more about GitKraken Code Suggest

Code Suggest liberates your code reviews from GitHub's restrictive, comment-only feedback style. As simple as suggesting changes in a Google-doc, provide real code suggestions from where you code, e.g. your IDE, and on anything in your project — not just on the lines of code changed in the PR.

Join your team on GitKraken to speed up PR review.

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

Successfully merging this pull request may close these issues.

3 participants