Your Products have been synced, click here to refresh
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 PCDLRN; using Microsoft.VisualBasic; using System.Diagnostics; using System.IO.Compression; using System.Threading; using System.Runtime.InteropServices; using System.ComponentModel; using System.Windows.Interop; namespace PCD_Operator_App { /// <summary> /// Interaction logic for LoadScreen.xaml /// </summary> public partial class LoadScreen : Window { private const int GWL_STYLE = -16; private const int WS_SYSMENU = 0x80000; [DllImport("user32.dll", SetLastError = true)] private static extern int GetWindowLong(IntPtr hWnd, int nIndex); [DllImport("user32.dll")] private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); public LoadScreen() { InitializeComponent(); BackgroundWorker backgroundStartup = new BackgroundWorker(); backgroundStartup.WorkerReportsProgress = true; backgroundStartup.DoWork += startup_DoWork; backgroundStartup.ProgressChanged += startup_ProgressChanged; backgroundStartup.RunWorkerCompleted += startup_RunWorkerCompleted; backgroundStartup.RunWorkerAsync(); } void startup_DoWork(object sender, DoWorkEventArgs e) { bool startCondition = true; Process[] pcdStartupCheck = Process.GetProcessesByName("PCDLRN"); if (pcdStartupCheck.Length > 0) { startCondition = false; } else { Type PCDRLN_Application = null; object PCDObj = null; PCDLRN.Application PCDApp = null; try { PCDRLN_Application = Type.GetTypeFromProgID("PCDLRN.Application"); PCDObj = Activator.CreateInstance(PCDRLN_Application); } catch (System.Exception em) { MessageBox.Show(em.Message); } PCDApp = new PCDLRN.Application(); PCDApp.OperatorMode = true; PCDApp.Visible = false; PCDApp.ApplicationEvents.OnMachineConnected += new IApplicationEvents_OnMachineConnectedEventHandler(onMachineConnect); void onMachineConnect(Machine machine) { //MessageBox.Show("machine connected"); //loadScreenStatus.Content = "PC-DMIS active, connecting to machine..."; startCondition = false; } if (startCondition) { WindowSearcher homeWindowSearch = new WindowSearcher(); homeWindowSearch.BeginWindowLook_Home(); } } } void startup_ProgressChanged(object sender, ProgressChangedEventArgs e) { } void startup_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { new MainWindow().Show(); this.Close(); } private void WindowLoaded(object sender, RoutedEventArgs e) { var hwnd = new WindowInteropHelper(this).Handle; SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU); } } }
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 PCDLRN; using Microsoft.VisualBasic; using System.Diagnostics; using System.IO.Compression; using System.Threading; using System.Runtime.InteropServices; using System.ComponentModel; using System.Windows.Interop; namespace PCD_Operator_App { /// <summary> /// Interaction logic for LoadScreen.xaml /// </summary> public partial class LoadScreen : Window { private const int GWL_STYLE = -16; private const int WS_SYSMENU = 0x80000; [DllImport("user32.dll", SetLastError = true)] private static extern int GetWindowLong(IntPtr hWnd, int nIndex); [DllImport("user32.dll")] private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); public LoadScreen() { InitializeComponent(); BackgroundWorker backgroundStartup = new BackgroundWorker(); backgroundStartup.WorkerReportsProgress = true; backgroundStartup.DoWork += startup_DoWork; backgroundStartup.ProgressChanged += startup_ProgressChanged; backgroundStartup.RunWorkerCompleted += startup_RunWorkerCompleted; backgroundStartup.RunWorkerAsync(); } void startup_DoWork(object sender, DoWorkEventArgs e) { bool startCondition = true; Process[] pcdStartupCheck = Process.GetProcessesByName("PCDLRN"); if (pcdStartupCheck.Length > 0) { startCondition = false; } else { Type PCDRLN_Application = null; object PCDObj = null; PCDLRN.Application PCDApp = null; try { PCDRLN_Application = Type.GetTypeFromProgID("PCDLRN.Application"); PCDObj = Activator.CreateInstance(PCDRLN_Application); } catch (System.Exception em) { MessageBox.Show(em.Message); } PCDApp = new PCDLRN.Application(); PCDApp.OperatorMode = true; PCDApp.Visible = false; PCDApp.ApplicationEvents.OnMachineConnected += new IApplicationEvents_OnMachineConnectedEventHandler(onMachineConnect); void onMachineConnect(Machine machine) { //MessageBox.Show("machine connected"); //loadScreenStatus.Content = "PC-DMIS active, connecting to machine..."; startCondition = false; } if (startCondition) { WindowSearcher homeWindowSearch = new WindowSearcher(); homeWindowSearch.BeginWindowLook_Home(); } } } void startup_ProgressChanged(object sender, ProgressChangedEventArgs e) { } void startup_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { new MainWindow().Show(); this.Close(); } private void WindowLoaded(object sender, RoutedEventArgs e) { var hwnd = new WindowInteropHelper(this).Handle; SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU); } } }
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |