52 Replies
What do you mean?
You don't generally "refer" to other source files.
There are XAML file and its code behind. I want to refer other class in it.
Oh, Is it not referring 😅
I mean, I want to add the class method in xaml.cs file or call out the xaml.cs in class
I mean, just as you would in any other project?
Has nothing to do with wpf
Add a
using
directive for the namespace the other class is in, and then just use itall of them are in same project.
I'm saying it doesn't matter if it's WPF, or WinForms, or a Console app, or just a class library
Accessing classes in other files always works the same
Sorry. I'm new to this language. Could you explain it more clearly.
I called this class1 in Mainwindow.xaml.cs directly and got error.
If I called this class1 in Class2 (just to make sure if it works) and it worked.
What error
Here is how I called the class in Mainwindow.xaml.cs
That doesn't really have anything to do with it being in another file
You're doing everything right, it's an issue with the SpeechRecognizer class
I'm running this class only and getting speech recognition result.
I don't think it's a problem of this class.
It quite obviously is an issue with SpeechRecognizer
That's the line that throws
So look up what SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND means
SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND was only in python.
Solution was to delete another version of python.
It quite clearly is not only in python
I guess so.
you probably shouldnt be creating an instance every time
but thats unrelated to the issue
There are 2 different methods though. Is that bad btw
if the other one works then use that
theres probably something wrong in your config
Do you mean if I create 2 methods in 1 button, It would crack?
no
im saying if
SpeechConfig.FromSubscription
works, then use that rather than the ctor
oh wait, thats just a config
are you sure your api key is correct
also use Task.Run
rather than instantiating a taskI changed api key for SS.
ik
try the speech recognizer in new blank console app
with a simple example
do you mean the whole class
wdym
sorry. what do you mean by that
new blank app
I didn't get that sorry.
just to test the speech recognizer
no gui
as an class right?
to eliminate other variables
what do you mean
I meant whole class is this.
did you mean this source code or just line 25?
Is this resolved or can I help?
just test
SpeechRecognizer
not yet.
wow. I'm sorry I really thought it's impossible. I'll try it
Can I ask, what exactly are you attempting to create?
TLDR ^
XAML is for frame. in xaml.cs, I reference eye tracking API to get gazing point and declared in it.
And the class1.cs is to get real time speech recognition.
Is that clear?
Yeah I sort of understand it, what's the issue exactly? Can you send me your code that's having it and you want changed?
How should I send you? Is screenshot ok?
Well first can you tell me the problem, then just send it in a txt format.
I tried to call the class1.cs which is get speech recognition as a result string in Mainwindow.xaml.cs. But I got a error.
the error is here
So, What I thought is, the problem is that I'm trying to call the class1.cs in xaml.cs file
I've never worked with speech recognition so I can't give you any tips, sorry man.
ohh I see
It's okay thank you
But I think the problem is not in speech recognition class.
Yes it is
It so obviously is
I'm really wonder why it's working if I call it in other class
where is it working
Crystal ball out of order
Thank you guys. If have another advice please let me know.
The advice is to post the code where you're saying it works
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.Unknown User•2y ago
Message Not Public
Sign In & Join Server To View