public WindowProgressForm(DelegateFunc newFunc, object args)
        {
            InitializeComponent();

            func = newFunc;
            this.args = args;
        }
Esempio n. 2
0
 public void call()
 {
     A a = new A();
     B b = new B();
     C c = new C();
     DelegateFunc dc = new DelegateFunc(c.funcC);
     a.add(new DelegateFunc(b.funcB)); // 要封装成一个delegate对象,这个对象就包含了对象ref和成员函数指针
     a.add(dc);
     a.Notify();
     System.Console.WriteLine("----------");
     a.remove(dc);
     a.Notify();
 }
Esempio n. 3
0
 public static R Call <T1, R>(this DelegateFunc <T1, R> func, Tuple <T1> t)
 {
     return(func(t.Item1));
 }
Esempio n. 4
0
 public static R Call <T1, T2, T3, T4, T5, T6, R>(this DelegateFunc <T1, T2, T3, T4, T5, T6, R> func, Tuple <T1, T2, T3, T4, T5, T6> t)
 {
     return(func(t.Item1, t.Item2, t.Item3, t.Item4, t.Item5, t.Item6));
 }
Esempio n. 5
0
 public void SetCallback_GameStateOnExit(DelegateFunc func)
 {
     m_kGame.m_OnExitFunc = new DelegateFunc(func);
 }
Esempio n. 6
0
 public static Slinq <U, SelectSlinqContext <U, UC, T, C> > SelectMany(Slinq <T, C> slinq, DelegateFunc <T, Slinq <U, UC> > selector)
 {
     return(new Slinq <U, SelectSlinqContext <U, UC, T, C> >(
                skip,
                remove,
                dispose,
                new SelectSlinqContext <U, UC, T, C>(slinq, selector)));
 }
Esempio n. 7
0
 public void SetDelegateData(DelegateDateFunc s, DelegateFunc e)
 {
     readyData = s; errorData = e;
 }
Esempio n. 8
0
 public void AddPredicateAndAction(DelegateFunc <T1, bool> test, Action <T1> action) =>
 _testsAndActions.Add(new Tuple <DelegateFunc <T1, bool>, Action <T1> >(test, action));
Esempio n. 9
0
                #pragma warning restore 0414

        private GroupJoinContext(Lookup <K, T2> lookup, Slinq <T, C> outer, DelegateFunc <T, K> outerSelector, DelegateFunc <T, Slinq <T2, LinkedContext <T2> >, U> resultSelector, bool release)
        {
            this.needsMove      = false;
            this.lookup         = lookup;
            this.outerSelector  = outerSelector;
            this.resultSelector = resultSelector;
            this.chained        = outer;
            this.release        = release;

            this.bd = BacktrackDetector.Borrow();
        }
Esempio n. 10
0
 public void SetDelegateWait(DelegateFunc fstart, DelegateFunc fstop, DelegateFunc fev)
 {
     m_admin.SetDelegateWait(fstart, fstop, fev);
 }
Esempio n. 11
0
        public MainForm(List <TEC> tec)
        {
            this.tec = tec;
            InitializeComponent();
            oldSelectedIndex = 0;

            lockEvent = new object();

            logPath = System.Environment.CurrentDirectory;
            log     = new Logging(System.Environment.CurrentDirectory + @"\logDB.txt", false, null, null);

            firstStart = true;

            delegateStartWait = new DelegateFunc(StartWait);
            delegateStopWait  = new DelegateFunc(StopWait);

            waitForm                     = new WaitForm();
            delegateStopWaitForm         = new DelegateFunc(waitForm.StopWaitForm);
            delegateEvent                = new DelegateFunc(EventRaised);
            delegateUpdateActiveGui      = new DelegateFunc(UpdateActiveGui);
            delegateHideGraphicsSettings = new DelegateFunc(HideGraphicsSettings);

            adminPanel              = new Admin(tec, stsStrip);
            changeMode              = new ChangeMode(tec);
            passwordForm            = new Password(adminPanel);
            setPasswordForm         = new SetPassword(adminPanel);
            passwordSettingsForm    = new PasswordSettings(adminPanel);
            setPasswordSettingsForm = new SetPasswordSettings(adminPanel);
            graphicsSettingsForm    = new GraphicsSettings(this, delegateUpdateActiveGui, delegateHideGraphicsSettings);
            parametersForm          = new Parameters();

            adminPanel.SetDelegate(delegateStartWait, delegateStopWait, delegateEvent);
            connSettForm = new ConnectionSettingsView(tec, adminPanel);

            tecViews         = new List <TecView>();
            selectedTecViews = new List <TecView>();
            lockValue        = new object();
            waitCounter      = 0;

            prevStateIsAdmin = false;
            prevStateIsPPBR  = false;

            // создаём все tecview
            foreach (TEC t in tec)
            {
                int index_gtp;
                tecView = new TecView(t, -1, adminPanel, stsStrip, graphicsSettingsForm, parametersForm);
                tecView.SetDelegate(delegateStartWait, delegateStopWait, delegateEvent);
                tecViews.Add(tecView);
                if (t.GTP.Count > 1)
                {
                    index_gtp = 0;
                    foreach (GTP g in t.GTP)
                    {
                        tecView = new TecView(t, index_gtp, adminPanel, stsStrip, graphicsSettingsForm, parametersForm);
                        tecView.SetDelegate(delegateStartWait, delegateStopWait, delegateEvent);
                        tecViews.Add(tecView);
                        index_gtp++;
                    }
                }
            }

            //Form1 f = new Form1();
            //f.Show();

            timer.Start();
        }
