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();
        }
Example #2
0
 /// <summary>
 /// Creates a new WASAPI Output
 /// </summary>
 /// <param name="device">Device to use</param>
 /// <param name="shareMode"></param>
 /// <param name="latency"></param>
 public WasapiOutRT(string device, AudioClientShareMode shareMode, int latency)
 {
     this.device = device;
     this.shareMode = shareMode;
     this.latencyMilliseconds = latency;
     this.syncContext = SynchronizationContext.Current;
 }
        public void SubirArchivoACarpeta(String rutaArchivoSubir, String nombreCarpetaOneDrive)
        {
            mainThreadContext = System.Threading.SynchronizationContext.Current;
            rutaArchivo       = rutaArchivoSubir;
            carpeta           = nombreCarpetaOneDrive;
            carpeta           = carpeta.Replace("\\", "/");
            if (!carpeta.EndsWith("/"))
            {
                carpeta += "/";
            }
            //haciendo login

            Control.CheckForIllegalCrossThreadCalls = false;
            url_login = string.Format(url_login, client_id, redirect_uri);

            wb = new WebBrowser();
            wb.DocumentCompleted += wb_DocumentCompleted;
            //Thread t = new Thread(Iniciar);
            //t.Start();
            try
            {
                wb.Navigate(new Uri(url_login));
            }
            catch (Exception ex)
            {
                if (error != null)
                {
                    error(rutaArchivo, new Exception("Ocurrió un error al intentar loguearse.", ex));
                }
            }
        }
Example #4
0
 public DocumentModel(string path)
 {
     if (path == null) throw new ArgumentNullException("path");
     FilePath = path;
     Size = new FileInfo(path).Length;
     syncContext = SynchronizationContext.Current;
 }
Example #5
0
 private AsyncOperation(object userSuppliedState, System.Threading.SynchronizationContext syncContext)
 {
     this.userSuppliedState = userSuppliedState;
     this.syncContext       = syncContext;
     this.alreadyCompleted  = false;
     this.syncContext.OperationStarted();
 }
        public EditDiamondShoppingItemWindow(DiamondShoppingItemUIModel oldItem)
        {
            InitializeComponent();
            this.Title = "修改钻石商品";
            isAdd      = false;
            _syn       = SynchronizationContext.Current;
            Init();

            this._oldItem            = oldItem;
            this.oldID               = oldItem.ID;
            this.txtID.Text          = oldItem.ID.ToString();
            this.txtTitle.Text       = oldItem.Name;
            this.txtRemark.Text      = oldItem.Remark;
            this.numPrice.Value      = (double)oldItem.ValueDiamonds;
            this.txtDetailText.Text  = oldItem.DetailText;
            this.numStockCount.Value = oldItem.StocksCount;
            this.imgIcon.Source      = oldItem.Icon;
            this._iconBuffer         = oldItem.IconBuffer;
            if (oldItem.DetailImageNames != null)
            {
                this.ListDetailImageNames = new ObservableCollection <string>(oldItem.DetailImageNames);
            }
            this.cmbItemType.SelectedValue = (int)oldItem.ItemType;

            GlobalData.Client.UpdateDiamondShoppingItemCompleted += Client_UpdateDiamondShoppingItemCompleted;
        }
Example #7
0
        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);
        }
        public FormFileHistory(string fileName, GitRevision revision, bool filterByRevision)
            : base(true)
        {
            InitializeComponent();
            syncContext = SynchronizationContext.Current;
            filterBranchHelper = new FilterBranchHelper(toolStripBranches, toolStripDropDownButton2, FileChanges);

            filterRevisionsHelper = new FilterRevisionsHelper(toolStripTextBoxFilter, toolStripDropDownButton1, FileChanges, toolStripLabel2, this);

            FileChanges.SetInitialRevision(revision);
            Translate();

            FileName = fileName;

            Diff.ExtraDiffArgumentsChanged += DiffExtraDiffArgumentsChanged;

            FileChanges.SelectionChanged += FileChangesSelectionChanged;
            FileChanges.DisableContextMenu();

            followFileHistoryToolStripMenuItem.Checked = Settings.FollowRenamesInFileHistory;
            fullHistoryToolStripMenuItem.Checked = Settings.FullHistoryInFileHistory;
            loadHistoryOnShowToolStripMenuItem.Checked = Settings.LoadFileHistoryOnShow;
            loadBlameOnShowToolStripMenuItem.Checked = Settings.LoadBlameOnShow;

            if (filterByRevision && revision != null && revision.Guid != null)
                filterBranchHelper.SetBranchFilter(revision.Guid, false);
        }
