当前位置: 首页>>代码示例>>C#>>正文


C# Threading.SynchronizationContext类代码示例

本文整理汇总了C#中System.Threading.SynchronizationContext的典型用法代码示例。如果您正苦于以下问题:C# SynchronizationContext类的具体用法?C# SynchronizationContext怎么用?C# SynchronizationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SynchronizationContext类属于System.Threading命名空间,在下文中一共展示了SynchronizationContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToolStripGitStatus

        public ToolStripGitStatus()
        {
            syncContext = SynchronizationContext.Current;
            gitGetUnstagedCommand.Exited += new EventHandler(delegate(object o, EventArgs ea)
                {
                    syncContext.Post(_ => onData(), null);
                });

            InitializeComponent();

            Settings.WorkingDirChanged += new Settings.WorkingDirChangedHandler(Settings_WorkingDirChanged);

            // Setup a file watcher to detect changes to our files, or the .git repo files. When they
            // change, we'll update our status.
            watcher.Changed += new FileSystemEventHandler(watcher_Changed);
            watcher.Created += new FileSystemEventHandler(watcher_Changed);
            watcher.Deleted += new FileSystemEventHandler(watcher_Changed);
            watcher.Error += new ErrorEventHandler(watcher_Error);
            watcher.IncludeSubdirectories = true;

            try
            {
                watcher.Path = Settings.WorkingDir;
                watcher.EnableRaisingEvents = true;
            }
            catch { }
            update();
        }
开发者ID:bleis-tift,项目名称:gitextensions,代码行数:28,代码来源:ToolStripGitStatus.cs

示例2: Client

        public Client(int id, Config cfg, SynchronizationContext ctx)
        {
            ClientStatisticsGatherer = new ClientStatisticsGatherer();

              _ctx = ctx;
              _id = id;

              Data = new TestData(this);
              IsStopped = false;

              _log = LogManager.GetLogger("Client_" + _id);
              _log.Debug("Client created");

              Configure(cfg);

              if (String.IsNullOrEmpty(_login))
              {
            const string err = "Login command is not specified!!! Can't do any test.";
            _log.Error(err);

            throw new Exception(err);
              }

              _ajaxHelper = new AjaxHelper(new AjaxConn(_login, cfg.ServerIp, cfg.AjaxPort, _ctx));
              _webSock = new WebSockConn(_login, cfg.ServerIp, cfg.WsPort, ctx);

              _webSock.CcsStateChanged += WsOnCcsStateChanged;
              _webSock.InitializationFinished += () => _testMng.GetTest<LoginTest>().OnClientInitialized();
              _testMng.SetEnv(_login, _ajaxHelper.AjaxConn, _webSock);
        }
开发者ID:sadstorm,项目名称:LoadTester112,代码行数:30,代码来源:Client.cs

示例3: MainForm

 public MainForm()
 {
     InitializeComponent();
     context = SynchronizationContext.Current;
     actions = new List<ActionEntry>();
     schedualeList = new Hashtable();
 }
开发者ID:Armanu,项目名称:Click_Looper,代码行数:7,代码来源:MainForm.cs

示例4: CloverExamplePOSForm

        public CloverExamplePOSForm()
        {
            //new CaptureLog();

            InitializeComponent();
            uiThread = WindowsFormsSynchronizationContext.Current;
        }
开发者ID:roninstar,项目名称:remote-pay-windows,代码行数:7,代码来源:CloverExamplePOSForm.cs

示例5: CommitInfo

        public CommitInfo()
        {
            _syncContext = SynchronizationContext.Current;

            InitializeComponent();
            Translate();
        }
开发者ID:robin521111,项目名称:gitextensions,代码行数:7,代码来源:CommitInfo.cs

示例6: OnLoad

        protected override void OnLoad(EventArgs e)
        {
            if(InputDevice.DeviceCount == 0)
            {
                MessageBox.Show("No MIDI input devices available.", "Error!",
                    MessageBoxButtons.OK, MessageBoxIcon.Stop);
                Close();
            }
            else
            {
                try
                {
                    context = SynchronizationContext.Current;

                    inDevice = new InputDevice(0);
                    inDevice.ChannelMessageReceived += HandleChannelMessageReceived;
                    inDevice.SysCommonMessageReceived += HandleSysCommonMessageReceived;
                    inDevice.SysExMessageReceived += HandleSysExMessageReceived;
                    inDevice.SysRealtimeMessageReceived += HandleSysRealtimeMessageReceived;
                    inDevice.Error += new EventHandler<ErrorEventArgs>(inDevice_Error);                    
                }
                catch(Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error!",
                        MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    Close();
                }
            }

            base.OnLoad(e);
        }            
