Пример #1
0
 public static void SetCtx(System.Threading.SynchronizationContext c)
 {
     Ctx = c;
     if (Ctx != null) {
         OKLog.Info("SynchronizationContext is set.");
     }
 }
Пример #2
0
 public TypeSearchForm(ITypeCache cache, Action<string, int, int> action, Action cancelAction)
 {
     InitializeComponent();
     _syncContext = AsyncOperationManager.SynchronizationContext;
     Refresh();
     _cache = cache;
     _action = action;
     _cancelAction = cancelAction;
     writeStatistics();
 }
Пример #3
0
		/// <summary>
		/// Initializes a new instance of the ProgressIdentifier class.
		/// </summary>
		public ProgressIdentifier()
		{
			ctx = System.Threading.SynchronizationContext.Current;
			if (ctx == null) ctx = new System.Threading.SynchronizationContext();

			EventArgs e = new EventArgs();
			spcCurrentValueChanged = s => CurrentValueChanged(this, e);
			spcMaxValueChanged = s => MaxValueChanged(this, e);
			spcStateMessageChanged = s => StateMessageChanged(this, e);
			spcStateObjChanged = s => StateObjChanged(this, e);
		}
Пример #4
0
        public PicQueryPresenter(PicQueryForm view, IRepository repository)
        {
            this.view = view;
            this.repository = repository;
            this.syncContext = System.Threading.SynchronizationContext.Current;

            this.view.QueryClick += new EventHandler(view_QueryClick);
            this.view.NextPageClick += new EventHandler(view_NextPageClick);
            this.view.PreviousPageClick += new EventHandler(view_PreviousPageClick);
            this.view.FirstPageClick += new EventHandler(view_FirstPageClick);
            this.view.LastPageClick += new EventHandler(view_LastPageClick);
            this.view.PageSizeChanged += new EventHandler(view_PageSizeChanged);
        }
Пример #5
0
 public TypeSearchForm(ITypeCache cache, Action<string, int, int> action, Action cancelAction)
 {
     InitializeComponent();
     _syncContext = AsyncOperationManager.SynchronizationContext;
     Refresh();
     _cache = cache;
     _action = action;
     _cancelAction = cancelAction;
     _runSearch = true;
     writeStatistics();
     _searchThread = new System.Threading.Thread(continuousSearch);
     _searchThread.Start();
 }
Пример #6
0
        public void RunMain()
        {
            Console.WriteLine("===========");
            Console.WriteLine("List Reader");
            Console.WriteLine("===========");
            this.PrintReaderList();

            Console.WriteLine("\n");

            // check SAM status
            Console.WriteLine("==========");
            Console.WriteLine("SAM Status");
            Console.WriteLine("==========");
            Console.WriteLine(this.InitializeSAM());
            Console.WriteLine();

            acr123u.readerName = this.selectedReader;
            acr123u.connectDirect();

            // set background light on
            acr123u.LCDBacklightControl(0xFF);

            // set LED
            this.LEDStatus |= Constant.LED_ORANGE;
            this.LEDStatus |= Constant.LED_ANT_BLUE;
            this.acr123u.setLEDControl(this.LEDStatus);

            // set Display Text
            this.SetLCDDisplayText(Constant.APP_NAME);

            acr123u.disconnect();

            context = System.Threading.SynchronizationContext.Current;
            if (context == null)
            {
                context = new System.Threading.SynchronizationContext();
            }
            monitorAuto.CardInserted += new CardInsertedEvent(card_CardInserted);
            monitorAuto.CardRemoved  += new CardRemovedEvent(card_CardRemoved);
            monitorAuto.Start(bni.GetReaderNames());
        }
Пример #7
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this._syn = System.Threading.SynchronizationContext.Current;

            GlobalData.Client.OnKickoutByUser += Client_OnKickoutByUser;

            this.tvL1WithdrawManager.IsSelected = true;

            this.controlPlayerManager.ViewPlayerAlipayRechargeRecords      += controlPlayerManager_ViewPlayerAlipayRechargeRecords;
            this.controlPlayerManager.ViewPlayerBuyGoldCoinRecords         += controlPlayerManager_ViewPlayerBuyGoldCoinRecords;
            this.controlPlayerManager.ViewPlayerBuyMineRecords             += controlPlayerManager_ViewPlayerBuyMineRecords;
            this.controlPlayerManager.ViewPlayerBuyMinerRecords            += controlPlayerManager_ViewPlayerBuyMinerRecords;
            this.controlPlayerManager.ViewPlayerBuyStoneOrderRecords       += controlPlayerManager_ViewPlayerBuyStoneOrderRecords;
            this.controlPlayerManager.ViewPlayerLockedStoneOrderRecords    += controlPlayerManager_ViewPlayerLockedStoneOrderRecords;
            this.controlPlayerManager.ViewPlayerSellStoneOrderRecords      += controlPlayerManager_ViewPlayerSellStoneOrderRecords;
            this.controlPlayerManager.ViewPlayerRMBWithdrawRecords         += controlPlayerManager_ViewPlayerRMBWithdrawRecords;
            this.controlPlayerManager.ViewPlayerRemoteServiceBuyRecords    += controlPlayerManager_ViewPlayerRemoteServiceBuyRecords;
            this.controlPlayerManager.ViewPlayerRemoteServiceHandleRecords += controlPlayerManager_ViewPlayerRemoteServiceHandleRecords;

            this.controlRouletteCurrentAwardItem.RegisterEvents();
        }
