private void Worker_DoWork(object sender, DoWorkEventArgs e) { UI_SolidWorks_SideBar_PlugIn.SFTPUploadFile(Client, "View_SW.png"); UI_SolidWorks_SideBar_PlugIn.SFTPUploadFile(Client, "test.stl"); UI_SolidWorks_SideBar_PlugIn.CreateFinishedFlag(); while (!UI_SolidWorks_SideBar_PlugIn.DownloadFile(Client, "DONE_researcher")) { Thread.Sleep(75); } UI_SolidWorks_SideBar_PlugIn.DownloadFile(Client, FileName); Client.DeleteFile("DONE_researcher"); Client.DeleteFile("View_Researcher_Feedback.png"); DialogResult = DialogResult.Yes; }
/// <summary> /// Default constructor and initialization of public members /// </summary> public UI_SolidWorks_SideBar_PlugIn() { // Set data context for FeatureTolerance List DataContext = this; // Default Initialization InitializeComponent(); Instance = this; // Set the data context globally, and the item source for the FeatureTolerance List FeatureTolerance_Display.ItemsSource = mFeatureTolerances; // Set home location to the location of this assembly (aka where this compiled .dll file is) // IMPORTANT: The location of this assembly relative to the SculptPrint folder matters // The folder hierarchy is defined in SolidWorks_DFM_PlugIn_Documentation.docx, Section 2c mHome = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); // Define the SculptPrint Folder // IMPORTANT: This is where files are exported to and uploaded from using SFTP // Keep this folder hierarchy consistent with that defined in SolidWorks_DFM_PlugIn_Documentation.docx, Section 2c MSculptPrint_Folder = mHome.Replace("\\Code\\Prototypes\\SongTelenkoDFM\\bin\\Debug", "\\SculptPrint\\Experiment Files\\"); FeedbackPNG_Save_Location = string.Concat(MSculptPrint_Folder, "View_Researcher_Feedback.png"); // Connect to SFTP client MClient = SFTPConnect(); // Delete previous experiment files stored on the local machine // Not doing so may cause errors in the work flow // (The subject may think the researcher already sent a finished flag) DeleteLocal(MSculptPrint_Folder + "DONE_researcher"); DeleteLocal(MSculptPrint_Folder + "DONE_subject"); DeleteLocal(MSculptPrint_Folder + "test.stl"); DeleteLocal(MSculptPrint_Folder + "View_SW.png"); DeleteLocal(MSculptPrint_Folder + "View_SP.png"); DeleteLocal(MSculptPrint_Folder + "View_Researcher_Feedback.png"); }