コード例 #1
0
ファイル: WorkItem.cs プロジェクト: killbug2004/WSProf
        public void Execute(NotificationDelegate notifyThis)
        {
            if (File.Exists(SuccessLastTimeFileName))
                return; // this one worked last time

            foreach (Task t in m_tasks)
            {
                try
                {
                    t.Execute(this);
                }
                catch (Exception e)
                {
                    Message = e.Message;

                    if (e.Message.Length == 0)
                        Message = e.GetType().Name;

                    notifyThis(this);

                    if (ShouldAbort)
                        return;
                }
            }

            if (FailureMode == FailureMode.None)
            {
                using (File.Open(SuccessLastTimeFileName, FileMode.Create))
                {
                }
            }
        }
コード例 #2
0
 private void onMenuOptionSelect(int i_MenuOptionNumber)
 {
     if (NotificationDelegate != null)
     {
         NotificationDelegate.Invoke(i_MenuOptionNumber);
     }
 }
コード例 #3
0
ファイル: SyncWindow.cs プロジェクト: Pravin044/TwinCat
 public SyncWindow(ISyncMessageReceiver syncMsgReceiver)
 {
     this.syncMsgReceiver = syncMsgReceiver;
     base.CreateControl();
     this.notificationDelegate       = new NotificationDelegate(this.OnSyncNotification);
     this.routerNotificationDelegate = new RouterNotificationDelegate(this.OnSyncRouterNotification);
 }
コード例 #4
0
ファイル: Notifier.cs プロジェクト: viciproject/core
        public ISubscription Subscribe(string name, NotificationDelegate method)
        {
            Subscription subscription = new Subscription(this, name, method);

            _subscriptions.Add(subscription);

            return(subscription);
        }
コード例 #5
0
        public ISubscription <T> Subscribe <T>(string name, NotificationDelegate <T> method)
        {
            var subscription = new Subscription <T>(this, name, method);

            _subscriptions.Add(subscription);

            return(subscription);
        }
コード例 #6
0
ファイル: NotificationController.cs プロジェクト: goulongGG/-
 ///<summary>
 /// 添加注册事件监听,增加特定的委托
 ///</summary>
 ///<param name = "eventKey" >事件名</param>
 ///<param name = "listener" >委托</param>
 public void AddNotificationListener(uint eventKey, NotificationDelegate listener)
 {
     if (!HasEventListener(eventKey))
     {
         NotificationDelegate del = null;  //定义方法
         eventListeners[eventKey] = del;   // 给委托变量赋值
     }
     eventListeners[eventKey] += listener; //注册接收者的监听
 }
コード例 #7
0
        public CocoaWindow(WindowConfiguration config, IUiFactory windowFactory)
        {
            if (windowFactory == null)
            {
                throw new ArgumentNullException(nameof(windowFactory));
            }

            this.config = config ?? throw new ArgumentNullException(nameof(config));

            Interlocked.Increment(ref count);

            // need to keep the delegates around or they will get garbage collected
            windowShouldCloseDelegate = WindowShouldCloseCallback;
            windowWillCloseDelegate   = WindowWillCloseCallback;

            Handle = AppKit.Call("NSWindow", "alloc");

            var style = NSWindowStyleMask.Titled | NSWindowStyleMask.Closable | NSWindowStyleMask.Miniaturizable;

            if (config.CanResize)
            {
                style |= NSWindowStyleMask.Resizable;
            }

            ObjC.SendMessage(
                Handle,
                ObjC.RegisterName("initWithContentRect:styleMask:backing:defer:"),
                new CGRect(0, 0, config.Width, config.Height),
                (int)style,
                2,
                0);

            Title = config.Title;

            IntPtr bgColor = NSColor.FromHex(config.BackgroundColor);

            ObjC.Call(Handle, "setBackgroundColor:", bgColor);

            var contentProvider = new EmbeddedFileProvider(config.ContentAssembly, config.ContentFolder);

            bridge  = new WebviewBridge();
            webview = new CocoaWebview(config, contentProvider, bridge);
            ObjC.Call(Handle, "setContentView:", webview.Handle);

            if (config.EnableScriptInterface)
            {
                bridge.Init(this, webview, windowFactory);
            }

            if (config.UseBrowserTitle)
            {
                webview.TitleChanged += Webview_TitleChanged;
                bridge.TitleChanged  += Webview_TitleChanged;
            }

            SetWindowDelegate(Handle);
        }
コード例 #8
0
 ///<summary>
 ///添加一个监听消息(没有这个消息ID则创建新的,如果有则直接添加)
 ///</summary>
 public void AddListener(uint id, NotificationDelegate listener)
 {
     if (!eventListeners.ContainsKey(id))
     {
         NotificationDelegate noti = null;
         eventListeners[id] = noti;
     }
     eventListeners[id] += listener;
 }