Example #9
0
        /// <summary>
        /// Retrieves the ably service time
        /// </summary>
        /// <returns></returns>
        public void Time(Action <DateTimeOffset?, AblyException> callback)
        {
            System.Threading.SynchronizationContext sync = System.Threading.SynchronizationContext.Current;

            Action <DateTimeOffset?, AblyException> invokeCallback = (res, err) =>
            {
                if (callback != null)
                {
                    if (sync != null)
                    {
                        sync.Send(new SendOrPostCallback(o => callback(res, err)), null);
                    }
                    else
                    {
                        callback(res, err);
                    }
                }
            };

            ThreadPool.QueueUserWorkItem(state =>
            {
                DateTimeOffset result;
                try
                {
                    result = _simpleRest.Time();
                }
                catch (AblyException e)
                {
                    invokeCallback(null, e);
                    return;
                }
                invokeCallback(result, null);
            });
        }
Example #10
0
        public CalendarViewModel(ICalendarService calendarService, IRegionManager regionManager)
        {
            this.synchronizationContext = SynchronizationContext.Current ?? new SynchronizationContext();

            this.openMeetingEmailCommand = new DelegateCommand<Meeting>(this.OpenMeetingEmail);

            this.meetings = new ObservableCollection<Meeting>();

            this.calendarService = calendarService;
            this.regionManager = regionManager;

            this.calendarService.BeginGetMeetings(
                r =>
                {
                    var meetings = this.calendarService.EndGetMeetings(r);

                    this.synchronizationContext.Post(
                        s =>
                        {
                            foreach (var meeting in meetings)
                            {
                                this.Meetings.Add(meeting);
                            }
                        },
                        null);
                },
                null);
        }
Example #11
0
 /// <summary>
 ///     Constructor. Protected to avoid unwitting usage - AsyncOperation objects
 ///     are typically created by AsyncOperationManager calling CreateOperation.
 /// </summary>
 private AsyncOperation(object userSuppliedState, SynchronizationContext syncContext)
 {
     this.userSuppliedState = userSuppliedState;
     this.syncContext = syncContext;
     this.alreadyCompleted = false;
     this.syncContext.OperationStarted();
 }
 public SynergyV4MainWindow()
 {
     InitializeComponent();
     syncContext = SynchronizationContext.Current;
     _sh.DbSavePending = false;
     this.DataContext = this;
 }
        public CloverExamplePOSForm()
        {
            //new CaptureLog();

            InitializeComponent();
            uiThread = WindowsFormsSynchronizationContext.Current;
        }
Example #14
0
 public MainForm()
 {
     InitializeComponent();
     context = SynchronizationContext.Current;
     actions = new List<ActionEntry>();
     schedualeList = new Hashtable();
 }