Esempio n. 12
0
 public static Slinq <U, GroupJoinContext <U, K, T2, T, C> > GroupJoin(Lookup <K, T2> lookup, Slinq <T, C> outer, DelegateFunc <T, K> outerSelector, DelegateFunc <T, Slinq <T2, LinkedContext <T2> >, U> resultSelector, bool release)
 {
     return(new Slinq <U, GroupJoinContext <U, K, T2, T, C> >(
                skip,
                remove,
                dispose,
                new GroupJoinContext <U, K, T2, T, C>(lookup, outer, outerSelector, resultSelector, release)));
 }
Esempio n. 13
0
 public static void Add(DelegateFunc delegateFunc)
 {
     mutex.WaitOne();
     invokeList.Add(delegateFunc);
     mutex.ReleaseMutex();
 }
Esempio n. 14
0
 /// <summary>
 /// If the either isLeft, returns leftFunc applied to the either's value and p; otherwise, returns rightFunc applied to the either's value and p2.
 /// </summary>
 public V Cata <V, P, P2>(DelegateFunc <L, P, V> leftFunc, P p, DelegateFunc <R, P2, V> rightFunc, P2 p2)
 {
     return(isLeft ? leftFunc(leftValue, p) : rightFunc(rightValue, p2));
 }
Esempio n. 15
0
 /// <summary>
 /// If the either isLeft, returns leftFunc applied to the either's value; otherwise, returns rightFunc applied to the either's value.
 /// </summary>
 public V Cata <V>(DelegateFunc <L, V> leftFunc, DelegateFunc <R, V> rightFunc)
 {
     return(isLeft ? leftFunc(leftValue) : rightFunc(rightValue));
 }
Esempio n. 16
0
 public ValueOrErrorMatchFunctionSelector(DelegateFunc <T, TResult> defaultFunction, bool isError)
 {
     _defaultFunction    = defaultFunction;
     _predicatesAndFuncs = new List <Tuple <DelegateFunc <T, bool>, DelegateFunc <T, TResult> > >();
     _isError            = isError;
 }
Esempio n. 17
0
 public ObjectPool(DelegateFunc <T> action, DelegateAction <T> release)
 {
     getAction     = action;
     releaseAction = release;
 }
Esempio n. 18
0
 public virtual void SetDelegateWait(DelegateFunc dStart, DelegateFunc dStop, DelegateFunc dStatus)
 {
     this.delegateStartWait   = dStart;
     this.delegateStopWait    = dStop;
     this.delegateEventUpdate = dStatus;
 }
Esempio n. 19
0
 public ResultOptionMatcherAfterElse <T, TResult> Else(DelegateFunc <Option <T>, TResult> elseResult) =>
 new ResultOptionMatcherAfterElse <T, TResult>(_funcSelector, elseResult, _item);
Esempio n. 20
0
        //private void stopDbInterfaces()
        //{
        //    if (!(m_list_tec == null))
        //        foreach (TEC t in m_list_tec)
        //            for (int i = (int)CONN_SETT_TYPE.ADMIN; i < (int)CONN_SETT_TYPE.COUNT_CONN_SETT_TYPE; i++)
        //            {
        //                if ((m_dictIdListeners.ContainsKey (t.m_id) == true) && (!(m_dictIdListeners[t.m_id][i] < 0)))
        //                {
        //                    DbSources.Sources().UnRegister(m_dictIdListeners[t.m_id][i]);
        //                    m_dictIdListeners[t.m_id][i] = -1;
        //                }
        //                else
        //                    ;
        //            }
        //    else
        //        //Вообще нельзя что-либо инициализировать
        //        Logging.Logg().Error(@"HAdmin::stopDbInterfaces () - m_list_tec == null ...");
        //}

        //public void RefreshConnectionSettings()
        //{
        //    if (threadIsWorking > 0)
        //    {
        //        foreach (TEC t in m_list_tec) {
        //            for (int i = (int)CONN_SETT_TYPE.ADMIN; i < (int)CONN_SETT_TYPE.COUNT_CONN_SETT_TYPE; i++)
        //            {
        //                if (!(m_dictIdListeners [t.m_id][i] < 0))
        //                    DbSources.Sources().SetConnectionSettings(m_dictIdListeners[t.m_id][i], t.connSetts[i], true);
        //                else
        //                    ;
        //            }
        //        }
        //    }
        //    else
        //        ;
        //}

        public void SetDelegateSaveComplete(DelegateFunc f)
        {
            saveComplete = f;

            //Logging.Logg().Debug(@"HAdmin::SetDelegateSaveComplete () - saveComplete is set=" + (saveComplete == null ? false.ToString() : true.ToString()) + @" - вЫход", Logging.INDEX_MESSAGE.NOT_SET);
        }