开发者ID:Jbtyson,项目名称:cis598,代码行数:31,代码来源:Form1.cs

示例7: RevisionGrid

        public RevisionGrid()
        {
            syncContext = SynchronizationContext.Current;

            base.InitLayout();
            InitializeComponent();
            Revisions.Columns[0].Width = 40;

            NormalFont = Revisions.Font;
            HeadFont = new Font(NormalFont, FontStyle.Bold);
            //RefreshRevisions();
            Revisions.CellPainting += new DataGridViewCellPaintingEventHandler(Revisions_CellPainting);
            Revisions.SizeChanged += new EventHandler(Revisions_SizeChanged);

            Revisions.KeyDown += new KeyEventHandler(Revisions_KeyDown);

            showRevisionGraphToolStripMenuItem.Checked = Settings.ShowRevisionGraph;
            showAuthorDateToolStripMenuItem.Checked = Settings.ShowAuthorDate;
            orderRevisionsByDateToolStripMenuItem.Checked = Settings.OrderRevisionByDate;
            showRelativeDateToolStripMenuItem.Checked = Settings.RelativeDate;

            SetShowBranches();
            filter = "";
            quickSearchString = "";
            quickSearchTimer.Tick += new EventHandler(quickSearchTimer_Tick);
        }
开发者ID:bszafko,项目名称:gitextensions,代码行数:26,代码来源:RevisionGrid.cs

示例8: RevisionGrid

        public RevisionGrid()
        {
            _syncContext = SynchronizationContext.Current;

            base.InitLayout();
            InitializeComponent();
            Translate();

            NormalFont = Revisions.Font;
            HeadFont = new Font(NormalFont, FontStyle.Underline);
            RefsFont = new Font(NormalFont, FontStyle.Bold);

            Revisions.CellPainting += RevisionsCellPainting;
            Revisions.KeyDown += RevisionsKeyDown;

            showRevisionGraphToolStripMenuItem.Checked = Settings.ShowRevisionGraph;
            showAuthorDateToolStripMenuItem.Checked = Settings.ShowAuthorDate;
            orderRevisionsByDateToolStripMenuItem.Checked = Settings.OrderRevisionByDate;
            showRelativeDateToolStripMenuItem.Checked = Settings.RelativeDate;

            BranchFilter = String.Empty;
            SetShowBranches();
            Filter = "";
            _quickSearchString = "";
            quickSearchTimer.Tick += QuickSearchTimerTick;

            Revisions.Loading += RevisionsLoading;
        }
开发者ID:TwistedHope,项目名称:gitextensions,代码行数:28,代码来源:RevisionGrid.cs

示例9: CommChannel

        public CommChannel(Stream input, Stream output)
        {
            _input = new BinaryReader(input);
            _output = new BinaryWriter(output);
            _dispatcher = SynchronizationContext.Current;

        }
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:7,代码来源:CommChannel.cs

示例10: GitLogForm

 private GitLogForm()
 {
     ShowInTaskbar = true;
     syncContext = SynchronizationContext.Current;
     InitializeComponent();
     Translate();
 }
开发者ID:phiree,项目名称:gitextensions,代码行数:7,代码来源:GitLogForm.cs

示例11: Conversation

        internal Conversation(ConversationState conversationState)
        {
            _synchronizationContext = Client.CurrentSynchronizationContext;

            _conversation = conversationState.conversation;
            if (_conversation.read_state.Count > 0)
                ReadState = _conversation.read_state.Last(c=>c.latest_read_timestamp > 0).latest_read_timestamp.FromUnixTime();
            if (_conversation.self_conversation_state.self_read_state != null)
                SelfReadState = _conversation.self_conversation_state.self_read_state.latest_read_timestamp.FromUnixTime();
            Participants = _conversation.participant_data.ToDictionary(c=>c.id.chat_id, c => new Participant(c));
            MessagesHistory = new ObservableCollection<Message>();

            foreach(var cse in conversationState.events.Where(c=>c.chat_message != null))
            {
                messagesIds.Add(cse.event_id, cse.timestamp);
                if (_lastMessage != null && _lastMessage.SenderId == cse.sender_id.gaia_id)
                    _lastMessage.AddContent(cse);
                else
                {
                    _lastMessage = new Message(cse);
                    MessagesHistory.Add(_lastMessage);
                }

            }
        }