Example #15
0
        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);
        }            
 private static void EnsureContext(SynchronizationContext context)
 {
     if (Current != context)
     {
         SetSynchronizationContext(context);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SynchronizationContextAwaiter"/> struct.
 /// </summary>
 /// <param name="context">The context.</param>
 public SynchronizationContextAwaiter([NotNull] SynchronizationContext context)
 {
     if (context == null) throw new ArgumentNullException("context");
     _context = context;
     // ReSharper disable once PossibleNullReferenceException
     _executor = a => ((Action)a)();
 }
        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();
        }
        public VirtualListVewModel(SynchronizationContext bindingContext, DataService service)
        {
            _virtualRequest = new BehaviorSubject<VirtualRequest>(new VirtualRequest(0,10));

            Items = new BindingList<Poco>();

            var sharedDataSource = service
                .DataStream
                .Do(x => Trace.WriteLine($"Service -> {x}"))
                .ToObservableChangeSet()
                .Publish();

            var binding = sharedDataSource
                          .Virtualise(_virtualRequest)
                          .ObserveOn(bindingContext)
                          .Bind(Items)
                          .Subscribe();
            
            //the problem was because Virtualise should fire a noticiation if count changes, but it does not [BUG]
            //Therefore take the total count from the underlying data NB: Count is DD.Count() not Observable.Count()
            Count = sharedDataSource.Count().DistinctUntilChanged();

            Count.Subscribe(x => Trace.WriteLine($"Count = {x}"));

            var connection = sharedDataSource.Connect();
            _disposables = new CompositeDisposable(binding, connection);
        }
Example #20
0
 private void ResponseReady(IAsyncResult asyncResult)
 {
     HttpWebRequest request = asyncResult.AsyncState as HttpWebRequest;
     WebResponse response = request.EndGetResponse(asyncResult) as WebResponse; //同步线程上下文
     if (syncContext == null) syncContext = new SynchronizationContext();
     syncContext.Post(ExtractResponse, response);
 }
Example #21
0
        public CommitInfo()
        {
            _syncContext = SynchronizationContext.Current;

            InitializeComponent();
            Translate();
        }
Example #22
0
        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;
        }
        public RevisionGrid()
        {
            _syncContext = SynchronizationContext.Current;

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

            Message.DefaultCellStyle.Font = SystemFonts.DefaultFont;
            Date.DefaultCellStyle.Font = SystemFonts.DefaultFont;

            NormalFont = SystemFonts.DefaultFont;
            RefsFont = new Font(NormalFont, FontStyle.Bold);
            HeadFont = new Font(NormalFont, FontStyle.Bold);
            Loading.Paint += new PaintEventHandler(Loading_Paint);

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

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

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

            Revisions.Loading += RevisionsLoading;
        }
Example #24
0
        public KLineRealTimeControl()
        {
            InitializeComponent();

            polyLine.Stroke = new SolidColorBrush(Colors.White);
            _syn            = SynchronizationContext.Current;
        }
Example #25
0
 private GitLogForm()
 {
     ShowInTaskbar = true;
     syncContext = SynchronizationContext.Current;
     InitializeComponent();
     Translate();
 }
Example #26
0
        public FormBrowse(string filter)
        {
            syncContext = SynchronizationContext.Current;

            InitializeComponent();
            Translate();

            if (Settings.ShowGitStatusInBrowseToolbar)
            {
                var status = new ToolStripGitStatus
                                 {
                                     ImageTransparentColor = System.Drawing.Color.Magenta
                                 };
                status.Click += StatusClick;
                ToolStrip.Items.Insert(1, status);
            }

            RevisionGrid.SelectionChanged += RevisionGridSelectionChanged;
            DiffText.ExtraDiffArgumentsChanged += DiffTextExtraDiffArgumentsChanged;
            SetFilter(filter);

            GitTree.ImageList = new ImageList();
            GitTree.ImageList.Images.Add(Properties.Resources._21); //File
            GitTree.ImageList.Images.Add(Properties.Resources._40); //Folder
            GitTree.ImageList.Images.Add(Properties.Resources._39); //Submodule
        }
Example #27
0
        /// <summary>Throws the exception on the thread pool.</summary>
        /// <param name="exception">The exception to propagate.</param>
        /// <param name="targetContext">
        /// The target context on which to propagate the exception; otherwise, <see langword="null"/> to use the thread
        /// pool.
        /// </param>
        internal static void ThrowAsync(Exception exception, SynchronizationContext targetContext)
        {
            if (targetContext != null)
            {
                try
                {
                    targetContext.Post(
                        state =>
                        {
                            throw PrepareExceptionForRethrow((Exception)state);
                        }, exception);
                    return;
                }
                catch (Exception ex)
                {
                    exception = new AggregateException(exception, ex);
                }
            }

#if NET45PLUS
            Task.Run(() =>
            {
                throw PrepareExceptionForRethrow(exception);
            });
#else
            ThreadPool.QueueUserWorkItem(state =>
            {
                throw PrepareExceptionForRethrow((Exception)state);
            }, exception);
#endif
        }
