Beispiel #1
0
        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 { }
        }
Beispiel #2
0
        public DevManDataForm()
        {
            InitializeComponent();

            mutex = new Mutex();
            _app = AsyApplication.CreateInstance();
        }
Beispiel #3
0
        public DevManDataForm()
        {
            InitializeComponent();

            mutex = new Mutex();
            _app  = AsyApplication.CreateInstance();
        }
Beispiel #4
0
        /// <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);
            }
        }
Beispiel #5
0
        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 { }
        }
Beispiel #6
0
        /// <summary>
        /// инициализирует новый экземпляр класса
        /// </summary>
        public ParametersTunerForm()
        {
            InitializeComponent();

            _app = AsyApplication.CreateInstance();
            if (_app == null)
            {
                MessageBox.Show("Не удалось получить доступ к параметрам приложения");
            }
        }
Beispiel #7
0
        /// <summary>
        /// инициализирует новый экземпляр класса
        /// </summary>
        public ParametersTunerForm()
        {
            InitializeComponent();

            _app = AsyApplication.CreateInstance();
            if (_app == null)
            {
                MessageBox.Show("Не удалось получить доступ к параметрам приложения");
            }
        }
Beispiel #8
0
        /// <summary>
        /// Получить основное приложение
        /// </summary>
        /// <returns></returns>
        public static AsyApplication CreateInstance()
        {
            if (_app == null)
            {
                _app = new AsyApplication();

                _app.Initialize();
                ErrorHandler.InitializeErrorHandler();
            }

            return(_app);
        }
Beispiel #9
0
        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);
        }
Beispiel #10
0
        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);
        }
Beispiel #11
0
        public DevManParametersForm(bool sahvat)
        {
            need = sahvat;
            InitializeComponent();

            _app = AsyApplication.CreateInstance();

            try
            {
                parameters = DevManClient.Parameters;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #12
0
 public SelectParameterForm()
 {
     InitializeComponent();
     _app = AsyApplication.CreateInstance();
 }
Beispiel #13
0
 public SelectParameterForm()
 {
     InitializeComponent();
     _app = AsyApplication.CreateInstance();
 }
Beispiel #14
0
        /// <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();
                }
            }
        }
Beispiel #15
0
        /// <summary>
        /// Получить основное приложение
        /// </summary>
        /// <returns></returns>
        public static AsyApplication CreateInstance()
        {
            if (_app == null)
            {
                _app = new AsyApplication();

                _app.Initialize();
                ErrorHandler.InitializeErrorHandler();
            }

            return _app;
        }