Пример #8
0
 public static SqlConnection AddMessagesManagement(this SqlConnection con,
                                                   System.Threading.SynchronizationContext SyncContext, EventHandler <SqlMessageEventArgs> InfoMessage)
 {
     if (SyncContext == null)
     {
         return(con);
     }
     if (con.FireInfoMessageEventOnUserErrors)
     {
         return(con);
     }
     con.FireInfoMessageEventOnUserErrors = true;
     con.InfoMessage += (s, e) =>
                        SyncContext.Post(_ => InfoMessage?.Invoke(
                                             s, new SqlMessageEventArgs
     {
         Message  = e.Message,
         Progress = e.Errors[0]?.State ?? 0
     }), null);
     return(con);
 }
Пример #9
0
        internal static ExecutionContext Capture(ref StackCrawlMark stackMark, CaptureOptions options)
        {
            if (IsFlowSuppressed())
            {
                return(null);
            }
            bool             flag  = CaptureOptions.None != (options & CaptureOptions.IgnoreSyncCtx);
            bool             flag2 = CaptureOptions.None != (options & CaptureOptions.OptimizeDefaultCase);
            ExecutionContext executionContextNoCreate = System.Threading.Thread.CurrentThread.GetExecutionContextNoCreate();

            System.Security.SecurityContext         context2 = System.Security.SecurityContext.Capture(executionContextNoCreate, ref stackMark);
            System.Threading.HostExecutionContext   context3 = HostExecutionContextManager.CaptureHostExecutionContext();
            System.Threading.SynchronizationContext context4 = null;
            if ((executionContextNoCreate != null) && !flag)
            {
                context4 = (executionContextNoCreate._syncContext == null) ? null : executionContextNoCreate._syncContext.CreateCopy();
            }
            System.Runtime.Remoting.Messaging.LogicalCallContext context5 = null;
            if (((executionContextNoCreate != null) && (executionContextNoCreate._logicalCallContext != null)) && executionContextNoCreate.LogicalCallContext.HasInfo)
            {
                context5 = (System.Runtime.Remoting.Messaging.LogicalCallContext)executionContextNoCreate.LogicalCallContext.Clone();
            }
            if (((flag2 && (context2 == null)) && ((context3 == null) && (context4 == null))) && ((context5 == null) || !context5.HasInfo))
            {
                return(s_dummyDefaultEC);
            }
            ExecutionContext context6 = new ExecutionContext {
                SecurityContext = context2
            };

            if (context6.SecurityContext != null)
            {
                context6.SecurityContext.ExecutionContext = context6;
            }
            context6._hostExecutionContext = context3;
            context6._syncContext          = context4;
            context6.LogicalCallContext    = context5;
            context6.isNewCapture          = true;
            return(context6);
        }
Пример #10
0
        public override void Create(DiscSpace space)
        {
            base.Create(space);
            if (_uiContext == null)
            {
                _uiContext = System.Threading.SynchronizationContext.Current;
            }

            var rectangle = (DiscSpaceRectangle)space;

            if (VisibleRoot == null || VisibleRoot.IsParentRecursive(rectangle))
            {
                if (!Rectangles.Contains(rectangle))
                {
                    Rectangles.Add(rectangle);
                }
            }
            if (space.Parent == null)
            {
                _VisibleRoot = rectangle;
            }
            Debug.Assert(rectangle.ManagerRectangle != null);
        }
Пример #11
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            System.Threading.SynchronizationContext sc = new System.Threading.SynchronizationContext();
            UITaskScheduler = TaskScheduler.FromCurrentSynchronizationContext();
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard XAML initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Language display initialization
            InitializeLanguage();

            // Show graphics profiling information while debugging.
            if (Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Prevent the screen from turning off while under the debugger by disabling
                // the application's idle detection.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }

        }
Пример #12
0
        protected void DistributeUpdateCalls(object mutexNoLongerInUse)
        {
            seqNumDistributedUpdateCalls = seqNumGenNoteMessagesAdded.VolatileValue;

            System.Threading.SynchronizationContext currentSC = System.Threading.SynchronizationContext.Current;

            //lock (mutex)    // only run one instance at a time per mutex (blocks later queued calls)
            {
                LogMessageObservableCollection[] activeCollectionSnapshot = LogMessageObservableCollection.InstanceArray;

                foreach (LogMessageObservableCollection lmoc in activeCollectionSnapshot)
                {
                    System.Threading.SynchronizationContext lmocSC = lmoc.SynchronizationContext;
                    if (object.ReferenceEquals(currentSC, lmocSC))
                    {
                        lmoc.Update();
                    }
                    else
                    {
                        lmocSC.Post(lmoc.Update, null); // asynchronous cross thread invoke.  If any of the lmoc instances use a different SC than the default one (construction time one) then just post the update call to its sc.
                    }
                }
            }
        }
