static void Main() { try { mutex = new Mutex(true, identifier, out isNotRunning); if (isNotRunning) { app = AsyApplication.CreateInstance(); if (app != null) { app.Load(); app.Connect(); System.Windows.Forms.Application.ApplicationExit += new EventHandler(Application_ApplicationExit); System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); System.Windows.Forms.Application.Run(new mainForm()); } } else MessageBox.Show("Приложение уже запущено", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { } }
public DevManDataForm() { InitializeComponent(); mutex = new Mutex(); _app = AsyApplication.CreateInstance(); }
/// <summary> /// пробуем отсоединиться и соединиться /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void accept_Click(object sender, EventArgs e) { Uri last = DevManClient.Uri; try { if (textBoxTotalAddress.Text != string.Empty) { if (last.OriginalString != textBoxTotalAddress.Text) { Uri newUri = null; try { newUri = new Uri(textBoxTotalAddress.Text); AsyApplication _app = AsyApplication.CreateInstance(); if (_app != null) { _app.Commutator.DevManUri = newUri; } } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } } } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
static void Main() { try { mutex = new Mutex(true, identifier, out isNotRunning); if (isNotRunning) { app = AsyApplication.CreateInstance(); if (app != null) { app.Load(); app.Connect(); System.Windows.Forms.Application.ApplicationExit += new EventHandler(Application_ApplicationExit); System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); System.Windows.Forms.Application.Run(new mainForm()); } } else { MessageBox.Show("Приложение уже запущено", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch { } }
/// <summary> /// инициализирует новый экземпляр класса /// </summary> public ParametersTunerForm() { InitializeComponent(); _app = AsyApplication.CreateInstance(); if (_app == null) { MessageBox.Show("Не удалось получить доступ к параметрам приложения"); } }
/// <summary> /// Получить основное приложение /// </summary> /// <returns></returns> public static AsyApplication CreateInstance() { if (_app == null) { _app = new AsyApplication(); _app.Initialize(); ErrorHandler.InitializeErrorHandler(); } return(_app); }
private AsyApplication _app = null; // основное приложение #endregion Fields #region Constructors public mainForm() { InitializeComponent(); _app = AsyApplication.CreateInstance(); _app.OnTec += new EventHandler(_app_OnTec); dStatuser = new devMnStatuser(DevStatuse); DevManClient.onConnected += new EventHandler(DevManClient_onConnected); DevManClient.onDisconnected += new EventHandler(DevManClient_onDisconnected); setter = new setterText(setterTextF); }
private AsyApplication _app = null; // основное приложение public mainForm() { InitializeComponent(); _app = AsyApplication.CreateInstance(); _app.OnTec += new EventHandler(_app_OnTec); dStatuser = new devMnStatuser(DevStatuse); DevManClient.onConnected += new EventHandler(DevManClient_onConnected); DevManClient.onDisconnected += new EventHandler(DevManClient_onDisconnected); setter = new setterText(setterTextF); }
public DevManParametersForm(bool sahvat) { need = sahvat; InitializeComponent(); _app = AsyApplication.CreateInstance(); try { parameters = DevManClient.Parameters; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public SelectParameterForm() { InitializeComponent(); _app = AsyApplication.CreateInstance(); }
/// <summary> /// Инициализировать формулу из сохраненного раннее узла Xml /// </summary> /// <param name="node">Узел на основе которого выполнить инициализацию макроса</param> public void InstanceMacrosFromXmlNode(XmlNode node) { bool blocked = false; try { if (mutex.WaitOne(500, false)) { // ---- загрузить таблицу калибровочных точек ---- blocked = true; bool xmlError = false; this.table.Clear(); XmlNodeList childs = node.ChildNodes; if (childs != null) { foreach (XmlNode child in childs) { if (child.Name != tableRecordName) { continue; } XmlNodeList parametrs = child.ChildNodes; Boolean bFirst = true; foreach (XmlNode childParametrs in parametrs) { int j; switch (childParametrs.Name) { case tableSignalName: try { if (bFirst) { TCondition newRecord = new TCondition(); this.table.Add(newRecord); bFirst = false; } j = this.table.Count - 1; this.table[j].Signal = AsyApplication.ParseDouble(childParametrs.InnerText); } catch { xmlError = true; } break; case tableValueName: try { if (bFirst) { TCondition newRecord = new TCondition(); this.table.Add(newRecord); bFirst = false; } j = this.table.Count - 1; this.table[j].Result = AsyApplication.ParseDouble(childParametrs.InnerText); } catch { xmlError = true; } break; case tableShiftName: try { if (bFirst) { TCondition newRecord = new TCondition(); this.table.Add(newRecord); bFirst = false; } j = this.table.Count - 1; this.table[j].Shift = AsyApplication.ParseDouble(childParametrs.InnerText); } catch { xmlError = true; } break; case tableMultyName: try { if (bFirst) { TCondition newRecord = new TCondition(); this.table.Add(newRecord); bFirst = false; } j = this.table.Count - 1; this.table[j].Multy = AsyApplication.ParseDouble(childParametrs.InnerText); } catch { xmlError = true; } break; } } } if (this.table.Count > 0) { this.table.Sort(Comparison); } } if (xmlError) { this.table.Clear(); } // ----------------------------------------------- } } catch { //throw new Exception(); } finally { if (blocked) { mutex.ReleaseMutex(); } } }
/// <summary> /// Получить основное приложение /// </summary> /// <returns></returns> public static AsyApplication CreateInstance() { if (_app == null) { _app = new AsyApplication(); _app.Initialize(); ErrorHandler.InitializeErrorHandler(); } return _app; }