コード例 #9
0
        internal protected void RaiseNotification(NotificationDelegate @delegate, int timeout = 1000)
        {
            if (timeout <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(timeout));
            }

            @delegate(timeout, this.Title, this.Message, (ToolTipIcon)(int)this.Type);
        }
コード例 #10
0
 /// <summary>
 /// 添加监听
 /// </summary>
 /// <param name="_eventKey"></param>
 /// <param name="_listener"></param>
 public void AddEventListener(NotifEventKey _eventKey, NotificationDelegate listener)
 {
     if (!HasEventListener(_eventKey))
     {
         NotificationDelegate del = null;    //定义方法
         m_EventListener[_eventKey] = del;   // 给委托变量赋值
     }
     m_EventListener[_eventKey] += listener; //注册接收者的监听
 }
コード例 #11
0
        public Task <ApiResponse <Unit> > Handle <TSession, TNotification>(
            NotificationDelegate <TSession, TNotification> next,
            NotificationExecutionContext <TSession, TNotification> context)
            where TSession : IHattemSession
            where TNotification : INotification
        {
            NotificationCapturedContextStorage <TSession, TNotification> .CapturedContext.Add(context);

            return(next(context));
        }
コード例 #12
0
            public AchievementsRefreshInfo(IndieCityManager ic, NotificationDelegate refreshCompleteDelegate, Boolean mustRefreshAchievementValues)
            {
                AchievementsUpdated = false;
                UserAchievementsFetched = false;
                RefreshCompleteDelegate = refreshCompleteDelegate;

                ic.AchievementsManager.GetUserAchievementList(ic.Session.UserId);
                if (mustRefreshAchievementValues)
                    ic.AchievementsManager.AchievementGroup.RefreshAchievementValues();
            }    
コード例 #13
0
 public void RemoveObserver(NotificationDelegate notificationDelegate, string notificationName) {
     if (string.IsNullOrEmpty(notificationName)) {
         throw new ArgumentNullException(@"notificationName");
     }
     if (notificationDelegate == null) {
         throw new ArgumentNullException("notificationDelegate");
     }
     if (_Notifications.ContainsKey(notificationName)) {
         _Notifications[notificationName].Remove(notificationDelegate);
     }
 }
コード例 #14
0
        public bool UnregisterAll(NotificationDelegate del)
        {
            bool removed = false;

            foreach (KeyValuePair <string, NotificationDelegateList> e in m_registerMap)
            {
                NotificationDelegateList list = e.Value;
                removed |= list.Remove(del);
            }
            return(removed);
        }
コード例 #15
0
ファイル: EventManager.cs プロジェクト: x739809514/-
    /// <summary>
    /// 添加监听者
    /// </summary>
    public void AddEventListener(uint eventkey, NotificationDelegate listener)
    {
        //添加一个空位
        if (!HasEventListener(eventkey))
        {
            NotificationDelegate del = null;
            eventListeners[eventkey] = del;
        }

        eventListeners[eventkey] += listener;
    }
コード例 #16
0
 public void removeEvent(string name, NotificationDelegate delega)
 {
     if (_table.ContainsKey(name))
     {
         List <NotificationDelegate> list = _table [name];
         if (list != null && list.Contains(delega))
         {
             _table [name].Remove(delega);
         }
     }
 }
コード例 #17
0
        public bool Unregister(string name, NotificationDelegate del)
        {
            NotificationDelegateList list = FindList(name);

            if (list != null)
            {
                return(list.Remove(del));
            }

            return(false);
        }
コード例 #18
0
ファイル: SyncWindow.cs プロジェクト: Pravin044/TwinCat
 public SyncWindow(ISyncMessageReceiver syncMsgReceiver, ISyncNotificationReceiver syncNoteReceiver)
 {
     this.syncMsgReceiver  = syncMsgReceiver;
     this.syncNoteReceiver = syncNoteReceiver;
     base.CreateControl();
     this.notificationDelegate         = new NotificationDelegate(this.OnSyncNotification);
     this.notificationQueueDelegate    = new NotificationQueueDelegate(this.OnSyncQueueNotification);
     this.routerNotificationDelegate   = new RouterNotificationDelegate(this.OnSyncRouterNotification);
     this.stateChangedDelegate         = new StateChangedDelegate(this.OnAdsStateChanged);
     this.symbolVersionChangedDelegate = new SymbolVersionChangedDelegate(this.OnSymbolVersionChanged);
 }
