Exemple #1
0
        static void Main(string[] args)
        {
            #region Pattern de Criação

            Console.WriteLine("########### PATTERNS DE CRIAÇÃO #############");
            Console.WriteLine("");

            SingletonApp.Executar();
            FactoryMethodApp.Executar();
            BuilderApp.Executar();
            PrototypeApp.Executar();

            #endregion

            #region Pattern Estrutural

            Console.WriteLine("########### PATTERNS ESTRUTURAL #############");
            Console.WriteLine("");

            AdapterApp.Executar();

            #endregion

            #region Pattern Comportamental

            Console.WriteLine("########### PATTERNS COMPORTAMENTAL #########");
            Console.WriteLine("");

            #endregion

            Console.ReadKey();
        }
Exemple #2
0
        public App()
        {
            _singletonApp = new SingletonApp("OPSCallCenterCRM");

            GalaSoft.MvvmLight.Ioc.SimpleIoc.Default.Register <IDialogService>(() => new DialogService());
            GalaSoft.MvvmLight.Ioc.SimpleIoc.Default.Register <IGenericSettingsRepository <AppPreferences> >(() => new SettingsRepository());
            GalaSoft.MvvmLight.Ioc.SimpleIoc.Default.Register <IUserInfoSettingsRepository>(() => new UserInfoSettingsRepository());
        }
Exemple #3
0
        private static void Main()
        {
            //检测.net版本。
            if (!VersionCheck.Check4FromRegistry())
            {
                MessageBox.Show(".net版本过低。本程序需要运行在.net4.0或.net4.0以后的版本!", "提示");
                return;
            }
            App.Instance.ApplicationDirectory = Environment.CurrentDirectory + "\\";

            //同时只能运行一个实例。
            if (SingletonApp.IsMutexExsited)
            {
                SingletonApp.ShowRunningInstance();
                return;
            }
            //指定运行日志要保存的目录
            RunningLog.Start(App.Instance.ApplicationDirectory + "\\history\\");

            //判断当前登录用户是否为管理员
            if (WindowsAuthority.IsAdministrator)
            {
                //设置应用程序退出和异常的事件
                Application.ApplicationExit += App.Instance.RaiseApplicationExist;
                Application.ThreadExit      += App.Instance.RaiseMainThreadExist;
                Application.ThreadException += (o, e) => MessageBox.Show(e.Exception.ToString());

                try
                {
                    //运行应用程序内核
                    App.Instance.BuildModule();
                    App.Instance.Initialize();
                    App.Instance.RaiseStarting();

                    //启动Ui界面
                    IInvoke invoker = ObjectGenerator.Create("FlightViewerUI.dll", "BinHong.FlightViewerUI.UiInvoker") as IInvoke;
                    invoker.Invoke();
                }
                catch (Exception e)
                {
                    string msg = e.Message;
#if DEBUG
                    msg = e.Message + e.StackTrace;
#endif
                    RunningLog.Record(LogType.System, LogLevel.Error, msg);
                    Thread.Sleep(200);
                    MessageBox.Show(msg);
                }
                finally
                {
                    SingletonApp.ReleaseMutex();
                }
            }
            else
            {
                WindowsAuthority.RunAsAdministrator(Application.ExecutablePath);
            }
        }
Exemple #4
0
        static void Main(string [] args)
        {
            Console.WriteLine("-------- CREATIONALS PATTERNS --------");
            Console.WriteLine();

            Console.WriteLine("-------- ABSTRACT FACTORY --------");
            AbstractFactoryMundoAnimalApp.Execute();

            Console.WriteLine();

            Console.WriteLine("-------- BUILDER --------");
            VeiculoBuilderApp.Execute();

            Console.WriteLine();

            Console.WriteLine("-------- FACTORY --------");
            FactoryDocumentApp.Execute();

            Console.WriteLine();

            Console.WriteLine("-------- SINGLETON --------");
            SingletonApp.Execute();

            Console.WriteLine();

            Console.WriteLine("-------- PROTOTYPE --------");
            PrototypeCoresApp.Execute();

            Console.WriteLine();

            Console.WriteLine("-------- STRUCTURALS PATTERNS --------");
            Console.WriteLine();

            Console.WriteLine("-------- ADAPTER --------");
            AdapterApp.Execute();

            Console.WriteLine();

            Console.WriteLine("-------- BRIDGE --------");
            BridgeApp.Execute();

            Console.WriteLine();

            Console.WriteLine("-------- COMPOSITE --------");
            CompositeApp.Execute();

            Console.WriteLine();

            Console.WriteLine("-------- DECORATOR --------");
            DecoratorApp.Execute();

            Console.WriteLine();

            Console.WriteLine("-------- FACADE --------");
            FacadeHipotecaApp.Execute();
        }
Exemple #5
0
        public App()
        {
            _singletonApp = new SingletonApp("OPSCallCenterCRMServer");

            SimpleIoc.Default.Register <IDialogService>(() => new DialogService());
            SimpleIoc.Default.Register <IDatabaseClient <CrmEntry> >(() => new DatabaseClient <CrmEntry>());
            SimpleIoc.Default.Register <IUserInfoSettingsRepository>(() => new UserInfoSettingsRepository());
            SimpleIoc.Default.Register <IClient>(() => new Client());
            SimpleIoc.Default.Register <IGenericSettingsRepository <AppPreferences> >(() => new GenericSettingsRepository <AppPreferences>());
        }
Exemple #6
0
        static void Main(string[] args)
        {
            // Creational
            AbstractFactoryApp.Execute();
            FactoryMethodApp.Execute();
            SingletonApp.Execute();

            // Structural
            AdapterApp.Execute();
            FacadeApp.Execute();
        }
Exemple #7
0
 public App()
 {
     singletonApp = new SingletonApp("OPSEmailSender");
     InitDependencies();
 }
Exemple #8
0
 public App()
 {
     _singletonApp = new SingletonApp("OPSAgentDialer");
     InitDependencies();
 }
Exemple #9
0
        public App()
        {
            singletonApp = new SingletonApp("OPSAutoDialer");

            InitDependencies();
        }
Exemple #10
0
 static void Main()
 {
     SingletonApp.Run(new MyForm());
 }
 public void Init()
 {
     _target = new SingletonApp(new ConfigServiceStub());
 }
Exemple #12
0
 public App()
 {
     _singletonApp = new SingletonApp("OPSIVRStudio");
     InitDependencies();
 }