Code Monkey home page Code Monkey logo

Comments (4)

MattMcManis avatar MattMcManis commented on May 22, 2024

Thanks for finding this, I had not thought this far ahead for the upgrade process.

For a quick fix, in ReadConfig() I made Shell_SelectedItem select CMD as default if it has loaded an empty value.

// read from conf
VM.ConfigureView.Shell_SelectedItem = conf.Read("Settings", "Shell_SelectedItem");

// default if empty
if (string.IsNullOrEmpty(VM.ConfigureView.Shell_SelectedItem))
{
    VM.ConfigureView.Shell_SelectedItem = "CMD";
}

I've released an update.

I deleted the config and did a test upgrading v1.7.8.1 to v1.8.4.1 and it seems to work, both Run and Convert buttons function.

from axiom.

MattMcManis avatar MattMcManis commented on May 22, 2024

Another way I've decided to go.

I've set null checks for all items in the ReadConfig().

If it imports an empty value from axiom.conf, it will skip it and let the ViewModel LoadControlsDefaults() set the default value.


ReadConfig()

// Shell

// read from conf to temp string
string shell_SelectedItem = conf.Read("Settings", "Shell_SelectedItem");

// skip if value is empty
if (!string.IsNullOrEmpty(shell_SelectedItem) && 
    !string.IsNullOrWhiteSpace(shell_SelectedItem))
{
    // use imported conf value
    VM.ConfigureView.Shell_SelectedItem = shell_SelectedItem;
}

LoadControlsDefaults()

// load at startup
Shell_SelectedItem = "CMD";

Let me know if this works for you.

from axiom.

mjebrahimi avatar mjebrahimi commented on May 22, 2024

It works now πŸ‘.

This is good way to check the value before set but it would be better if you wrote a static method to prevent you from repeating your code.

In addition the string.IsNullOrWhiteSpace method also checks for empty so there is no need to IsNullOrEmpty.

from axiom.

MattMcManis avatar MattMcManis commented on May 22, 2024

That's good to know about string.IsNullOrWhiteSpace, I thought empty and whitespace each had their own.

I will go through and optimize the code.

from axiom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.