コード例 #19
0
 public void AddEventListener(uint eventKey, NotificationDelegate listener)
 {
     if (!HasEventListener(eventKey))
     {
         eventListeners[eventKey] = listener; //注册接收者的监听
     }
     else
     {
         eventListeners[eventKey] += listener; //注册接收者的监听
     }
 }
コード例 #20
0
ファイル: NotificationController.cs プロジェクト: goulongGG/-
 ///<summary>
 /// 移除注册事件监听,取消特定的委托
 ///</summary>
 ///<param name = "eventKey" >事件名</param>
 ///<param name = "listener" >委托</param>
 public void RemoveEventListener(uint eventKey, NotificationDelegate listener)
 {
     if (!HasEventListener(eventKey))
     {
         return;
     }
     eventListeners[eventKey] -= listener; //析构指定接收者的监听
     if (eventListeners[eventKey] == null)
     {
         RemoveEventListener(eventKey);
     }
 }
コード例 #21
0
 public void AddObserver(NotificationDelegate notificationDelegate, string notificationName) {
     if (string.IsNullOrEmpty(notificationName)) {
         throw new ArgumentNullException(@"notificationDelegate");
     }
     if (notificationDelegate == null) {
         throw new ArgumentNullException("notificationDelegate");
     }
     if(!_Notifications.ContainsKey(notificationName)) {
         _Notifications[notificationName] = new List<NotificationDelegate>();
     }
     _Notifications[notificationName].Add(notificationDelegate);
 }
コード例 #22
0
ファイル: IndieCityManager.cs プロジェクト: Indiefreaks/igf
        public void RequestAchievementDataRefresh(NotificationDelegate refreshCompleteDelegate)
        {
            if (SessionActive)
            {
                if (_achievementsRefreshInfo != null)
                {
                    throw new Exception("Previous achievement refresh request still being processed");
                }

                _achievementsRefreshInfo = new AchievementsRefreshInfo(this, refreshCompleteDelegate, true);
            }
        }
コード例 #23
0
        public AchievementsRefreshInfo(IndieCityManager ic, NotificationDelegate refreshCompleteDelegate, Boolean mustRefreshAchievementValues)
        {
            AchievementsUpdated     = false;
            UserAchievementsFetched = false;
            RefreshCompleteDelegate = refreshCompleteDelegate;

            ic.AchievementsManager.GetUserAchievementList(ic.Session.UserId);
            if (mustRefreshAchievementValues)
            {
                ic.AchievementsManager.AchievementGroup.RefreshAchievementValues();
            }
        }
コード例 #24
0
 ///<summary>
 ///删除一个监听消息
 ///</summary>
 public void RemoveListener(uint id, NotificationDelegate listener)
 {
     if (!eventListeners.ContainsKey(id))
     {
         return;
     }
     eventListeners[id] -= listener;
     if (eventListeners[id] == null)
     {
         eventListeners.Remove(id);
     }
 }
コード例 #25
0
 /// <summary>
 /// 移除监听
 /// </summary>
 /// <param name="_eventKey"></param>
 /// <param name="_listener"></param>
 public void RemoveEventListener(NotifEventKey _eventKey, NotificationDelegate listener)
 {
     if (!HasEventListener(_eventKey))
     {
         return;
     }
     m_EventListener[_eventKey] -= listener;
     if (m_EventListener[_eventKey] == null)
     {
         RemoveEventListener(_eventKey);
     }
 }
コード例 #26
0
    public void addEvent(string name, NotificationDelegate delega)
    {
        if (!_table.ContainsKey(name))
        {
            _table.Add(name, new List <NotificationDelegate> ());
        }
        List <NotificationDelegate> list = _table [name];        // for sure

        if (!list.Contains(delega))
        {
            list.Add(delega);
        }
    }
コード例 #27
0
        /// <summary>
        /// Provides a notification message when a match opportunity is present.
        /// </summary>
        /// <param name="iContainer">The containing object.</param>
        public NegotiationService()
        {
            ManualResetEvent dispatcherCreated = new ManualResetEvent(false);

            // The initialization of this service requires a background thread to access the data model.
            FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(new WaitCallback(InitializeData));

            this.foreground           = Dispatcher.CurrentDispatcher;
            this.backgroundDispatcher = new Dictionary <String, Dispatcher>();

            this.notificationHandler = this.OnNotification;

            this.notificationPopupTable = new Dictionary <Guid, PopupNotification>();
        }
コード例 #28
0
        public void RemoveErrObserver(NotificationDelegate notificationDelegate)
        {
            if (notificationDelegate == null)
            {
                throw new ArgumentNullException(@"Null Notification Delegate");
            }

            var delegatesCollection = (List <NotificationDelegate>)m_Hashtable[ERR];

            if (delegatesCollection != null)
            {
                delegatesCollection.Remove(notificationDelegate);
            }
        }