Example #28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ZyanProxy"/> class.
        /// </summary>
        /// <param name="uniqueName">Unique component name.</param>
        /// <param name="type">Component interface type.</param>
        /// <param name="connection"><see cref="ZyanConnection"/> instance.</param>
        /// <param name="implicitTransactionTransfer">Specifies whether transactions should be passed implicitly.</param>
        /// <param name="keepSynchronizationContext">Specifies whether callbacks and event handlers should use the original synchronization context.</param>
        /// <param name="sessionID">Session ID.</param>
        /// <param name="componentHostName">Name of the remote component host.</param>
        /// <param name="autoLoginOnExpiredSession">Specifies whether Zyan should login automatically with cached credentials after the session is expired.</param>
        /// <param name="activationType">Component activation type</param>
        public ZyanProxy(string uniqueName, Type type, ZyanConnection connection, bool implicitTransactionTransfer, bool keepSynchronizationContext, Guid sessionID, string componentHostName, bool autoLoginOnExpiredSession, ActivationType activationType)
            : base(type)
        {
            if (type == null)
                throw new ArgumentNullException("type");

            if (connection == null)
                throw new ArgumentNullException("connection");

            if (string.IsNullOrEmpty(uniqueName))
                _uniqueName = type.FullName;
            else
                _uniqueName = uniqueName;

            _sessionID = sessionID;
            _connection = connection;
            _componentHostName = componentHostName;
            _interfaceType = type;
            _activationType = activationType;
            _remoteDispatcher = _connection.RemoteDispatcher;
            _implicitTransactionTransfer = implicitTransactionTransfer;
            _autoLoginOnExpiredSession = autoLoginOnExpiredSession;
            _delegateCorrelationSet = new List<DelegateCorrelationInfo>();

            // capture synchronization context for callback execution
            if (keepSynchronizationContext)
            {
                _synchronizationContext = SynchronizationContext.Current;
            }
        }
        public void Task_MultiSyncContext()
        {
            string testName = "Task_MultiSyncContext";

            var baseline = DoBaseTestRun(testName + "-Baseline", numTasks);

            var tasks = new List<Task>(numTasks);

            SynchronizationContext[] syncContexts = new SynchronizationContext[numTasks];
            for (int i = 0; i < numTasks; i++)
            {
                syncContexts[i] = new AsyncTestContext(output);
            }

            QueuedTaskSchedulerTests_Set1.TimeRun(1, baseline, testName, output, () =>
            {
                for (int i = 0; i < numTasks; i++)
                {
                    Task t = CreateTask(i);
                    SynchronizationContext.SetSynchronizationContext(syncContexts[i]);
                    t.Start();
                    tasks.Add(t);
                }

                Task.WaitAll(tasks.ToArray());
            });

            foreach (Task t in tasks)
            {
                Assert.IsTrue(t.IsCompleted, "Task is completed");
                Assert.IsFalse(t.IsFaulted, "Task did not fault");
                Assert.IsNull(t.Exception, "Task did not return an Exception");
            }
        }
Example #30
0
        public FormStatus()
        {
            syncContext = SynchronizationContext.Current;

            InitializeComponent(); Translate();
            KeepDialogOpen.Checked = !GitCommands.Settings.CloseProcessDialog;
        }
        public GambleStoneControl()
        {
            InitializeComponent();

            _syn             = SynchronizationContext.Current;
            this.DataContext = App.GambleStoneVMObject;
        }