Пример #13
0
        protected override async void OnSourceInitialized(EventArgs e)
        {
            Visibility = Visibility.Hidden;

            bool NeedLicenseAgrement = false;

            if (Registry.CurrentUser.OpenSubKey("Software\\WPInternals") == null)
            {
                Registry.CurrentUser.OpenSubKey("Software", true).CreateSubKey("WPInternals");
            }

            if (Registration.IsPrerelease && (Registry.CurrentUser.OpenSubKey("Software\\WPInternals").GetValue("NdaAccepted") == null))
            {
                NeedLicenseAgrement = true;
            }
            else if (Registry.CurrentUser.OpenSubKey("Software\\WPInternals").GetValue("DisclaimerAccepted") == null)
            {
                NeedLicenseAgrement = true;
            }

            if ((!Registration.IsPrerelease || Registration.IsRegistered()) && !NeedLicenseAgrement)
            {
                // USB communication uses Windows Messages and therefore the MainViewModel
                // can only be created after the Main Window was initialized.
                System.Threading.SynchronizationContext UIContext = System.Threading.SynchronizationContext.Current;
                await CommandLine.ParseCommandLine(UIContext);
            }
            else if (Environment.GetCommandLineArgs().Length > 1)
            {
                Console.WriteLine("First time use");
                Console.WriteLine("Switching to graphic user interface for license and registration");
                CommandLine.CloseConsole(false);
            }

            new MainWindow().Show();
        }
Пример #14
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            System.Threading.SynchronizationContext sc = new System.Threading.SynchronizationContext();
            UITaskScheduler = TaskScheduler.FromCurrentSynchronizationContext();
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard XAML initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Language display initialization
            InitializeLanguage();

            // Show graphics profiling information while debugging.
            if (Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Prevent the screen from turning off while under the debugger by disabling
                // the application's idle detection.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }
        }
Пример #15
0
        private void BeginAsynchronousSearch(List <WppComputer> computers)
        {
            if (this.SearchComputerProgress != null)
            {
                this.SearchComputerProgress(0, String.Format(this._localization.GetLocalizedString("FoundComputersInAD"), computers.Count));
            }

            System.Threading.SynchronizationContext uiContext = System.Threading.SynchronizationContext.Current;

            this._searcherThread = new System.Threading.Thread(new System.Threading.ThreadStart(() =>
            {
                if (computers.Count != 0)
                {
                    this.SearchComputersInWsus(computers);
                }
                uiContext.Post(new System.Threading.SendOrPostCallback(UpdateDataTable), computers);

                if (this.SearchComputerFinished != null)
                {
                    this.SearchComputerFinished();
                }
            }));
            this._searcherThread.Start();
        }
Пример #16
0
 public SynchronizationContextScheduler(System.Threading.SynchronizationContext context, bool alwaysPost)
 {
 }
Пример #17
0
        public IAsyncAction StartAsync(Uri baseUri, SuperCacheConfig configuration)
        {
            var window = Windows.UI.Core.CoreWindow.GetForCurrentThread();
            if (window != null)
            {
                coreDispatcher = window.Dispatcher;
            }

            context = System.Threading.SynchronizationContext.Current;
            return Initialize(baseUri, configuration).AsAsyncAction();
        }
Пример #18
0
 public FunctionWizardThread(Xl.Range range, System.Threading.SynchronizationContext xlcontext)
 {
     range_     = range;
     xlcontext_ = xlcontext;
 }
Пример #19
0
 public UI()
 {
     InitializeComponent();
     _ctx = System.Threading.SynchronizationContext.Current;
 }
Пример #20
0
 /// <summary>
 /// UI 线程上下文 POST 调用
 /// </summary>
 /// <param name="context">UI 线程上下文</param>
 /// <param name="action">回调委托</param>
 public SynchronizationContextPost(System.Threading.SynchronizationContext context, Action action)
 {
     this.context = context;
     this.action  = action;
 }
Пример #21
0
 public ContextDisposable(System.Threading.SynchronizationContext context, System.IDisposable disposable)
 {
 }
Пример #22
0
 public DelegateSellStoneWindows()
 {
     InitializeComponent();
     this._syn = System.Threading.SynchronizationContext.Current;
 }
Пример #23
0
 public static System.IObservable <TSource> SubscribeOn <TSource>(System.IObservable <TSource> source, System.Threading.SynchronizationContext context)
 {
     throw null;
 }
Пример #24
0
        public LogFrm()
        {
            synchronizationContext = System.Threading.SynchronizationContext.Current;

            InitializeComponent();
        }
Пример #25
0
 public static void Post(System.Threading.SynchronizationContext synchronizationContext, [System.Runtime.CompilerServices.Nullable(2)] System.Action postCallbackAction);
Пример #26
0
 public static void Post(System.Threading.SynchronizationContext synchronizationContext, [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] System.Func <System.Threading.Tasks.Task> postCallbackAsyncAction);
 public BasicClassThreadExample()
 {
     _SynchronizationContext = System.ComponentModel.AsyncOperationManager.SynchronizationContext;
 }
 public HMIGenericTCPClient()
 {
     //DataReceivedCallBackDelegate = New AsyncCallback(AddressOf DataReceivedCallback)
     m_ProtocolType           = System.Net.Sockets.ProtocolType.Tcp;
     m_synchronizationContext = System.Windows.Forms.WindowsFormsSynchronizationContext.Current;
 }
 public MainPage()
 {
     this.InitializeComponent();
     this.synchronizationContext = System.Threading.SynchronizationContext.Current;
     this.accessToken            = null;
 }
Пример #30
0
 /// <summary>
 /// Create an instance of PluginManager that will execute plugin reloads
 /// on the specified context.
 /// </summary>
 /// <param name="reloadContext"></param>
 public PluginManager(System.Threading.SynchronizationContext reloadContext)
     : this()
 {
     _reloadContext = reloadContext;
 }