コード例 #29
0
 public void RemoveObserver(NotificationDelegate notificationDelegate, string notificationName)
 {
     if (string.IsNullOrEmpty(notificationName))
     {
         throw new ArgumentNullException(@"notificationName");
     }
     if (notificationDelegate == null)
     {
         throw new ArgumentNullException("notificationDelegate");
     }
     if (_Notifications.ContainsKey(notificationName))
     {
         _Notifications[notificationName].Remove(notificationDelegate);
     }
 }
コード例 #30
0
        public void Register(String name, NotificationDelegate del)
        {
            Debug.Assert(name != null);
            Debug.Assert(del != null);

            NotificationDelegateList list = FindList(name);

            if (list == null)
            {
                list = new NotificationDelegateList();
                m_registerMap[name] = list;
            }

            list.Add(del);
        }
コード例 #31
0
 public void Register(string name, object target, NotificationDelegate action)
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     if (target == null)
     {
         throw new ArgumentNullException("target");
     }
     if (target == null)
     {
         throw new ArgumentNullException("action");
     }
     AddValue(name, target, action);
 }
コード例 #32
0
 public void AddObserver(NotificationDelegate notificationDelegate, string notificationName)
 {
     if (string.IsNullOrEmpty(notificationName))
     {
         throw new ArgumentNullException(@"notificationDelegate");
     }
     if (notificationDelegate == null)
     {
         throw new ArgumentNullException("notificationDelegate");
     }
     if (!_Notifications.ContainsKey(notificationName))
     {
         _Notifications[notificationName] = new List <NotificationDelegate>();
     }
     _Notifications[notificationName].Add(notificationDelegate);
 }
コード例 #33
0
        public void AddErrObserver(NotificationDelegate notificationDelegate)
        {
            if (notificationDelegate == null)
            {
                throw new ArgumentNullException(@"Null Notification Delegate");
            }

            var delegatesCollection = (List <NotificationDelegate>)m_Hashtable[ERR];

            if (delegatesCollection == null)
            {
                delegatesCollection = new List <NotificationDelegate>();
                m_Hashtable.Add(ERR, delegatesCollection);
            }
            delegatesCollection.Add(notificationDelegate);
        }
        /// <summary>
        /// Removes matching entries from the receiver’s dispatch table.
        /// </summary>
        /// <param name="p_notificationDelegate">Delegate  that specifies the message the receiver sends notificationObserver to notify it of the notification posting</param>
        /// <param name="p_notificationName">The name of the notification for which to register the observer; that is, only notifications with this name are delivered to the observer</param>
        public void RemoveObserver(NotificationDelegate p_notificationDelegate, string p_notificationName)
        {
            if (string.IsNullOrEmpty(p_notificationName))
            {
                throw new ArgumentNullException(@"p_notificationName");
            }
            if (p_notificationDelegate == null)
            {
                throw new ArgumentNullException("p_notificationDelegate");
            }
            var delegatesCollection = (List <NotificationDelegate>)m_hashtable[p_notificationName];

            if (delegatesCollection != null)
            {
                delegatesCollection.Remove(p_notificationDelegate);
            }
        }
コード例 #35
0
ファイル: IndieCityManager.cs プロジェクト: rc183/igf
        public void RequestAchievementDataRefresh(NotificationDelegate refreshCompleteDelegate)
        {
            if (SessionActive)
            {
                if (_achievementsRefreshInfo != null)
                    throw new Exception("Previous achievement refresh request still being processed");

                _achievementsRefreshInfo = new AchievementsRefreshInfo(this, refreshCompleteDelegate, true);
            }
        }
コード例 #36
0
 protected void RegisterNotification(String name, NotificationDelegate del)
 {
     NotificationCenter().Register(name, del);
 }
コード例 #37
0
ファイル: IndieCityManager.cs プロジェクト: rc183/igf
 public void RequestSessionStart(NotificationDelegate startedDelegate)
 {
     _startPhase = SessionStartPhase.RequestSession;
     _startDelegate = startedDelegate;
     Session.RequestStartSession();
 }
コード例 #38
0
ファイル: BaseObject.cs プロジェクト: mswf/game-a-week
 protected void UnregisterNotifications(NotificationDelegate del)
 {
     NotificationCenter.UnregisterNotifications(del);
 }
コード例 #39
0
ファイル: BaseObject.cs プロジェクト: mswf/game-a-week
 protected void UnregisterNotification(string name, NotificationDelegate del)
 {
     NotificationCenter.UnregisterNotification(name, del);
 }