示例#1
0
 public TaaKey(TaaConfCtl conf)
 {
     InitializeComponent();
     Task.Run(() =>
     {
         m_conf       = conf;
         RedisUnit ru = null;
         foreach (var ele in m_conf.m_confs)
         {
             if (ele.m_name == "redis")
             {
                 ru = new RedisUnit(ele.m_value);
             }
         }
         if (ru.m_ip == "127.0.0.1")
         {
             ru.m_ip = m_conf.m_taaIp;
         }
         m_keys         = new List <KeyItem>();
         string timeout = AppConfig.m_conf.AppSettings.Settings["operationTimeout"].Value;
         try {
             m_redis = ConnectionMultiplexer.Connect(ru.m_ip + ":" + ru.m_port.ToString() + ",Password="******",ConnectTimeout=" + timeout);
         }catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
             return;
         }
         m_db  = m_redis.GetDatabase(1);
         m_cts = new CancellationTokenSource();
         PollTaaKeyOnce();
         this.Dispatcher.Invoke(() => {
             this.DataContext = this;
             this.Unloaded   += (sender, e) => { m_cts.Cancel(); };
         });
         Task.Run(() => { PollTaaKeys(); });
     });
 }
示例#2
0
        public AutotDiagnostic(TaaConfCtl conf)
        {
            InitializeComponent();
            m_conf = conf;
            BrokerUnit bu = null;

            foreach (var ele in m_conf.m_confs)
            {
                if (ele.m_name == "broker")
                {
                    bu = new BrokerUnit(ele.m_value);
                }
            }
            m_items = new List <DiagnoseItem>();
            m_items.Add(new DiagnoseItem("auth", "look up /etc/license/IN-SEC.lic and TAAMaster.log", m_conf.m_icmd.IsAuthOkay));
            m_items.Add(new DiagnoseItem("kafka", "connect broker", m_conf.m_icmd.IsKfkaOkay, bu));
            DataContext = this;
            Task.Run(() => {
                foreach (var ele in m_items)
                {
                    ele.m_func(ele.m_result);
                }
            });
        }