i have following class stated below. raise event when has finished computing. vs-2015 tells me "you may not reference instance member of class without explicit instance of classes' methods.".
can tell me goes wrong here , how can solve problem? think every class can raise event.
thank you!
imports system.text imports system.io imports microsoft.win32 imports naudio.wave namespace voicerecorder.audio public class audiosaver public event finished() private _sinputpath string public property _tstrimfromstart timespan public property _tstrimfromend timespan ' public property _sffsavefileformat savefileformat public property _slameexepath string public sub new(byval uinputpath string) me._sinputpath = uinputpath end sub public readonly property istrimneeded boolean return _tstrimfromstart <> timespan.zero orelse _tstrimfromend <> timespan.zero end end property public sub saveaudio(byval uoutputpath string) dim stempfiles new list(of string) dim spathtoprocess = _sinputpath if istrimneeded() dim stempfile string = wavfileutils.gettempwavfilename() stempfiles.add(stempfile) wavfileutils.trimwavfile(_sinputpath, stempfile, _tstrimfromstart, _tstrimfromend) spathtoprocess = stempfile end if ' if _sffsavefileformat = savefileformat.mp3 converttomp3(me._slameexepath, spathtoprocess, uoutputpath) 'else ' file.copy(spathtoprocess, uoutputpath, true) 'end if deletetempfiles(stempfiles) end sub private sub deletetempfiles(byval tempfiles ienumerable(of string)) each tempfile in tempfiles if file.exists(tempfile) file.delete(tempfile) end if next tempfile end sub public shared sub converttomp3(byval lameexepath string, byval wavefile string, byval mp3file string) dim nconverter = process.start(lameexepath, "-v2 """ & wavefile & """ """ & mp3file & """") nconverter.waitforexit() raiseevent finished() end sub end class end namespace
got it. had remove "shared" attribute, still don't know why so.