开发者ID:Rhombulus,项目名称:WTalk,代码行数:25,代码来源:Conversation.cs

示例12: ToolStripGitStatus

        public ToolStripGitStatus()
        {
            syncContext = SynchronizationContext.Current;
            gitGetUnstagedCommand.Exited += (o, ea) => syncContext.Post(_ => onData(), null);

            InitializeComponent();
            CommitTranslatedString = "Commit";

            Settings.WorkingDirChanged += (_, newDir, newGitDir) => TryStartWatchingChanges(newDir, newGitDir);

            GitUICommands.Instance.PreCheckoutBranch += GitUICommands_PreCheckout;
            GitUICommands.Instance.PreCheckoutRevision += GitUICommands_PreCheckout;
            GitUICommands.Instance.PostCheckoutBranch += GitUICommands_PostCheckout;
            GitUICommands.Instance.PostCheckoutRevision += GitUICommands_PostCheckout;

            // Setup a file watcher to detect changes to our files. When they
            // change, we'll update our status.
            watcher.Changed += watcher_Changed;
            watcher.Created += watcher_Changed;
            watcher.Deleted += watcher_Changed;
            watcher.Error += watcher_Error;
            watcher.IncludeSubdirectories = true;
            watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite;

            // Setup a file watcher to detect changes to the .git repo files. When they
            // change, we'll update our status.
            gitDirWatcher.Changed += gitWatcher_Changed;
            gitDirWatcher.Created += gitWatcher_Changed;
            gitDirWatcher.Deleted += gitWatcher_Changed;
            gitDirWatcher.Error += watcher_Error;
            gitDirWatcher.IncludeSubdirectories = true;
            gitDirWatcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite;

            TryStartWatchingChanges(Settings.WorkingDir, Settings.Module.GetGitDirectory());
        }
开发者ID:bartbart,项目名称:gitextensions,代码行数:35,代码来源:ToolStripGitStatus.cs

示例13: SynergyV4MainWindow

 public SynergyV4MainWindow()
 {
     InitializeComponent();
     syncContext = SynchronizationContext.Current;
     _sh.DbSavePending = false;
     this.DataContext = this;
 }
开发者ID:BBuchholz,项目名称:NineWorldsDeep,代码行数:7,代码来源:SynergyV4MainWindow.xaml.cs

示例14: DocumentModel

 public DocumentModel(string path)
 {
     if (path == null) throw new ArgumentNullException("path");
     FilePath = path;
     Size = new FileInfo(path).Length;
     syncContext = SynchronizationContext.Current;
 }
开发者ID:Amichai,项目名称:Prax,代码行数:7,代码来源:DocumentModel.cs

示例15: MainViewModel

        public MainViewModel(IPopupService popupService, SynchronizationContext synchonizationContext)
        {
            var client = new MobileServiceClient(
                _mobileServiceUrl,
                _mobileServiceKey);

            _liveAuthClient = new LiveAuthClient(_mobileServiceUrl);
            
            // Apply a ServiceFilter to the mobile client to help with our busy indication
            _mobileServiceClient = client.WithFilter(new DotoServiceFilter(
                busy =>
                {
                    IsBusy = busy;
                }));
            _popupService = popupService;
            _synchronizationContext = synchonizationContext;
            _invitesTable = _mobileServiceClient.GetTable<Invite>();
            _itemsTable = _mobileServiceClient.GetTable<Item>();
            _profilesTable = _mobileServiceClient.GetTable<Profile>();
            _listMembersTable = _mobileServiceClient.GetTable<ListMembership>();
            _devicesTable = _mobileServiceClient.GetTable<Device>();
            _settingsTable = _mobileServiceClient.GetTable<Setting>();

            SetupCommands();

            LoadSettings();
        }
开发者ID:TroyBolton,项目名称:azure-mobile-services,代码行数:27,代码来源:MainViewModel.cs


注:本文中的System.Threading.SynchronizationContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。