Esempio n. 21
0
 public DFunc(DelegateFunc func)
 {
     this.func = func;
 }
Esempio n. 22
0
 public void SetDelegateWait(DelegateFunc start, DelegateFunc stop, DelegateFunc ev)
 {
     delegateStartWait = start;
     delegateStopWait  = stop;
 }
 public MatchFunctionSelector(DelegateFunc <T1, TResult> defaultFunction)
 {
     _defaultFunction = defaultFunction;
 }
Esempio n. 24
0
 public virtual void Initialize(DelegateFunc onEnterfunc)
 {
     m_OnEnterFunc = new DelegateFunc(onEnterfunc);
 }
 public void AddPredicateAndAction(DelegateFunc <T1, bool> test, DelegateFunc <T1, TResult> action) =>
 _predicatesAndFuncs.Add(new Tuple <DelegateFunc <T1, bool>, DelegateFunc <T1, TResult> >(test, action));
Esempio n. 26
0
 public void Initialize(DelegateFunc kReady, DelegateFunc kWave, DelegateFunc kGame)
 {
     m_kReady.Initialize(kReady);
     m_kWave.Initialize(kWave);
     m_kGame.Initialize(kGame);
 }
Esempio n. 27
0
 public ResultOptionMatcher <T, TResult> Do(DelegateFunc <T, TResult> func) => Return(func);
Esempio n. 28
0
        static void Main(string[] args)
        {
            DelegateFunc delegateFunc = Add; // delegateFunc(Add)

            Console.WriteLine("delegateFunc: " + delegateFunc(10));
        }
Esempio n. 29
0
 public ToolTreeItem(string path, string name, DelegateFunc fn)
 {
     displayPath = path;
     displayName = name;
     func = fn;
 }
Esempio n. 30
0
 public static R Call <T1, T2, T3, R>(this DelegateFunc <T1, T2, T3, R> func, Tuple <T1, T2, T3> t)
 {
     return(func(t.Item1, t.Item2, t.Item3));
 }
Esempio n. 31
0
 public void remove(DelegateFunc d)
 {
     delegateHandler -= d;
 }
Esempio n. 32
0
 /// <summary>
 /// Creates a new pool with the specified creation, reset, and initialization delegates.
 /// </summary>
 public PoolWithInitializer(DelegateFunc <T> create, DelegateAction <T> reset, DelegateAction <T, U> initialize) : base(create, reset)
 {
     this.initialize = initialize;
 }
Esempio n. 33
0
        public override void SetDelegateWait(DelegateFunc fstart, DelegateFunc fstop, DelegateFunc fev)
        {
            base.SetDelegateWait(fstart, fstop, fev);

            m_admin.SetDelegateWait(fstart, fstop, fev);
        }
Esempio n. 34
0
 public void add(DelegateFunc d)
 {
     delegateHandler += d;
 }
Esempio n. 35
0
 /// <summary>
 /// 暴露给上层,设置接收到数据包后的回调函数
 /// </summary>
 /// <param name="func"></param>
 public static void SetCallBackFunc(DelegateFunc func)
 {
     delegataFunc = func;
 }
Esempio n. 36
0
 public void OnAddListner(DelegateFunc func)
 {
     OnSelectedFunc = new DelegateFunc(func);
 }
Esempio n. 37
0
 bool SpanFunc(DelegateFunc func, Mail orgMail, MlEnvelope mlEnvelope, MlParamSpan mlParamSpan)
 {
     var max = _maxGet;
     var s = mlParamSpan.Start;
     var e = mlParamSpan.Start + max - 1;
     bool finish = false;
     while (!finish) {
         if (e >= mlParamSpan.End) {
             e = mlParamSpan.End;
             finish = true;
         }
         var mail = func(s, e);
         mail.AddHeader("from", _mlAddr.Admin.ToString());
         mail.AddHeader("to", ReturnTo(orgMail, mlEnvelope));//送信者をそのまま受信者にする
         mail.ConvertHeader("date", Util.LocalTime2Str(DateTime.Now));//日付
         if (!_mlSender.Send(mlEnvelope.Swap().ChangeFrom(_mlAddr.Admin), mail)) {
             return false;
         }
         s = e + 1;
         e = s + max - 1;
     }
     return true;
 }