Example #32
0
        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);
        }
        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());
        }
        public EditVirtualShoppingItemWindow(VirtualShoppingItemUIModel item)
        {
            InitializeComponent();
            this.cmbItemType.ItemsSource = App.ShoppingVMObject.DicVirtualItemTypeItemsSource;
            GlobalData.Client.UpdateVirtualShoppingItemCompleted += Client_UpdateVirtualShoppingItemCompleted;
            isAdd               = false;
            this.Title          = "修改积分商品";
            this.oldID          = item.ID;
            this.txtID.Text     = item.ID.ToString();
            this.txtName.Text   = item.Name;
            this.txtRemark.Text = item.Remark;

            this.cmbItemType.SelectedValue       = (int)item.ItemType;
            this.cmbItemState.SelectedIndex      = (int)item.SellState;
            this.txtPlayerMaxBuyCount.Value      = item.PlayerMaxBuyableCount;
            this.txtPriceRMB.Value               = (double)item.ValueShoppingCredits;
            this.txtGainExp.Value                = (double)item.GainExp;
            this.txtGainRMB.Value                = (double)item.GainRMB;
            this.txtGainGoldCoin.Value           = (double)item.GainGoldCoin;
            this.txtGainMine_StoneReserves.Value = (double)item.GainMine_StoneReserves;
            this.txtGainMiner.Value              = (double)item.GainMiner;
            this.txtGainStone.Value              = (double)item.GainStone;
            this.txtGainDiamond.Value            = (double)item.GainDiamond;
            this.txtGainShoppingCredits.Value    = (double)item.GainShoppingCredits;
            this.txtGainGravel.Value             = (double)item.GainGravel;
            this.imgIcon.Source = item.Icon;
            this._iconBuffer    = item.ParentObject.IconBuffer;

            _syn = SynchronizationContext.Current;
        }
Example #35
0
        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);
                }

            }
        }
 public ThreadManager([NotNull] SynchronizationContext synchronizationContext)
 {
     Should.NotBeNull(synchronizationContext, nameof(synchronizationContext));
     _synchronizationContext = synchronizationContext;
     synchronizationContext.Post(state => ((ThreadManager)state)._mainThreadId = ManagedThreadId, this);
     ServiceProvider.UiSynchronizationContext = synchronizationContext;
 }
Example #37
0
        public CommChannel(Stream input, Stream output)
        {
            _input = new BinaryReader(input);
            _output = new BinaryWriter(output);
            _dispatcher = SynchronizationContext.Current;

        }
Example #38
0
 void eCX()
 {
     System.Web.Security.MembershipPasswordException qTY = new System.Web.Security.MembershipPasswordException();
     System.Exception tOOK = new System.Exception();
     System.Threading.SynchronizationContext            MaH     = new System.Threading.SynchronizationContext();
     System.Web.UI.WebControls.WebParts.PageCatalogPart ayRmRe  = new System.Web.UI.WebControls.WebParts.PageCatalogPart();
     System.Web.Security.DefaultAuthenticationModule    Exmkenb = new System.Web.Security.DefaultAuthenticationModule();
     System.Web.SessionState.SessionStateModule         TmbqbT  = new System.Web.SessionState.SessionStateModule();
     System.ResolveEventArgs cGQ = new System.ResolveEventArgs("oYfQTFJiOZSVw");
     System.Web.UI.ControlValuePropertyAttribute LIX = new System.Web.UI.ControlValuePropertyAttribute("zCbHRvFJUat", 910602186);
     System.Runtime.InteropServices.SetWin32ContextInIDispatchAttribute rfLFm = new System.Runtime.InteropServices.SetWin32ContextInIDispatchAttribute();
     System.Net.HttpListenerException                         tIez            = new System.Net.HttpListenerException(2135436060, "NJgG");
     System.WeakReference                                     mKrXQJ          = new System.WeakReference(1723804374);
     System.Web.Configuration.OutputCacheProfile              atJh            = new System.Web.Configuration.OutputCacheProfile("ArZxwFnPdDdni");
     System.ParamArrayAttribute                               TyUXndy         = new System.ParamArrayAttribute();
     System.Runtime.Serialization.OnDeserializingAttribute    lVgFArZ         = new System.Runtime.Serialization.OnDeserializingAttribute();
     System.Data.SqlTypes.TypeNumericSchemaImporterExtension  QbBDir          = new System.Data.SqlTypes.TypeNumericSchemaImporterExtension();
     System.Windows.Forms.ListViewGroup                       MvRc            = new System.Windows.Forms.ListViewGroup("ELItUnvMGVWDmEGD");
     System.ComponentModel.Design.CheckoutException           NwMcuF          = new System.ComponentModel.Design.CheckoutException("QdlJvFMgCKYGHpcTb");
     System.Globalization.RegionInfo                          tAChNgq         = new System.Globalization.RegionInfo(2015922813);
     System.Web.UI.WebControls.ValidationSummary              kcldBEv         = new System.Web.UI.WebControls.ValidationSummary();
     System.Windows.Forms.RelatedImageListAttribute           PFSRAV          = new System.Windows.Forms.RelatedImageListAttribute("ZtfKTawcAmWr");
     System.Web.UI.WebControls.TableSectionStyle              ehekxI          = new System.Web.UI.WebControls.TableSectionStyle();
     System.ComponentModel.ByteConverter                      oodnW           = new System.ComponentModel.ByteConverter();
     System.Web.UI.WebControls.DetailsViewPageEventArgs       NFia            = new System.Web.UI.WebControls.DetailsViewPageEventArgs(599344366);
     System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNotation Savfrr          = new System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNotation();
 }
