Exemplo n.º 1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            string cachePath = AppDomain.CurrentDomain.BaseDirectory + "cache";

            if (Directory.Exists(cachePath))
            {
                Directory.Delete(cachePath, true);
            }
            cachePath = AppDomain.CurrentDomain.BaseDirectory + "cookies";
            if (Directory.Exists(cachePath))
            {
                Directory.Delete(cachePath, true);
            }


            CefManager.Strat();

            logger = new LoggerFacade().GetInstance("DS.AFP.WPF.App");
            logger.Debug("WPF宿主容器开始启动");
            bootstrapper = new Bootstrapper(logger);
            bootstrapper.Run();
            EventAggregator = Bootstrapper.EventAggregator;
            logger.Debug("WPF宿主容器启动完成,运行正常!");


            EventAggregator.GetEvent <BrowserExitEventSignal>().Subscribe(o =>
            {
                App.Current.Shutdown();
            }, ThreadOption.UIThread, true);

            AddTrayIcon();
        }
Exemplo n.º 2
0
 public bool InstallMe()
 {
     try
     {
         ManagedInstallerClass.InstallHelper(
             new string[] { _exePath });
     }
     catch (Exception e)
     {
         Logger.Debug("安装服务失败", e);
         System.Windows.MessageBox.Show("安装服务失败!{0}".FormatString(e.InnerException.StackTrace));
         return(false);
     }
     return(true);
 }
 public ListDisscussionViewModel(ILoggerFacade logger) //,ISmartService smartService: base(container)IUnityContainer container
 {
     Logger          = logger;
     Items           = OrmManager.Fetch <DiscussInfo>(x => x.StillIn);
     SelectedCommand = new Command(() => {
         Logger.Debug(SelectedItem.Name);
     }, () => SelectedItem != null);
     RefreshBasicCommand = new Command(() => {
         var state = WorkContext.GetState <QQState>(Constract.CurrentQQState);
         state?.GetClient().InitDisscussList();
         Items = OrmManager.Fetch <DiscussInfo>(x => x.QQNum == WorkContext.GetState <long>(Constract.CurrentQQ) && x.StillIn);
         RaisePropertyChanged(nameof(Items));
     });
     RefreshDetailCommand = new Command(() => {
         Task.Run(() => {
             foreach (var group in Items)
             {
                 var state = WorkContext.GetState <QQState>(Constract.CurrentQQState);
                 state?.GetClient().InitDisscussInfo(group.Did);
                 // smartService.InitDisscussInfo(group.Did);
             }
         });
         Items = OrmManager.Fetch <DiscussInfo>(x => x.QQNum == WorkContext.GetState <long>(Constract.CurrentQQ) && x.StillIn);
         RaisePropertyChanged(nameof(Items));
     }, () => Items.Count() > 0);
     RefreshSelectedCommand = new Command(() => {
         // Logger.Debug(SelectedItem.Name);
         var state = WorkContext.GetState <QQState>(Constract.CurrentQQState);
         state?.GetClient().InitDisscussInfo(SelectedItem.Did);
         //smartService.InitDisscussInfo(SelectedItem.Did);
         Items = OrmManager.Fetch <DiscussInfo>(x => x.QQNum == WorkContext.GetState <long>(Constract.CurrentQQ) && x.StillIn);
         RaisePropertyChanged(nameof(Items));
     }, () => SelectedItem != null);
 }
Exemplo n.º 4
0
        /// <summary>
        /// 构造
        /// </summary>
        /// <param name="container"></param>
        /// <param name="dsconfig"></param>
        protected ModuleBase(IApplicationContext container, IDsConfigurationSection dsconfig)
        {
//#if DEBUG

//            Debugger.Launch();

//#endif
            logger = new LoggerFacade(this.GetType());
            DsConfigurationManager dcm = new DsConfigurationManager();
            Assembly a           = this.GetType().Assembly;
            string   contextName = a.GetName().Name.ToLower();

            ParentContaioner = container;
            //初始化环境信息
            this.InitializationDsEnvironment(dsconfig, a.FullName);
            logger.Debug("{0} Plug-ins start loading".FormatString(AddinInfo.AddinName));
            //SyncInfo(dcm);
            if (File.Exists(AddinInfo.ConfigurationFilePath))
            {
                System.Configuration.Configuration ecs = dcm.Get <System.Configuration.Configuration>(AddinInfo.ConfigurationFilePath);
                if (ecs == null)
                {
                    logger.Error("{0} Configuration file loading exception, configuration file does not exist!".FormatString(AddinInfo.AddinName));
                }
                CurrentAddinConfiguration   = ecs;
                this.DsConfigurationSection = dsconfig;
                AddinConfigurationList.TryAdd(AddinInfo.AddinName, ecs);

                ParentContaioner.RegisterInstance(this);
                Container = ChildContainer.Create(container, contextName, ecs);

                GlobalObject.SetAddinContanier(AddinInfo.AddinName, Container);
                //初始化WCF服务
                WCFServiceContainer.Create(contextName, CurrentAddinConfiguration);
                //初始化Socket服务
                SocketServiceContainer.Create(CurrentAddinConfiguration);
            }
            logger.Debug("{0} Plug-in loaded".FormatString(AddinInfo.AddinName));
        }
Exemplo n.º 5
0
 /// <summary>
 /// Generates a debug entry in the log with the message, priority and arguments specified
 /// </summary>
 /// <param name="facade">Logger facade to use</param>
 /// <param name="msg">Message to use</param>
 /// <param name="args">Arguments for the message</param>
 public static void Debug(this ILoggerFacade facade, string msg, params object[] args)
 {
     facade.Debug(Priority.Low, msg, args);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Generates a debug entry in the log with the message, priority and arguments specified
 /// </summary>
 /// <param name="facade">Logger facade to use</param>
 /// <param name="priority">Priority to use</param>
 /// <param name="msg">Message to use</param>
 /// <param name="args">Arguments for the message</param>
 public static void Debug(this ILoggerFacade facade, Priority priority, string msg, params object[] args)
 {
     facade.Debug(CultureInfo.CurrentCulture, priority, msg, args);
 }