exit - .EXE getting stuck after closing program with red X button built in to WPF program -
i'm sure being caused 1 of loops not shutting down right wrong. know x should close way gets stuck open. have tried make exit out using default x built in not work, use normal exit function hangs open on pc. having reboot close. not closing process tree close out.
using system; using system.collections.generic; using system.linq; using system.text; using system.windows; using system.windows.controls; using system.windows.data; using system.windows.documents; using system.windows.input; using system.windows.media; using system.windows.media.imaging; using system.windows.navigation; using system.windows.shapes; using system.componentmodel; using system.data; using system.text.regularexpressions; using system.io; using system.timers; using system.threading; namespace verifone_note_secure { /// <summary> /// interaction logic mainwindow.xaml /// </summary> public partial class mainwindow : window { public mainwindow() { initializecomponent(); richtextbox1.spellcheck.isenabled = true; richtextbox2.spellcheck.isenabled = true; richtextbox3.spellcheck.isenabled = true; richtextbox4.spellcheck.isenabled = true; richtextbox5.spellcheck.isenabled = true; richtextbox6.spellcheck.isenabled = true; textbox1.spellcheck.isenabled = true; style nospacestyle = new style(typeof(paragraph)); nospacestyle.setters.add(new setter(paragraph.marginproperty, new thickness(0))); richtextbox1.resources.add(typeof(paragraph), nospacestyle); richtextbox2.resources.add(typeof(paragraph), nospacestyle); richtextbox3.resources.add(typeof(paragraph), nospacestyle); richtextbox4.resources.add(typeof(paragraph), nospacestyle); richtextbox5.resources.add(typeof(paragraph), nospacestyle); richtextbox6.resources.add(typeof(paragraph), nospacestyle); textbox1.fontsize = 20; application.current.mainwindow.closing += new canceleventhandler(mainwindow_closing); dispatchertimer.tick += dispatchertimer_tick; dispatchertimer.interval = new timespan(0, 0, 0, 0, 140); dispatchertimer.start(); } system.windows.threading.dispatchertimer dispatchertimer = new system.windows.threading.dispatchertimer(); private int iscroll; private string strstring; streamreader reader; streamwriter writer; private void dispatchertimer_tick(object sender, eventargs e) { try { reader = file.opentext(@"scrollingtext.txt"); strstring = reader.readtoend(); if (strstring.length <= 1) { reader.close(); writer = file.createtext(@"scrollingtext.txt"); writer.write(" please enter text scrollingtext.txt give personal messages "); writer.close(); reader = file.opentext(@"scrollingtext.txt"); strstring = reader.readtoend(); } } catch { writer = file.createtext(@"scrollingtext.txt"); writer.write(" please enter text scrollingtext.txt give personal messages "); writer.close(); reader = file.opentext(@"scrollingtext.txt"); strstring = reader.readtoend(); } iscroll = iscroll + 1; int ilmt = strstring.length - iscroll; if (ilmt < 56) { iscroll = 0; } string str = strstring.substring(iscroll, 56); label2.content = str; } void mainwindow_closing(object sender, canceleventargs e) {// when form closes reader.close(); } private void kb_click(object sender, routedeventargs e) { system.diagnostics.process.start(""); } private void veriweb_click(object sender, routedeventargs e) { system.diagnostics.process.start(""); } private void critrix_click(object sender, routedeventargs e) { system.diagnostics.process.start(""); } private void amdocs_click(object sender, routedeventargs e) { system.diagnostics.process.start(""); } private void preescalationchecklist_click(object sender, routedeventargs e) { system.diagnostics.process.start(""); } private void clearpumpsonhold_click(object sender, routedeventargs e) { system.diagnostics.process.start(""); } private void clearreservedpumps_click(object sender, routedeventargs e) { system.diagnostics.process.start(""); } private void dcrpollerror_click(object sender, routedeventargs e) { system.diagnostics.process.start(""); } private void dcrhold_click(object sender, routedeventargs e) { system.diagnostics.process.start(""); } private void topazstuckonwhitescreen_click(object sender, routedeventargs e) { system.diagnostics.process.start(""); } private void unabletologintotopaz_click(object sender, routedeventargs e) { system.diagnostics.process.start(""); } private void remoteserviceisdown_click(object sender, routedeventargs e) { system.diagnostics.process.start(""); } private void mx8xxpinpadcommunications_click(object sender, routedeventargs e) { system.diagnostics.process.start(""); } private void monthlyclosestopsprinting_click(object sender, routedeventargs e) { system.diagnostics.process.start(""); } private void commanderputtycommands_click(object sender, routedeventargs e) { system.diagnostics.process.start(""); } private void commanderecpleasechecksystemwdt_click(object sender, routedeventargs e) { system.diagnostics.process.start("[enter image description here][1]"); } private void fuelcommerrornofuelfunctionsnow_click(object sender, routedeventargs e) { system.diagnostics.process.start(""); } private void posfuelandsalesquickreference_click(object sender, routedeventargs e) { system.diagnostics.process.start(""); } private void commanderfueldcrconfiguration_click(object sender, routedeventargs e) { system.diagnostics.process.start(""); } private void t3_click(object sender, routedeventargs e) { richtextbox1.document.blocks.clear(); richtextbox1.appendtext(""); } private void responsetovascreturningcall_click(object sender, routedeventargs e) { richtextbox1.document.blocks.clear(); richtextbox1.appendtext(""); } private void pinpaders_click(object sender, routedeventargs e) { richtextbox1.document.blocks.clear(); richtextbox1.appendtext(""); } private void valerocstdispatchrequest_click(object sender, routedeventargs e) { richtextbox1.document.blocks.clear(); richtextbox1.appendtext(""); } private void pantrydispatchrequest_click(object sender, routedeventargs e) { richtextbox1.document.blocks.clear(); richtextbox1.appendtext(""); } private void generaldispatchtemplate_click(object sender, routedeventargs e) { richtextbox1.document.blocks.clear(); richtextbox1.appendtext(""); } private void sppdispatch_click(object sender, routedeventargs e) { richtextbox1.document.blocks.clear(); richtextbox1.appendtext(""); } private void dialint2template_click(object sender, routedeventargs e) { richtextbox1.document.blocks.clear(); richtextbox1.appendtext(""); } private void vantagetemplate_click(object sender, routedeventargs e) { richtextbox1.document.blocks.clear(); richtextbox1.appendtext(""); } private void exxon_click(object sender, routedeventargs e) { clipboard.settext(regex.replace(exxon.header.tostring(), "[a-za-z : ]", "")); } private void shellvantage_click(object sender, routedeventargs e) { clipboard.settext(regex.replace(shellvantage.header.tostring(), "[a-za-z : ]", "")); } private void shell_click(object sender, routedeventargs e) { clipboard.settext(regex.replace(shell.header.tostring(), "[a-za-z : ]", "").remove(12)); } private void plenti_click(object sender, routedeventargs e) { clipboard.settext(regex.replace(plenti.header.tostring(), "[a-za-z : ]", "")); } private void worldpay_click(object sender, routedeventargs e) { clipboard.settext(regex.replace(worldpay.header.tostring(), "[a-za-z : ]", "")); } private void hughe_click(object sender, routedeventargs e) { clipboard.settext(regex.replace(hughe.header.tostring(), "[a-za-z : ]", "")); } private void chevron_click(object sender, routedeventargs e) { clipboard.settext(regex.replace(chevron.header.tostring(), "[a-za-z : ]", "").remove(12)); } private void mako_click(object sender, routedeventargs e) { clipboard.settext(regex.replace(mako.header.tostring(), "[a-za-z : ]", "")); } private void pccommander_click(object sender, routedeventargs e) { richtextbox5.appendtext("power cycled commander "); } private void pcfci_click(object sender, routedeventargs e) { richtextbox5.appendtext("power cycled forecourt controller "); } private void pcezr_click(object sender, routedeventargs e) { richtextbox5.appendtext("power cycled enhanced zone router "); } private void pcsapphire_click(object sender, routedeventargs e) { richtextbox5.appendtext("power cycle sapphire "); } private void initdcr_click(object sender, routedeventargs e) { richtextbox5.appendtext("initialized dispenser card reader "); } private void initfuel_click(object sender, routedeventargs e) { richtextbox5.appendtext("initialized fuel "); } private void reseatcables_click(object sender, routedeventargs e) { richtextbox5.appendtext("reseated cables "); } private void accessedputty_click(object sender, routedeventargs e) { richtextbox5.appendtext("accessed site via putty @ "); } private void configcheck_click(object sender, routedeventargs e) { richtextbox5.appendtext("check configuration client "); } private void cng_click(object sender, routedeventargs e) { richtextbox6.appendtext("case number given "); } private void cnd_click(object sender, routedeventargs e) { richtextbox6.appendtext("case number declined "); } private void cfchecktr_click(object sender, routedeventargs e) { richtextbox5.appendtext("cfcheck on topaz/ruby "); } private void button1_click(object sender, routedeventargs e) { //copy button string copyall = ""; string newline = "\n"; richtextbox2.selectall(); richtextbox3.selectall(); richtextbox4.selectall(); richtextbox5.selectall(); richtextbox6.selectall(); copyall += richtextbox2.selection.text + newline + richtextbox3.selection.text + newline + richtextbox4.selection.text + newline + richtextbox5.selection.text + newline + richtextbox6.selection.text; clipboard.settext(copyall); } private void button7_click(object sender, routedeventargs e) {//clear button //if (system.datetime.now > new system.datetime(2015, 10, 30)) { // messagebox.show("please contact tech support, new trial version", "trial expired!!", messageboxbutton.ok, messageboximage.warning); // application.current.shutdown(); //} if (messagebox.show("do want clear all?\nthis includes clipboard", "warning!", messageboxbutton.yesno, messageboximage.warning) == messageboxresult.yes) { richtextbox1.document.blocks.clear(); richtextbox2.document.blocks.clear(); richtextbox3.document.blocks.clear(); richtextbox4.document.blocks.clear(); richtextbox5.document.blocks.clear(); richtextbox6.document.blocks.clear(); textbox1.clear(); clipboard.clear(); } } private void button8_click(object sender, routedeventargs e) {//copy name textbox1.selectall(); textbox1.copy(); } private void button9_click(object sender, routedeventargs e) {//copy template area richtextbox1.selectall(); richtextbox1.copy(); } private void button2_click(object sender, routedeventargs e) {//copy box 1 richtextbox2.selectall(); richtextbox2.copy(); } private void button3_click(object sender, routedeventargs e) {//copy box 2 richtextbox3.selectall(); richtextbox3.copy(); } private void button4_click(object sender, routedeventargs e) {//copy box 3 richtextbox4.selectall(); richtextbox4.copy(); } private void button5_click(object sender, routedeventargs e) {//copy box 4 richtextbox5.selectall(); richtextbox5.copy(); } private void button6_click(object sender, routedeventargs e) {//copy box 5 richtextbox6.selectall(); richtextbox6.copy(); } private void button10_click(object sender, routedeventargs e) { richtextbox[] rtextbox = { richtextbox1, richtextbox2, richtextbox3, richtextbox4, richtextbox5, richtextbox6 }; overalltextreplace(rtextbox); } public void overalltextreplace(richtextbox[] rtb) { string[] keyword = { "fci", "cnd", "cng", "dcr", "ezr", "vasc", "pc", "sfc" }; string[] newstring = { "forecourt controller", "case number declined ", "case number given", "dispenser card reader", "enhanced zone router", "verifone authorized service contractor", "power cycle", "smart fuel controller" }; (int = 0; < rtb.length; i++) { richtextbox rtb_wording = rtb[i]; var textrange = new textrange(rtb_wording.document.contentstart, rtb_wording.document.contentend); string rtf; using (var memorystream = new memorystream()) { textrange.save(memorystream, dataformats.rtf); rtf = asciiencoding.default.getstring(memorystream.toarray()); } (int j = 0; j < keyword.length; j++) { rtf = rtf.replace(keyword[j], newstring[j]); } memorystream stream = new memorystream(asciiencoding.default.getbytes(rtf)); rtb_wording.selectall(); rtb_wording.selection.load(stream, dataformats.rtf); } } } }
Comments
Post a Comment