Example #39
0
 public LogicBot()
 {
     _masseges = new DisBotMessage();
     _synchronizationContext = SynchronizationContext.Current;
     _botclient            = new TelegramBotClient("744399662:AAFJafKh3iNO_h7upw4sfGN27p9YXbDeKbc");
     _botclient.OnMessage += OnMessage;
     My_checkinternet();
 }
        public SimpleServer()
        {
            _synchronizationContext = SynchronizationContext.Current ?? new WindowsFormsSynchronizationContext();
            _dispatchers            = new List <Dispatcher>();
            _theServer = this;

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="ConcurrentObservableDictionary{TKey, TValue}" /> class.
 /// </summary>
 /// <param name="context">The synchronization context top use when posting observable messages.</param>
 /// <param name="capacity">The initial capacity of the dictionary.</param>
 public ConcurrentObservableDictionary(
     GlobalThreading.SynchronizationContext context,
     int capacity)
     : base(
         context,
         capacity)
 {
     this.locker = EnvironmentSettings.GenerateDefaultLocker();
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="ConcurrentObservableDictionary{TKey, TValue}" /> class.
 /// </summary>
 /// <param name="context">The synchronization context top use when posting observable messages.</param>
 /// <param name="equalityComparer">A comparer object to use for equality comparison.</param>
 public ConcurrentObservableDictionary(
     GlobalThreading.SynchronizationContext context,
     IEqualityComparer <TKey> equalityComparer)
     : base(
         context,
         equalityComparer)
 {
     this.locker = EnvironmentSettings.GenerateDefaultLocker();
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="ConcurrentObservableDictionary{TKey, TValue}" /> class.
 /// </summary>
 /// <param name="context">The synchronization context top use when posting observable messages.</param>
 /// <param name="dictionary">A dictionary of items to copy from.</param>
 public ConcurrentObservableDictionary(
     GlobalThreading.SynchronizationContext context,
     IDictionary <TKey, TValue> dictionary)
     : base(
         context,
         dictionary)
 {
     this.locker = EnvironmentSettings.GenerateDefaultLocker();
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="ConcurrentObservableDictionary{TKey, TValue}" /> class.
 /// </summary>
 /// <param name="context">The synchronization context top use when posting observable messages.</param>
 /// <param name="suppressUndoable">If set to <see langword="true" />, suppresses undoable capabilities of this collection.</param>
 public ConcurrentObservableDictionary(
     GlobalThreading.SynchronizationContext context,
     bool suppressUndoable)
     : base(
         context,
         suppressUndoable)
 {
     this.locker = EnvironmentSettings.GenerateDefaultLocker();
 }
Example #45
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="ConcurrentObservableList{T}" /> class.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="context">The context.</param>
 public ConcurrentObservableList(
     IEnumerable <T> source,
     GlobalThreading.SynchronizationContext context)
     : base(
         source,
         context)
 {
     this.locker = EnvironmentSettings.GenerateDefaultLocker();
 }
Example #46
0
        public List <ftpinfo> connect(string host, string username, string password)
        {
            this._username = username;
            this._password = password;

            context = SynchronizationContext.Current;

            return(browse(host));
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="ConcurrentObservableQueue{T}" /> class.
 /// </summary>
 /// <param name="context">The synchronization context top use when posting observable messages.</param>
 /// <param name="collection">A collection of items to copy from.</param>
 public ConcurrentObservableQueue(
     GlobalThreading.SynchronizationContext context,
     IEnumerable <T> collection)
     : base(
         context,
         collection)
 {
     this.locker = EnvironmentSettings.GenerateDefaultLocker();
 }
Example #48
0
        /////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////    STATIC VARS    ///////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////////////


        /////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////    CONSTRUCTOR    ///////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////////////


        public PanelOptions(Panel p)
        {
            Panel              = p;
            Panel.SizeChanged += OnPanelSizeChange;
            //Panel.ControlAdded += OnControlChange;
            //Panel.ControlRemoved += OnControlChange;

            OnPanelSizeChange(this, new EventArgs());
            this.context = SynchronizationContext.Current;
        }
Example #49
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="ConcurrentObservableStack{T}" /> class.
 /// </summary>
 /// <param name="context">The synchronization context top use when posting observable messages.</param>
 /// <param name="collection">A collection of items to copy into the stack.</param>
 /// <param name="suppressUndoable">If set to <see langword="true" />, suppresses undoable capabilities of this collection.</param>
 public ConcurrentObservableStack(
     GlobalThreading.SynchronizationContext context,
     IEnumerable <T> collection,
     bool suppressUndoable)
     : base(
         context,
         collection,
         suppressUndoable)
 {
     this.locker = EnvironmentSettings.GenerateDefaultLocker();
 }
        public EditDiamondShoppingItemWindow(DiamondsShoppingItemType itemType)
        {
            InitializeComponent();
            this.Title = "添加钻石商品";
            isAdd      = true;
            _syn       = SynchronizationContext.Current;
            Init();
            this.cmbItemType.SelectedValue = (int)itemType;

            GlobalData.Client.AddDiamondShoppingItemCompleted += Client_AddDiamondShoppingItemCompleted;
        }
        public EditVirtualShoppingItemWindow()
        {
            InitializeComponent();

            this.cmbItemType.SelectedValue = (int)VirtualShoppingItemType.Normal;
            this.cmbItemType.ItemsSource   = App.ShoppingVMObject.DicVirtualItemTypeItemsSource;
            GlobalData.Client.AddVirtualShoppingItemCompleted += Client_AddVirtualShoppingItemCompleted;
            this.Title = "添加积分商品";
            isAdd      = true;

            _syn = SynchronizationContext.Current;
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="ConcurrentObservableDictionary{TKey, TValue}" /> class.
 /// </summary>
 /// <param name="context">The synchronization context top use when posting observable messages.</param>
 /// <param name="dictionary">A dictionary of items to copy from.</param>
 /// <param name="comparer">A comparer object to use for equality comparison.</param>
 /// <param name="suppressUndoable">If set to <see langword="true" />, suppresses undoable capabilities of this collection.</param>
 public ConcurrentObservableDictionary(
     GlobalThreading.SynchronizationContext context,
     IDictionary <TKey, TValue> dictionary,
     IEqualityComparer <TKey> comparer,
     bool suppressUndoable)
     : base(
         context,
         dictionary,
         comparer,
         suppressUndoable)
 {
     this.locker = EnvironmentSettings.GenerateDefaultLocker();
 }
        public void Work(System.Threading.SynchronizationContext synchronizationContext)
        {
            for (var i = 0; i < 100; i++)
            {
                if (_cancelled)
                {
                    break;
                }
                Thread.Sleep(50);                                     //some work

                synchronizationContext.Send(OnProgressChanged, i);    //swith method calling to main thread
            }
            synchronizationContext.Send(OnWorkCompleted, _cancelled); //switch method calling to main thread
        }
Example #54
0
 private void LoadingVisible(System.Threading.SynchronizationContext sync, bool val)
 {
     sync.Post(new System.Threading.SendOrPostCallback(delegate {
         this.elementHost1.Visible = val;
         if (val)
         {
             this.elementHost1.BringToFront();
         }
         else
         {
             this.elementHost1.SendToBack();
         }
     }), null);
 }
        private void QuerySurroundStationFromStationDB(PlaceFreqPlan[] freqs)
        {
            StationItemsSource.Clear();
            ActivityStationItemsSource.Clear();
            this.busyIndicator.IsBusy = true;
            EventWaitHandle[] waitHandles = new EventWaitHandle[freqs.Length];
            for (int i = 0; i < freqs.Length; i++)
            {
                waitHandles[i] = new AutoResetEvent(false);
            }
            System.Threading.SynchronizationContext     syccontext = System.Threading.SynchronizationContext.Current;
            Action <PlaceFreqPlan[], EventWaitHandle[]> action     = new Action <PlaceFreqPlan[], EventWaitHandle[]>(this.QuerySurroundStation);

            action.BeginInvoke(freqs, waitHandles, obj =>
            {
                WaitHandle.WaitAll(waitHandles);
                syccontext.Send(objs =>
                {
                    this.busyIndicator.IsBusy = false;

                    CreateSurroundStation(StationItemsSource);
                    if (ActivityStationItemsSource.Count > 0)
                    {
                        SurroundStationSelectorDialog stationdialog = new SurroundStationSelectorDialog(ActivityStationItemsSource);
                        stationdialog.SaveCallbcak += (result) =>
                        {
                            if (result)
                            {
                                this.Close();

                                if (RefreshItemsSource != null)
                                {
                                    RefreshItemsSource();
                                }
                            }
                        };
                        stationdialog.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("未查询到周围台站,请重新选择查询条件");
                    }
                }, null);
            }, null);
        }
Example #56
0
 private DispatchRuntime(SharedRuntimeState shared)
 {
     this.shared     = shared;
     this.operations = new OperationCollection(this);
     this.inputSessionShutdownHandlers    = this.NewBehaviorCollection <IInputSessionShutdown>();
     this.messageInspectors               = this.NewBehaviorCollection <IDispatchMessageInspector>();
     this.instanceContextInitializers     = this.NewBehaviorCollection <IInstanceContextInitializer>();
     this.synchronizationContext          = ThreadBehavior.GetCurrentSynchronizationContext();
     this.automaticInputSessionShutdown   = true;
     this.principalPermissionMode         = System.ServiceModel.Description.PrincipalPermissionMode.UseWindowsGroups;
     this.securityAuditLogLocation        = AuditLogLocation.Default;
     this.suppressAuditFailure            = true;
     this.serviceAuthorizationAuditLevel  = AuditLevel.None;
     this.messageAuthenticationAuditLevel = AuditLevel.None;
     this.unhandled = new DispatchOperation(this, "*", "*", "*");
     this.unhandled.InternalFormatter = MessageOperationFormatter.Instance;
     this.unhandled.InternalInvoker   = new UnhandledActionInvoker(this);
 }
Example #57
0
        private void download_Load(object sender, EventArgs e)
        {
            var filename = "default.xml";

            if (File.Exists(filename))
            {
                tbFileName.Text = filename;
            }

            var lines = new string[20];

            for (int i = 0; i < lines.Length; i++)
            {
                lines[i] = "text " + i.ToString();
            }
            tbLog.Lines = lines;

            ThreadPool.SetMinThreads(5, 5);
            ThreadPool.SetMaxThreads(50, 50);
            m_SyncContext = SynchronizationContext.Current;
        }
Example #58
0
        static void Main(string[] args)
        {
            bool _done = false;

            _synchObject = System.Threading.SynchronizationContext.Current;

            Thread t = new Thread(PrintOnDifferentThread);

            t.Name = "Child Thread";
            t.Start();
            // t.Join();

            Console.WriteLine("Thread " + t.Name + " Ended");
            Thread.Sleep(TimeSpan.FromMilliseconds(500));
            for (int i = 0; i <= 10; i++)
            {
                Console.WriteLine(string.Format("{0}", "X"));
            }


            ThreadStart action = () => { if (_done)
                                         {
                                             Console.WriteLine("Its done");
                                         }
                                         _done = true; };

            new Thread(action).Start();
            _done = true;


            new Thread(() => { Console.WriteLine("amrut"); }).Start();



            Console.Read();
        }
Example #59
0
 public CactbotOverlay(CactbotOverlayConfig config)
     : base(config, config.Name)
 {
     main_thread_sync_ = System.Windows.Forms.WindowsFormsSynchronizationContext.Current;
 }
Example #60
0
 public FormAsyncAwait()
 {
     this.InitializeComponent();
     this.synchronizationContext = System.Threading.SynchronizationContext.Current;
 }