Пример #31
0
 public static System.IObserver <T> NotifyOn <T>(this System.IObserver <T> observer, System.Threading.SynchronizationContext context)
 {
     throw null;
 }
Пример #32
0
        public MainPage()
        {
            this.InitializeComponent();

            string powerOuttagePost = PowerOuttageHandler.CheckLog().Result;
            SetUpMisc(powerOuttagePost);

            _uiSyncContext = System.Threading.SynchronizationContext.Current;

            DateTime dt = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"));
            txtblockTime.Text = dt.Hour.ToString() + ":" + dt.Minute.ToString(); // ToString("HH:mm:ss");

            timerDateTime = new DispatcherTimer();
            timerDateTime.Interval = TimeSpan.FromMilliseconds(300);
            //timerDateTime.Tick += TimerDateTime_Tick;
            timerDateTime.Tick += TimerDateTime_Tick1;
            timerDateTime.Start();

            setUpSystem();
            setUpBoardIO();


            controller = new Controller();
            configuration = new Configuration();
            powerHandler = new PowerOuttageHandler(configuration);
            network = new Network();

            Utilities.SparkEmail.Send(this.configuration.AssetNumber + " Starting ");


            viewModel = new VM.ViewModel(controller, configuration, cycleLights, network, sparkQueue, this);

            //sparkQueue = new SparkQueue();
            sparkQueue.DataReadyForPickUp += SparkQueue_DataReadyForPickUp;
        }
Пример #33
0
 public SynchronizationContextScheduler(System.Threading.SynchronizationContext context)
 {
 }
Пример #34
0
        private void Start()
        {
            context = System.Threading.SynchronizationContext.Current;

            controlWPFWindow.server.ReceivedEvent += Server_Received;

            steamVR2Input.KeyDownEvent     += ControllerAction_KeyDown;
            steamVR2Input.KeyUpEvent       += ControllerAction_KeyUp;
            steamVR2Input.AxisChangedEvent += ControllerAction_AxisChanged;

            KeyboardAction.KeyDownEvent += KeyboardAction_KeyDown;
            KeyboardAction.KeyUpEvent   += KeyboardAction_KeyUp;


            midiCCWrapper.noteOnDelegateProxy += async(channel, note, velocity) =>
            {
                Debug.Log("MidiNoteOn:" + channel + "/" + note + "/" + velocity);

                var config = new KeyConfig();
                config.type       = KeyTypes.Midi;
                config.actionType = KeyActionTypes.Face;
                config.keyCode    = (int)channel;
                config.keyIndex   = note;
                config.keyName    = MidiName(channel, note);
                if (doKeyConfig || doKeySend)
                {
                    await controlWPFWindow.server.SendCommandAsync(new PipeCommands.KeyDown {
                        Config = config
                    });
                }
                if (!doKeyConfig)
                {
                    CheckKey(config, true);
                }
            };

            midiCCWrapper.noteOffDelegateProxy += (channel, note) =>
            {
                Debug.Log("MidiNoteOff:" + channel + "/" + note);

                var config = new KeyConfig();
                config.type       = KeyTypes.Midi;
                config.actionType = KeyActionTypes.Face;
                config.keyCode    = (int)channel;
                config.keyIndex   = note;
                config.keyName    = MidiName(channel, note);
                if (doKeyConfig || doKeySend)
                {
                }                                //  await server.SendCommandAsync(new PipeCommands.KeyUp { Config = config });
                if (!doKeyConfig)
                {
                    CheckKey(config, false);
                }
            };
            midiCCWrapper.knobUpdateBoolDelegate += async(int knobNo, bool value) =>
            {
                MidiJack.MidiChannel channel = MidiJack.MidiChannel.Ch1; //仮でCh1
                Debug.Log("MidiCC:" + channel + "/" + knobNo + "/" + value);

                var config = new KeyConfig();
                config.type       = KeyTypes.MidiCC;
                config.actionType = KeyActionTypes.Face;
                config.keyCode    = (int)channel;
                config.keyIndex   = knobNo;
                config.keyName    = MidiName(channel, knobNo);

                if (value)
                {
                    if (doKeyConfig || doKeySend)
                    {
                        await controlWPFWindow.server.SendCommandAsync(new PipeCommands.KeyDown {
                            Config = config
                        });
                    }
                }
                else
                {
                    if (doKeyConfig || doKeySend)
                    {
                    }                                //  await server.SendCommandAsync(new PipeCommands.KeyUp { Config = config });
                }
                if (!doKeyConfig)
                {
                    CheckKey(config, value);
                }
            };

            midiCCWrapper.knobDelegateProxy += (MidiJack.MidiChannel channel, int knobNo, float value) =>
            {
                CheckKnobUpdated(channel, knobNo, value);
            };
        }
Пример #35
0
 internal HoverClient()
 {
     _syncContext = System.Threading.SynchronizationContext.Current;
 }
        public EthernetIPforCLXCom() : base()
        {

          // m_synchronizationContext = new System.Windows.Threading.DispatcherSynchronizationContext(Application.Current.Dispatcher);
            m_synchronizationContext = System.Threading.SynchronizationContext.Current;
        }
Пример #37
0
 public static void SetSynchronizationContext(System.Threading.SynchronizationContext syncContext)
 {
 }
