Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1928350
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:58:03+00:00 2026-05-17T06:58:03+00:00

I have got a collection of viewModels(InputViewModel) in an other viewModel(ScenarioManager). each InputviewModel has

  • 0

I have got a collection of viewModels(InputViewModel) in an other viewModel(ScenarioManager).
each InputviewModel has an instance of a Class(RestOfInput) which contains properties able to raise the OnPropertyChanged.
when one of these properties changes the event is handled by this method (in InputViewModel) :

        public void TestAfterChanges(object sender, PropertyChangedEventArgs e)
        {
            MessageBox.Show("not ref");
            bool isInTheList = false;
            RestOfInput roi = sender as RestOfInput;
            string prop = e.PropertyName;

            if (prop!="NameFile")
            { 
                Difference d = new Difference();
                d.Length = prop;
                d.Value1 = reference.RoI.getValueByPropertyName(prop);
                d.Value2 = roi.getValueByPropertyName(prop);

                foreach (Difference diff in _ListOfDifferences)
                {
                    if (diff.Length==prop)   
                    {
                        if ( (Math.Abs(d.Value2-d.Value1)>0.001*d.Value1))
                        {
                            //replace by le new one
                             _ListOfDifferences.Insert(_ListOfDifferences.IndexOf(diff), d);
                            _ListOfDifferences.Remove(diff);
                        }
                        else
                        {
                            //if change make the field value equal to the ref then remove from difference list
                            _ListOfDifferences.Remove(diff);
                        }
                        isInTheList = true;
                    }

                }

                if ((Math.Abs(d.Value2 - d.Value1) > 0.001 * d.Value1) && isInTheList==false)
                {
                    _ListOfDifferences.Add(d);
                }

            }


        }

this method gives just a summary of the differences between this particular case and the reference case.

Now if the reference case changes I have to update all the cases and the event is handled
in ScenarioManager :

    public void refCaseChanging(object sender, PropertyChangedEventArgs e)
    {
        MessageBox.Show("ref");

        string propname = e.PropertyName;      
        foreach (InputViewModel item in _casesList)
        {
            if (item!=inpVM)
            {
                item.RoI.OnPropertyChanged(propname);
            }                
        }

    }

inpVM is the reference case.

Then I have this behavior :
-if I change a field in a case which is not the reference case : everything is ok.
-if I change a particular field in the reference case : the first time, everything is ok.
But the second time, only the reference case and the first case (in the collection) which is not the reference case are updated>
It is like the foreach loop is broken..

Any explications.

If the message is not clear please tell me ( not easy to explain 😉 )

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T06:58:03+00:00Added an answer on May 17, 2026 at 6:58 am

    An exception could explain that processing stops (although one expects that it would be caught and displayed somewehre).

    Have you tried to ask VS to halt your program when an exception is thrown ? (if you have never done this before, go to Debug / Exceptions and check the check box for CLR exceptions)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a main page which uses a ViewModel I have created: public class
I have got a python script which is creating an ODBC connection. The ODBC
We have got loads of options for php + MySQL + Apache combo... Which
I have got the following problem since the server has safe mode turned on,
I have got some code to load an assembly and get all types, which
I have got two classes, one a subclass of the other (say Animal and
I've got a collection of ViewModels that are rendered as tabs using a style
I've got a WPF application where PageItems are model objects. My main ViewModel has
I have the following method which returns true when a PropertyInfo instance references an
I have a login.jsp page which contains a login form. Once logged in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.