This forum is for programmers who have questions about the source code.
-
mopensoft
- Posts: 146
- Joined: Tue Dec 04, 2012 3:33 pm
- Location: Melbourne, Australia
-
Contact:
Post
by mopensoft » Wed Jul 06, 2016 2:58 am
I got this error from time to time (not all the time). The plugin pass one PrefName but when it runs in OpenDentBusiness.PrefC code, it changes to different PrefName. It's very unpredictable the behavior of this function. Please see example below:
I call
PrefC.GetString(PrefName.BirthdayPostcardMsg) and when it runs the function code, it turns
PrefName.BirthdayPostcardMsg into
PrefName.BillingUseBillingCycleDay.
I got this error with my other plugin when try to get the
ConfirmTextMessage but it is changed into
ConfirmStatusTextMessaged
Is there anyway to make it works correctly?
Thanks
M
-
mopensoft
- Posts: 146
- Joined: Tue Dec 04, 2012 3:33 pm
- Location: Melbourne, Australia
-
Contact:
Post
by mopensoft » Wed Jul 06, 2016 3:06 am
even this code
Code: Select all
string greeting2 = PrefC.GetRaw(PrefName.BirthdayPostcardMsg.ToString());
PrefName.BirthdayPostcardMsg.ToString() become "BillingUseBillingCycleDay" instead of "BirthdayPostcardMsg".
It's strange.
-
tgriswold
- Posts: 122
- Joined: Fri Jun 07, 2013 8:52 am
Post
by tgriswold » Wed Jul 06, 2016 11:51 am
Because PrefName is an enum (really just passed as an int position in the enumeration) it almost seems like the call is using a different version of the enum then the GetString() function. Might check to see that your OpenDentBuisness reference isn't pointing to an older version? Or try cleaning the solution and recompiling (sometimes Visual Studios does some weird stuff and a clean usually fixes most "this is weird" errors)
-
mopensoft
- Posts: 146
- Joined: Tue Dec 04, 2012 3:33 pm
- Location: Melbourne, Australia
-
Contact:
Post
by mopensoft » Wed Jul 06, 2016 5:16 pm
GetString refers to the latest version of OpenDentBusiness, how can it call a different version of enum? integer value of BirthdayPostcardMsg is 91 but when pass to GetString, it become 88 which is BillingUseBillingCycleDay.
UPDATE:
- After multiple update and clean up, it finally works as expected. I would go with GetRaw(string prefName) for the time being. Hope the name of the Pref will not change.
Thanks for your advice
M
Last edited by
mopensoft on Wed Jul 06, 2016 6:15 pm, edited 1 time in total.
-
jwhitney
- Posts: 33
- Joined: Tue Jul 01, 2014 9:52 am
Post
by jwhitney » Wed Jul 06, 2016 5:42 pm
Are you giving your Enum a default value? I have seen it mess up like this if you did something to this when making your Enum:
public enum PrefNames {
....
BirthdayPostcardMsg=88,
....
}
Other than that, I can't think of any other reason why the OpenDentBusiness that you compiled with your enum in it wouldn't know about the Enum you made.
In order to understand recursion you must first understand recursion.
Josh Whitney
Open Dental Software
1-503-363-5432
http://www.opendental.com
-
mopensoft
- Posts: 146
- Joined: Tue Dec 04, 2012 3:33 pm
- Location: Melbourne, Australia
-
Contact:
Post
by mopensoft » Wed Jul 06, 2016 6:20 pm
No, I would not touch OD code except adding hooks. I get the value by converting PrefName enum to INT.
I think the reason could be like tgriswold mentioned. I have to open OD 16.2.26 solution file, clean up and recompile. At first the problem still but after I upgrade to 16.2.28, clean up and recompile, OD solution. After than, go to my plugin project, remove and add reference to OD and ODBusiness again. It all works now. I guess that the referencing issue.