Пример #38
0
        public DeployForm()
        {
            InitializeComponent();
            context = System.Threading.SynchronizationContext.Current;

            AutoCSer.Net.TcpInternalServer.ServerAttribute serverAttribute = AutoCSer.Web.Config.Pub.GetVerifyTcpServerAttribute(typeof(AutoCSer.Deploy.Server));
            serverAttribute.Host = AutoCSer.Web.Config.Deploy.ServerIp;
            DirectoryInfo webReleaseDirectory = new DirectoryInfo(@"..\..\..\www.AutoCSer.com\bin\Release\");
            string        serverWebPath       = AutoCSer.Web.Config.Deploy.ServerPath + @"www.AutoCSer.com\";

            AutoCSer.Deploy.ClientTask.Task[] htmlTasks = new AutoCSer.Deploy.ClientTask.Task[]
            {
                new AutoCSer.Deploy.ClientTask.WebFile
                {
                    ClientPath = webReleaseDirectory.Parent.Parent.FullName,
                    ServerPath = serverWebPath,
                },
                new AutoCSer.Deploy.ClientTask.File
                {
                    ClientPath     = webReleaseDirectory.Parent.Parent.FullName,
                    ServerPath     = serverWebPath,
                    SearchPatterns = new string[] { "*.png" }
                }
            };
            AutoCSer.Deploy.ClientTask.Task[] webTasks = new AutoCSer.Deploy.ClientTask.Task[]
            {
                htmlTasks[0],
                htmlTasks[1],
                new AutoCSer.Deploy.ClientTask.Run
                {
                    ClientPath = webReleaseDirectory.FullName,
                    ServerPath = AutoCSer.Web.Config.Deploy.ServerPath + @"www.AutoCSer.com\bin\Release\",
                    FileName   = "AutoCSer.Web.exe",
                }
            };
            AutoCSer.Deploy.ClientTask.Task[] httpTasks = new AutoCSer.Deploy.ClientTask.Task[]
            {
                webTasks[0],
                webTasks[1],
                webTasks[2],
                new AutoCSer.Deploy.ClientTask.AssemblyFile
                {
                    ClientPath = webReleaseDirectory.FullName,
                    ServerPath = AutoCSer.Web.Config.Deploy.ServerPath + @"www.AutoCSer.com\bin\Release\"
                },
                new AutoCSer.Deploy.ClientTask.Run
                {
                    ClientPath = new DirectoryInfo(@"..\..\..\HttpServer\bin\Release\").FullName,
                    ServerPath = AutoCSer.Web.Config.Deploy.ServerPath + @"HttpServer\bin\Release\",
                    FileName   = "AutoCSer.Web.HttpServer.exe",
                }
            };
            AutoCSer.Deploy.ClientTask.Task[] searchTasks = new AutoCSer.Deploy.ClientTask.Task[]
            {
                new AutoCSer.Deploy.ClientTask.Run
                {
                    ClientPath = new DirectoryInfo(@"..\..\..\SearchServer\bin\Release\").FullName,
                    ServerPath = AutoCSer.Web.Config.Deploy.ServerPath + @"SearchServer\bin\Release\",
                    FileName   = "AutoCSer.Web.SearchServer.exe",
                }
            };
            AutoCSer.Deploy.ClientTask.Task[] exampleTasks = new AutoCSer.Deploy.ClientTask.Task[]
            {
                new AutoCSer.Deploy.ClientTask.File
                {
                    ClientPath = new DirectoryInfo(@"..\..\..\www.AutoCSer.com\Download\").FullName,
                    ServerPath = AutoCSer.Web.Config.Deploy.ServerPath + @"www.AutoCSer.com\Download\",
                },
                new AutoCSer.Deploy.ClientTask.File
                {
                    ClientPath     = new DirectoryInfo(@"..\..\..\..\Example\").FullName,
                    ServerPath     = AutoCSer.Web.Config.Deploy.ServerPath + @"Example\",
                    SearchPatterns = new string[] { "*.cs", "*.html", "*.ts", "*.js", "*.css", "*.json" },
                },
                new AutoCSer.Deploy.ClientTask.File
                {
                    ClientPath     = new DirectoryInfo(@"..\..\..\..\TestCase\").FullName,
                    ServerPath     = AutoCSer.Web.Config.Deploy.ServerPath + @"TestCase\",
                    SearchPatterns = new string[] { "*.cs", "*.html", "*.ts", "*.js" },
                },
                new AutoCSer.Deploy.ClientTask.Custom
                {
                    CallName = "OnExample"
                }
            };
            AutoCSer.Deploy.ClientTask.Task[] updateDeployServerTasks = new AutoCSer.Deploy.ClientTask.Task[]
            {
                new AutoCSer.Deploy.ClientTask.File
                {
                    ClientPath     = new DirectoryInfo(@"..\..\..\DeployServer\bin\Release\").FullName,
                    ServerPath     = AutoCSer.Web.Config.Deploy.ServerPath + @"DeployServer\bin\Release\" + AutoCSer.Deploy.Server.DefaultUpdateDirectoryName,
                    SearchPatterns = new string[] { "*.*" }
                },
                new AutoCSer.Deploy.ClientTask.Custom
                {
                    CallName = "OnDeployServerUpdated",
                }
            };
            AutoCSer.Deploy.ClientTask.Task[] gameWebTasks = new AutoCSer.Deploy.ClientTask.Task[]
            {
                new AutoCSer.Deploy.ClientTask.File
                {
                    ClientPath     = @"C:\showjim\CardGame\CardGame\WebPage\",
                    ServerPath     = serverWebPath,
                    SearchPatterns = new string[] { "*.*" }
                }
            };
            AutoCSer.Deploy.ClientTask.Task[] gameServerTasks = new AutoCSer.Deploy.ClientTask.Task[]
            {
                new AutoCSer.Deploy.ClientTask.File
                {
                    ClientPath     = @"C:\showjim\CardGame\CardGame\Data\",
                    ServerPath     = AutoCSer.Web.Config.GameServer.Path,
                    SearchPatterns = new string[] { "*.*" }
                },
                new AutoCSer.Deploy.ClientTask.File
                {
                    ClientPath     = @"C:\showjim\CardGame\GameServer\bin\Release\",
                    ServerPath     = AutoCSer.Web.Config.GameServer.Path + AutoCSer.Deploy.Server.DefaultUpdateDirectoryName,
                    SearchPatterns = new string[] { "*.*" }
                },
                new AutoCSer.Deploy.ClientTask.Custom
                {
                    CallName = "OnGameServerUpdated",
                }
            };
            AutoCSer.Deploy.ClientDeploy[] deploys = new AutoCSer.Deploy.ClientDeploy[]
            {
                new AutoCSer.Deploy.ClientDeploy
                {
                    Name       = "HTML",
                    ServerName = AutoCSer.Deploy.Server.ServerName,
                    Tasks      = htmlTasks
                },
                new AutoCSer.Deploy.ClientDeploy
                {
                    Name       = "Web",
                    ServerName = AutoCSer.Deploy.Server.ServerName,
                    Tasks      = webTasks
                },
                new AutoCSer.Deploy.ClientDeploy
                {
                    Name       = "Web/Http",
                    ServerName = AutoCSer.Deploy.Server.ServerName,
                    Tasks      = httpTasks
                },
                new AutoCSer.Deploy.ClientDeploy
                {
                    Name       = "Search",
                    ServerName = AutoCSer.Deploy.Server.ServerName,
                    Tasks      = searchTasks
                },
                new AutoCSer.Deploy.ClientDeploy
                {
                    Name       = "Example",
                    ServerName = AutoCSer.Deploy.Server.ServerName,
                    Tasks      = exampleTasks
                },
                new AutoCSer.Deploy.ClientDeploy
                {
                    Name       = "DeployServer",
                    ServerName = AutoCSer.Deploy.Server.ServerName,
                    Tasks      = updateDeployServerTasks
                },
                new AutoCSer.Deploy.ClientDeploy
                {
                    Name       = "GameWeb",
                    ServerName = AutoCSer.Deploy.Server.ServerName,
                    Tasks      = gameWebTasks
                },
                new AutoCSer.Deploy.ClientDeploy
                {
                    Name       = "GameServer",
                    ServerName = AutoCSer.Deploy.Server.ServerName,
                    Tasks      = gameServerTasks
                }
            };
            AutoCSer.Deploy.ClientConfig config = new Deploy.ClientConfig
            {
                //RunFilePaths = new string[] { webReleaseDirectory.FullName },
                ServerAttributes = new KeyValue <string, Net.TcpInternalServer.ServerAttribute>[] { new KeyValue <string, Net.TcpInternalServer.ServerAttribute>(AutoCSer.Deploy.Server.ServerName, serverAttribute) },
                Deploys          = deploys
            };
            client = new AutoCSer.Deploy.Client(config, context.GetPost <AutoCSer.Deploy.OnClientParameter>(onClient));
            //do
            //{
            //    int index = 0;
            //    foreach (AutoCSer.Deploy.ClientDeploy deployInfo in deploys)
            //    {
            //        Console.ForegroundColor = (index & 1) == 0 ? ConsoleColor.Red : ConsoleColor.White;
            //        Console.WriteLine((index++).toString() + " -> " + toString(deployInfo));
            //    }
            //    Console.ForegroundColor = (index & 1) == 0 ? ConsoleColor.Red : ConsoleColor.White;
            //    Console.WriteLine((index++).toString() + " -> create Open Example");
            //    Console.ForegroundColor = (index & 1) == 0 ? ConsoleColor.Red : ConsoleColor.White;
            //    Console.WriteLine((index++).toString() + " -> create AutoCSer.zip");
            //    Console.ForegroundColor = (index & 1) == 0 ? ConsoleColor.Red : ConsoleColor.White;
            //    Console.WriteLine((index++).toString() + " -> Push Nuget");

            //    Console.ResetColor();
            //    Console.WriteLine("press quit to exit.");
            //    string command = Console.ReadLine();
            //    if (command == "quit") return;
            //    if (int.TryParse(command, out index))
            //    {
            //        if ((uint)index < (uint)deploys.Length)
            //        {
            //            try
            //            {
            //                Console.WriteLine("正在启动部署 " + toString(deploys[index]));
            //                AutoCSer.Deploy.DeployResult result = client.Deploy(index);
            //                if (result.State == AutoCSer.Deploy.DeployState.Success) Console.WriteLine("部署启动完毕 " + toString(deploys[index]) + " => " + result.Index.toString());
            //                else Console.WriteLine("部署启动失败 [" + result.State.ToString() + "] " + toString(deploys[index]));
            //            }
            //            catch (Exception error)
            //            {
            //                Console.WriteLine(error.ToString());
            //            }
            //        }
            //        else
            //        {
            //            switch (index - deploys.Length)
            //            {
            //                case 0: openExample(); break;
            //                case 1: openProcess(@"..\..\..\..\Web\Pack\bin\Release\AutoCSer.Web.Pack.exe"); break;
            //                case 2: pushNuget(); break;
            //                default: index = -1; break;
            //            }
            //        }
            //    }
            //    else index = -1;
            //    if (index == -1) Console.WriteLine("Error Command");
            //    Console.WriteLine();
            //}
            //while (true);
        }
Пример #39
0
 public FixedTimePointSchedule()
 {
     //获取UI线程同步上下文
     m_syncContext   = System.Threading.SynchronizationContext.Current;
     m_scheduleState = ScheduleState.None;
 }
Пример #40
0
        public DeployForm()
        {
            InitializeComponent();
            context = System.Threading.SynchronizationContext.Current;

            AutoCSer.Net.TcpInternalServer.ServerAttribute serverAttribute = AutoCSer.Web.Config.Pub.GetVerifyTcpServerAttribute(typeof(AutoCSer.Deploy.Server));
            serverAttribute.Host = AutoCSer.Web.Config.Deploy.ServerIp;
            DirectoryInfo webReleaseDirectory = new DirectoryInfo(@"..\..\..\www.AutoCSer.com\bin\Release\");
            string        serverWebPath       = AutoCSer.Web.Config.Deploy.ServerPath + @"www.AutoCSer.com\";

            AutoCSer.Deploy.ClientTask.Task[] htmlTasks = new AutoCSer.Deploy.ClientTask.Task[]
            {
                new AutoCSer.Deploy.ClientTask.WebFile
                {
                    ClientPath = webReleaseDirectory.Parent.Parent.FullName,
                    ServerPath = serverWebPath,
                },
                new AutoCSer.Deploy.ClientTask.File
                {
                    ClientPath     = webReleaseDirectory.Parent.Parent.FullName,
                    ServerPath     = serverWebPath,
                    SearchPatterns = new string[] { "*.png" }
                }
            };
            AutoCSer.Deploy.ClientTask.Task[] webTasks = new AutoCSer.Deploy.ClientTask.Task[]
            {
                htmlTasks[0],
                htmlTasks[1],
                new AutoCSer.Deploy.ClientTask.AssemblyFile
                {
                    ClientPath = webReleaseDirectory.FullName,
                    ServerPath = AutoCSer.Web.Config.Deploy.ServerPath + @"www.AutoCSer.com\bin\Release\",
                },
                new AutoCSer.Deploy.ClientTask.Run
                {
                    ServerPath = AutoCSer.Web.Config.Deploy.ServerPath + @"www.AutoCSer.com\bin\Release\",
                    FileName   = "AutoCSer.Web.exe",
                }
            };
            AutoCSer.Deploy.ClientTask.Task[] httpTasks = new AutoCSer.Deploy.ClientTask.Task[]
            {
                webTasks[0],
                webTasks[1],
                webTasks[2],
                new AutoCSer.Deploy.ClientTask.AssemblyFile
                {
                    ClientPath = webReleaseDirectory.FullName,
                    ServerPath = AutoCSer.Web.Config.Deploy.ServerPath + @"www.AutoCSer.com\bin\Release\"
                },
                new AutoCSer.Deploy.ClientTask.AssemblyFile
                {
                    ClientPath = new DirectoryInfo(@"..\..\..\HttpServer\bin\Release\").FullName,
                    ServerPath = AutoCSer.Web.Config.Deploy.ServerPath + @"HttpServer\bin\Release\" + AutoCSer.Deploy.Server.DefaultUpdateDirectoryName,
                },
                new AutoCSer.Deploy.ClientTask.UpdateSwitchFile
                {
                    ServerPath = AutoCSer.Web.Config.Deploy.ServerPath + @"HttpServer\bin\Release\",
                    FileName   = "AutoCSer.Web.HttpServer.exe",
                }
            };
            AutoCSer.Deploy.ClientTask.Task[] searchTasks = new AutoCSer.Deploy.ClientTask.Task[]
            {
                new AutoCSer.Deploy.ClientTask.AssemblyFile
                {
                    ClientPath = new DirectoryInfo(@"..\..\..\SearchServer\bin\Release\").FullName,
                    ServerPath = AutoCSer.Web.Config.Deploy.ServerPath + @"SearchServer\bin\Release\" + AutoCSer.Deploy.Server.DefaultUpdateDirectoryName,
                },
                new AutoCSer.Deploy.ClientTask.UpdateSwitchFile
                {
                    ServerPath = AutoCSer.Web.Config.Deploy.ServerPath + @"SearchServer\bin\Release\",
                    FileName   = "AutoCSer.Web.SearchServer.exe",
                }
            };
            AutoCSer.Deploy.ClientTask.Task[] exampleTasks = new AutoCSer.Deploy.ClientTask.Task[]
            {
                new AutoCSer.Deploy.ClientTask.File
                {
                    ClientPath = new DirectoryInfo(@"..\..\..\www.AutoCSer.com\Download\").FullName,
                    ServerPath = AutoCSer.Web.Config.Deploy.ServerPath + @"www.AutoCSer.com\Download\",
                },
                new AutoCSer.Deploy.ClientTask.File
                {
                    ClientPath     = new DirectoryInfo(@"..\..\..\..\Example\").FullName,
                    ServerPath     = AutoCSer.Web.Config.Deploy.ServerPath + @"Example\",
                    SearchPatterns = new string[] { "*.cs", "*.html", "*.ts", "*.js", "*.css", "*.json" },
                },
                new AutoCSer.Deploy.ClientTask.File
                {
                    ClientPath     = new DirectoryInfo(@"..\..\..\..\TestCase\").FullName,
                    ServerPath     = AutoCSer.Web.Config.Deploy.ServerPath + @"TestCase\",
                    SearchPatterns = new string[] { "*.cs", "*.html", "*.ts", "*.js" },
                },
                new AutoCSer.Deploy.ClientTask.Custom
                {
                    CallName = "OnExample"
                }
            };
            AutoCSer.Deploy.ClientTask.Task[] updateDeployServerTasks = new AutoCSer.Deploy.ClientTask.Task[]
            {
                new AutoCSer.Deploy.ClientTask.File
                {
                    ClientPath     = new DirectoryInfo(@"..\..\..\DeployServer\bin\Release\").FullName,
                    ServerPath     = AutoCSer.Web.Config.Deploy.ServerPath + @"DeployServer\bin\Release\" + AutoCSer.Deploy.Server.DefaultUpdateDirectoryName,
                    SearchPatterns = new string[] { "*.*" }
                },
                new AutoCSer.Deploy.ClientTask.UpdateSwitchFile {
                    FileName = string.Empty
                }
            };
            AutoCSer.Deploy.ClientTask.Task[] gameWebTasks = new AutoCSer.Deploy.ClientTask.Task[]
            {
                new AutoCSer.Deploy.ClientTask.File
                {
                    ClientPath     = @"C:\showjim\CardGame\CardGame\WebPage\",
                    ServerPath     = serverWebPath,
                    SearchPatterns = new string[] { "*.*" }
                }
            };
            AutoCSer.Deploy.ClientTask.Task[] gameServerTasks = new AutoCSer.Deploy.ClientTask.Task[]
            {
                new AutoCSer.Deploy.ClientTask.File
                {
                    ClientPath     = @"C:\showjim\CardGame\CardGame\Data\",
                    ServerPath     = AutoCSer.Web.Config.GameServer.Path,
                    SearchPatterns = new string[] { "*.*" }
                },
                new AutoCSer.Deploy.ClientTask.File
                {
                    ClientPath     = @"C:\showjim\CardGame\GameServer\bin\Release\",
                    ServerPath     = AutoCSer.Web.Config.GameServer.Path + AutoCSer.Deploy.Server.DefaultUpdateDirectoryName,
                    SearchPatterns = new string[] { "*.*" }
                },
                new AutoCSer.Deploy.ClientTask.UpdateSwitchFile
                {
                    ServerPath = AutoCSer.Web.Config.GameServer.Path,
                    FileName   = "AutoCSer.GameServer.exe",
                }
            };
            AutoCSer.Deploy.ClientDeploy[] deploys = new AutoCSer.Deploy.ClientDeploy[]
            {
                new AutoCSer.Deploy.ClientDeploy
                {
                    Name       = "HTML",
                    ServerName = AutoCSer.Deploy.Server.ServerName,
                    Tasks      = htmlTasks
                },
                new AutoCSer.Deploy.ClientDeploy
                {
                    Name       = "Web",
                    ServerName = AutoCSer.Deploy.Server.ServerName,
                    Tasks      = webTasks
                },
                new AutoCSer.Deploy.ClientDeploy
                {
                    Name       = "Web/Http",
                    ServerName = AutoCSer.Deploy.Server.ServerName,
                    Tasks      = httpTasks
                },
                new AutoCSer.Deploy.ClientDeploy
                {
                    Name       = "Search",
                    ServerName = AutoCSer.Deploy.Server.ServerName,
                    Tasks      = searchTasks
                },
                new AutoCSer.Deploy.ClientDeploy
                {
                    Name       = "Example",
                    ServerName = AutoCSer.Deploy.Server.ServerName,
                    Tasks      = exampleTasks
                },
                new AutoCSer.Deploy.ClientDeploy
                {
                    Name       = "DeployServer",
                    ServerName = AutoCSer.Deploy.Server.ServerName,
                    Tasks      = updateDeployServerTasks
                },
                new AutoCSer.Deploy.ClientDeploy
                {
                    Name       = "GameWeb",
                    ServerName = AutoCSer.Deploy.Server.ServerName,
                    Tasks      = gameWebTasks
                },
                new AutoCSer.Deploy.ClientDeploy
                {
                    Name       = "GameServer",
                    ServerName = AutoCSer.Deploy.Server.ServerName,
                    Tasks      = gameServerTasks
                }
            };
            AutoCSer.Deploy.ClientConfig config = new Deploy.ClientConfig
            {
                //RunFilePaths = new string[] { webReleaseDirectory.FullName },
                ServerAttributes = new KeyValue <string, Net.TcpInternalServer.ServerAttribute>[] { new KeyValue <string, Net.TcpInternalServer.ServerAttribute>(AutoCSer.Deploy.Server.ServerName, serverAttribute) },
                Deploys          = deploys
            };
            client = new AutoCSer.Deploy.Client(config, context.GetPost <AutoCSer.Deploy.OnClientParameter>(onClient));
        }