Interaction logic for HistorianConnectionStringScreen.xaml
상속: System.Windows.Controls.UserControl, IScreen
        /// <summary>
        /// Creates a new instance of the <see cref="HistorianSetupScreen"/>.
        /// </summary>
        public HistorianSetupScreen()
        {
            m_parametersScreen  = new HistorianConnectionStringScreen();
            m_historianAdapters = new List <HistorianAdapter>();

            // This can fail if user is not running under proper credentials
            try
            {
                foreach (Type type in GetHistorianTypes())
                {
                    m_historianAdapters.Add(new HistorianAdapter(type));
                }
            }
            catch (Exception ex)
            {
                LogFile logger = new LogFile();
                logger.FileName = FilePath.GetAbsolutePath("ErrorLog.txt");
                logger.WriteTimestampedLine(ErrorLogger.GetExceptionInfo(ex, false));
                logger.Dispose();
            }

            if (m_historianAdapters.Count > 0)
            {
                m_defaultAdapter = m_historianAdapters.Find(adapter => adapter.TypeName == "HistorianAdapters.LocalOutputAdapter");

                if (m_defaultAdapter == null)
                {
                    m_defaultAdapter = m_historianAdapters[0];
                }

                m_assemblyName = m_defaultAdapter.AssemblyName;
                m_typeName     = m_defaultAdapter.TypeName;
            }

            if (m_defaultAdapter == null)
            {
                m_assemblyName = FilePath.GetAbsolutePath("HistorianAdapters.dll");
                m_typeName     = "HistorianAdapters.LocalOutputAdapter";
            }

            InitializeComponent();
        }
        /// <summary>
        /// Creates a new instance of the <see cref="HistorianSetupScreen"/>.
        /// </summary>
        public HistorianSetupScreen()
        {
            m_parametersScreen = new HistorianConnectionStringScreen();
            m_historianAdapters = new List<HistorianAdapter>();

            // This can fail if user is not running under proper credentials
            try
            {
                foreach (Type type in GetHistorianTypes())
                {
                    m_historianAdapters.Add(new HistorianAdapter(type));
                }
            }
            catch (Exception ex)
            {
                LogFile logger = new LogFile();
                logger.FileName = FilePath.GetAbsolutePath("ErrorLog.txt");
                logger.WriteTimestampedLine(ErrorLogger.GetExceptionInfo(ex, false));
                logger.Dispose();
            }

            if (m_historianAdapters.Count > 0)
            {
                m_defaultAdapter = m_historianAdapters.Find(adapter => adapter.TypeName == "HistorianAdapters.LocalOutputAdapter");

                if (m_defaultAdapter == null)
                    m_defaultAdapter = m_historianAdapters[0];

                m_assemblyName = m_defaultAdapter.AssemblyName;
                m_typeName = m_defaultAdapter.TypeName;
            }

            if (m_defaultAdapter == null)
            {
                m_assemblyName = FilePath.GetAbsolutePath("HistorianAdapters.dll");
                m_typeName = "HistorianAdapters.LocalOutputAdapter";
            }

            InitializeComponent();
        }
예제 #3
0
        /// <summary>
        /// Creates a new instance of the <see cref="HistorianSetupScreen"/>.
        /// </summary>
        public HistorianSetupScreen()
        {
            m_parametersScreen  = new HistorianConnectionStringScreen();
            m_historianAdapters = new List <HistorianAdapter>();

            // This could fail if user is not running under proper credentials
            try
            {
                foreach (Type type in GetHistorianTypes())
                {
                    m_historianAdapters.Add(new HistorianAdapter(type));
                }
            }
            catch (Exception ex)
            {
                ((App)Application.Current).ErrorLogger.Log(ex);
            }

            if (m_historianAdapters.Count > 0)
            {
                m_defaultAdapter = m_historianAdapters.Find(adapter => adapter.TypeName == DefaultType);

                if (m_defaultAdapter == null)
                {
                    m_defaultAdapter = m_historianAdapters[0];
                }

                m_assemblyName = m_defaultAdapter.AssemblyName;
                m_typeName     = m_defaultAdapter.TypeName;
            }

            if (m_defaultAdapter == null)
            {
                m_assemblyName = FilePath.GetAbsolutePath(DefaultAssembly);
                m_typeName     = DefaultType;
            }

            InitializeComponent();
        }
        /// <summary>
        /// Creates a new instance of the <see cref="HistorianSetupScreen"/>.
        /// </summary>
        public HistorianSetupScreen()
        {
            m_parametersScreen = new HistorianConnectionStringScreen();
            m_historianAdapters = new List<HistorianAdapter>();

            // This can fail if user is not running under proper credentials
            try
            {
                foreach (Type type in GetHistorianTypes())
                {
                    m_historianAdapters.Add(new HistorianAdapter(type));
                }
            }
            catch (Exception ex)
            {
                ((App)Application.Current).ErrorLogger.Log(ex);
            }

            if (m_historianAdapters.Count > 0)
            {
                m_defaultAdapter = m_historianAdapters.Find(adapter => adapter.TypeName == "TestingAdapters.VirtualOutputAdapter");

                if (m_defaultAdapter == null)
                    m_defaultAdapter = m_historianAdapters[0];

                m_assemblyName = m_defaultAdapter.AssemblyName;
                m_typeName = m_defaultAdapter.TypeName;
            }

            if (m_defaultAdapter == null)
            {
                m_assemblyName = FilePath.GetAbsolutePath("TestingAdapters.dll");
                m_typeName = "TestingAdapters.VirtualOutputAdapter";
            }

            InitializeComponent();
        }