Example #1
0
        public void InitiailizeComposition(ShellApplication application)
        {
            var aggregateCatalog = new AggregateCatalog();

            // Directory catalog.
            aggregateCatalog.Catalogs.Add(new DirectoryCatalog(new DirectoryInfo(typeof(ShellApplication).Assembly.Location).Parent.FullName));
            _compositionContainer = new CompositionContainer(aggregateCatalog);
            AttributedModelServices.ComposeParts(_compositionContainer, application);
        }
Example #2
0
 public void RemovePinnedItemFromTaskbar(string item, object requestImpl)
 {
     if (requestImpl == null)
     {
         throw new ArgumentNullException("requestImpl");
     }
     using (var request = requestImpl.As <Request>()) {
         request.Debug("Calling 'ProviderService::RemovePinnedItemFromTaskbar'");
         ShellApplication.Unpin(item);
     }
 }
Example #3
0
        public void AddPinnedItemToTaskbar(string item, IRequestObject requestObject)
        {
            Activity();

            if (requestObject == null)
            {
                throw new ArgumentNullException("requestObject");
            }
            using (var request = requestObject.As <Request>()) {
                request.Debug("Calling 'ProviderService::AddPinnedItemToTaskbar'");
                ShellApplication.Pin(item);
            }
        }
Example #4
0
        public void RemovePinnedItemFromTaskbar(string item, IRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            if (!request.IsCanceled)
            {
                request.Debug("Calling 'ProviderService::RemovePinnedItemFromTaskbar'");
                ShellApplication.Unpin(item);
            }
        }
Example #5
0
        public void InitializeLeftPanels(ShellApplication application, TabControl tabControl)
        {
            _shellApplication = application;
            tabControl.SelectionChanged += InitializeSelectedPanel;

            _leftPanels = ShellApplication.Host.GetExports<ILeftPanel>().ToList();
            foreach (var leftPanel in _leftPanels)
            {
                var tabItem = new ShellTabItem();
                tabItem.Header = leftPanel.Value.Lable;
                tabItem.Content = leftPanel.Value.Content;
                // TODO: should make binding
                tabControl.Items.Add(tabItem);
            }
            tabControl.SelectedItem = tabControl.Items[0];
        }
Example #6
0
        public void InitializeLeftPanels(ShellApplication application, TabControl tabControl)
        {
            _shellApplication            = application;
            tabControl.SelectionChanged += InitializeSelectedPanel;

            _leftPanels = ShellApplication.Host.GetExports <ILeftPanel>().ToList();
            foreach (var leftPanel in _leftPanels)
            {
                var tabItem = new ShellTabItem();
                tabItem.Header  = leftPanel.Value.Lable;
                tabItem.Content = leftPanel.Value.Content;
                // TODO: should make binding
                tabControl.Items.Add(tabItem);
            }
            tabControl.SelectedItem = tabControl.Items[0];
        }
        private static void Main()
        {
            try
            {
                DefaultLoggingConfiguration.Setup();

                // Custom splash screen
                ApplicationSplashScreen splashScreen = null;
                if (IsOnlyInstance())
                {
                    var windowsSplashScreen = new SplashScreen("Resources/SplashScreen.png");
                    splashScreen = new ApplicationSplashScreen(windowsSplashScreen);
                    splashScreen.Show();
                }

                var startupInfo = new CustomControlsExamples.CustomApplicationStartupInfo(splashScreen);
                PreferencesHelper.Initialize(startupInfo.ApplicationInfo);
                ShellApplication.RunStandalone(startupInfo);
            }
            finally
            {
                DefaultLoggingConfiguration.Cleanup();
            }
        }
Example #8
0
 public void InitializeMainSite(ShellApplication application)
 {
     ShellApplication = application;
 }
Example #9
0
        static void Main()
        {
            Process instance = CheckInstance(); // 获取当前应用程序已经执行的实例
            if (instance == null)
            {
                BonusSkins.Register();
                //OfficeSkins.Register();
                SkinManager.EnableFormSkins();
                Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("zh-CN");
                Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CN");

                sessionId = Guid.NewGuid().ToString();
                ChannelFactory.Url = ConfigurationManager.AppSettings["WebServiceUrl"];
                ChannelFactory.ServerAddress = ConfigurationManager.AppSettings["ServerAddress"];
                ChannelFactory.Port = int.Parse(ConfigurationManager.AppSettings["ServerPort"]);
                ChannelFactory.CommunicationChannel = (CommunicationChannel)Enum.Parse(typeof(CommunicationChannel), ConfigurationManager.AppSettings["CommunicationChannel"], true);
                ShowLoginForm(); // 显示登录窗口
                Thread.Sleep(100);
                mutex.WaitOne();

                AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
                ShellApplication application = null;
                try {
                    SetInitialState("加载日志组件……");
                    XmlConfigurator.Configure(new FileInfo(LOGGER_CONFIGFILE));
                    logger = LogManager.GetLogger(typeof(Program));
                    logger.Info("****************应用程序启动,本次会话编号为[" + sessionId + "]****************");
                    ClientEventDispatcher.Instance.Logger = logger;
                    IncreaseProgressBar(10);

                    SetInitialState("初始化通讯代理组件……");
                    IncreaseProgressBar(10);

                    SetInitialState("启动客户端事件探测器……");
                    detector = new EventDetector(logger, Program.SessionId, ClientEventDispatcher.Instance);
                    detector.Start();
                    IncreaseProgressBar(10);

                    application = new ShellApplication();
                    application.Run();
                }
                catch (Exception ex) {
                    logger.Fatal("运行客户端应用程序时发生错误", ex);
                    XtraMessageBox.Show("运行应用程序时发生错误, 异常信息为 : " + ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally {
                    try {
                        if (application != null) ClearResource();
                    }
                    catch (Exception ex) {
                        logger.Warn("清理系统所占用的资源时发生错误", ex);
                    }
                    finally {
                        Environment.Exit(0);
                    }
                }
            }
            else
                HandleRunningInstance(instance);
        }
Example #10
0
 public void InitializeMainSite(ShellApplication application)
 {
     ShellApplication = application;
 }