Exemplo n.º 1
0
        private TimeSpan tInterval = new TimeSpan(0, 0, 0, 15, 0); // время тишины для проигрывания файла

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Инициализирует новый экземпляр класса
        /// </summary>
        protected SgtApplication()
        {
            c_slim = new System.Threading.ReaderWriterLockSlim();

            works = new List<Work>();

            commutator = new Commutator();
            technology = new Technology();

            db_manager = new DataBaseManager();

            commutator.SaverTechData = technology.SaverTechnologyData;
            //commutator.onUpdated += new CommutatorEventHandler(technology.Calculate);

            technology.onComplete += new EventHandler(technology_onComplete);

            s_panel = new SpoPanel(this);
            d_panel = new DrillingPanel(this);

            sol_panel = new SolutionPanel(this);

            panels = new List<VPanel>();

            show_drilling = true;
            show_solution = true;
            show_spo = true;
        }
Exemplo n.º 2
0
        protected Tech tech = null; // технологическая примочка

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Инициализирует новый экземпляр класса
        /// </summary>
        protected Application()
        {
            try
            {
                ErrorHandler.InitializeErrorHandler();
                ErrorHandler.OnExit += new EventHandler(ErrorHandler_OnExit);

                buffer = new RSliceBuffer(72000);
                manager = new DataBaseManager();

                projects = new List<Project>();
                commands = new List<BlockViewCommand>();

                parameters = new Parameter[256];
                for (int index = 0; index < parameters.Length; index++)
                {
                    parameters[index] = new Parameter(index);
                    parameters[index].Identifier = Identifiers.GetGuid(index);
                }

                tech = new Tech();
                commutator = new Commutator(tech, parameters, buffer);

                panels = new List<ParametersViewPanel>();
            //                devManUri = new Uri("net.tcp://localhost:57000");
                devManUri = new Uri("net.tcp://127.0.0.1:57000");

                CheckRegistry();

                LoadUri();

                DevManClient.Uri = devManUri;

                DevManClient.Context.Mode = UserMode.Passive;
                DevManClient.Context.Role = Role.Common;

                client = new devTcpManager();

                Ping ping = new Ping();
                PingOptions options = new PingOptions();

                try
                {
                    PingReply reply = ping.Send(devManUri.Host);
                    if (reply.Status == IPStatus.Success)
                    {
                        /*DevManClient.Uri = devManUri;

                        DevManClient.Context.Mode = UserMode.Passive;
                        DevManClient.Context.Role = Role.Common;*/

                        DevManClient.Connect();

                        // client = new devTcpManager();

                        string ip = System.Net.Dns.Resolve(devManUri.Host).AddressList[0].ToString();
                        //string ip = System.Net.Dns.GetHostEntry(devManUri.Host).AddressList[0].ToString();

                        client.Client.Host = ip;
                        client.Client.Port = 56000;

                        client.Client.Connect();
                    }
                    else
                    {
                        /*try
                        {
                            client = null;
                        }
                        catch { }*/
                    }
                }
                catch { }
            }
            catch (Exception ex)
            {
                ErrorHandler.WriteToLog(this, new ErrorArgs(ex.Message, ErrorType.Fatal));
            }
        }