예제 #1
0
    static int Main()
    {
        bool        res   = true;
        T0 <string> t0str = new T0 <string>();

        T1 <char> t1char = new T1 <char>();

        T2 <int> t2int = new T2 <int>();

        if (t2int.Me() != 0)
        {
            res = false;
        }

        T3 <uint> t3uint = new T3 <uint>();

        if (t3uint.Home(0) != 0)
        {
            res = false;
        }

        if (res = true)
        {
            return(0);
        }

        return(1);
    }
예제 #2
0
        private Dictionary <Tuple <T1, T2, T3, T4>, int> CollectKeys4 <T1, T2, T3, T4>()
        {
            Debug.Assert(_keyColumns.Length == 4);

            var column1  = _dataMap[_keyColumns[0]].UnderlyingList;
            var column2  = _dataMap[_keyColumns[1]].UnderlyingList;
            var column3  = _dataMap[_keyColumns[2]].UnderlyingList;
            var column4  = _dataMap[_keyColumns[3]].UnderlyingList;
            var rowCount = _dataMap.MaxRowCount;
            var result   = new Dictionary <Tuple <T1, T2, T3, T4>, int>(rowCount);

            for (var i = 0; i < rowCount; ++i)
            {
                T1 k1 = i >= column1.Count ? TypeTrait <T1> .GetNaN() : (T1)column1[i];

                T2 k2 = i >= column2.Count ? TypeTrait <T2> .GetNaN() : (T2)column2[i];

                T3 k3 = i >= column3.Count ? TypeTrait <T3> .GetNaN() : (T3)column3[i];

                T4 k4 = i >= column4.Count ? TypeTrait <T4> .GetNaN() : (T4)column4[i];

                var key = Tuple.Create(k1, k2, k3, k4);
                try
                {
                    result.Add(key, i);
                }
                catch (ArgumentException ex)
                {
                    throw new ArgumentException($"Duplicate key values: {key}", ex);
                }
            }

            return(result);
        }
예제 #3
0
        public void TestWorkstepSequentialDelegate()
        {
            // defines and executes a basic sequential workflow using inline delegate methods
            var w = new WorkstepBaseSeq <T1, T3>(
                new IWorkstep[] {
                // step 1
                new WorkstepBase <T1, T2>(
                    delegate(T1 input)
                {
                    T2 result;
                    result.b = input.a;
                    return(result);
                }, null),
                // step 2
                new WorkstepBase <T2, T3>(
                    delegate(T2 input)
                {
                    T3 result;
                    result.c = input.b;
                    return(result);
                }, null)
            });

            w.Initialise(_workContext);
            var t1 = new T1 {
                a = 42
            };
            T3 t3 = w.Execute(t1).Result;

            Assert.AreEqual(42, t3.c);
        }
예제 #4
0
        /// <summary>
        /// 后台C#绑定数据
        /// </summary>
        public void binding(Student s)
        {
            //创建一个binding实例
            Binding b1 = new Binding
            {
                //指定绑定值来源
                Path = new PropertyPath(nameof(Student.ID))
            };

            //绑定数据到控件
            T1.SetBinding(TextBlock.TextProperty, b1);

            Binding b2 = new Binding
            {
                Path = new PropertyPath(nameof(Student.StuName))
            };

            T2.SetBinding(TextBlock.TextProperty, b2);

            Binding b3 = new Binding
            {
                Path = new PropertyPath(nameof(Student.Age))
            };

            T3.SetBinding(TextBlock.TextProperty, b3);

            panel.DataContext = s;//绑定到父控件上
        }
예제 #5
0
        public void TwoElementOneCollectionInSequenceTest()
        {
            var particle = new CompositeParticle.Builder(ParticleType.Sequence, 0, 1)
            {
                new ElementParticle(typeof(T1), 0, 1),
                new ElementParticle(typeof(T2), 1, 10),
                new ElementParticle(typeof(T3), 0, 1),
            }.Compile();
            var data = new TestOpenXmlCompositeElement();

            var t1  = new T1();
            var t2a = new T2();
            var t2b = new T2();
            var t3  = new T3();

            Assert.True(particle.Set(data, t3));
            Assert.True(particle.GetCollection <T2>(data).Add(t2a));
            Assert.True(particle.Set(data, t1));
            Assert.True(particle.GetCollection <T2>(data).Add(t2b));

            Assert.Collection(
                data,
                e => Assert.Same(t1, e),
                e => Assert.Same(t2a, e),
                e => Assert.Same(t2b, e),
                e => Assert.Same(t3, e));
        }
예제 #6
0
 public void ConfigureDestinations()
 {
     T1.ConfigureDestination(T2, null);
     T2.ConfigureDestination(T3, T1);
     T3.ConfigureDestination(PP, T2);
     PP.ConfigureDestination(PD, T3);
     PD.ConfigureDestination(null, T3);
 }
예제 #7
0
 public static void init()
 {
     Armor.init();
     Weapon.init();
     Ship.init();
     T3.init();
     T7.init();
 }
예제 #8
0
            public void Invoke(T1 param1, T2 param2, T3 param3)
            {
                Contract.Requires(EmptyCallback != null || ParametrizedCallback != null);
                Contract.Requires(!(EmptyCallback != null && ParametrizedCallback != null));

                EmptyCallback?.Invoke();
                ParametrizedCallback?.Invoke(param1, param2, param3);
            }
예제 #9
0
 void Start()
 {
     N = 1;
     T1.SetActive(true);
     T2.SetActive(false);
     T3.SetActive(false);
     T4.SetActive(false);
 }
예제 #10
0
        static void TestTypeCheckKept_1()
        {
            object[] o = new object[] { new T2() };
            Console.WriteLine(o[0] is T2);

            object t3 = new T3();

            Console.WriteLine(t3 is I1);
        }
예제 #11
0
        public YAMLNode ExportYAML()
        {
            YAMLMappingNode node = new YAMLMappingNode();

            node.Add("t", IsVector3 ? T3.ExportYAML() : T4.ExportYAML());
            node.Add("q", Q.ExportYAML());
            node.Add("s", IsVector3 ? S3.ExportYAML() : S4.ExportYAML());
            return(node);
        }
예제 #12
0
 public T2(T3 t3, T4 t4, Scoped1 scoped1, Scoped3 scoped3, Single1 single1, Single2 single2)
 {
     T3      = t3;
     T4      = t4;
     Scoped1 = scoped1;
     Scoped3 = scoped3;
     Single1 = single1;
     Single2 = single2;
 }
예제 #13
0
 public void Run()
 {
     CliSendWork = SrvSendWork = false;
     CliRecvWork = SrvRecvWork = false;
     T1.Start();
     T2.Start();
     T3.Start();
     T4.Start();
 }
예제 #14
0
        static void Main()
        {
            Interface1 CH1 = new T1();
            Interface2 CH2 = new T2();
            Interface3 CH3 = new T3();
            CH1.Toffee1();
            CH2.Toffee2();
            CH3.Toffee3();

        }
                /// <summary>
                /// delegate method
                /// </summary>
                /// <param name="arg1"></param>
                /// <param name="arg2"></param>
                /// <param name="arg3"></param>
                /// <returns></returns>
                public TResult Func(T1 arg1, T2 arg2, T3 arg3)
                {
                    var newContext = _context?.Clone() ?? _injectionContextCreator.CreateContext(null);

                    newContext.SetExtraData(_arg1Id, arg1);
                    newContext.SetExtraData(_arg2Id, arg2);
                    newContext.SetExtraData(_arg3Id, arg3);

                    return((TResult)_action(_scope, _disposalScope, newContext));
                }
예제 #16
0
        public OpenXmlCompositeElement SetItem()
        {
            var t3 = new T3();

            var data = new TestOpenXmlCompositeElement();

            _particle.Set(data, t3);

            return(data);
        }
예제 #17
0
 public void Invoke(T1 param1, T2 param2, T3 param3)
 {
     if (EmptyCallback != null)
     {
         EmptyCallback.Invoke();
     }
     if (ParametrizedCallback != null)
     {
         ParametrizedCallback.Invoke(param1, param2, param3);
     }
 }
예제 #18
0
        public ActionResult Index(BasePagerModel pager)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToRoute(new { controller = "Login", action = "LogOut" }));
            }
            int uid = PageValidate.FilterParam(User.Identity.Name);

            if (!RoleCheck.CheckHasAuthority(uid, db, "用户管理"))
            {
                return(RedirectToRoute(new { controller = "Error", action = "Index", err = "没有权限。" }));
            }
            if (pager == null)
            {
                pager = new BasePagerModel();
            }
            ViewData["search"] = pager;
            var list = (from user in db.User_Info
                        join uvr in db.User_vs_Role
                        on user.user_id equals uvr.uvr_user_id into T1
                        from t1 in T1.DefaultIfEmpty()
                        join role in db.Dic_Role
                        on t1.uvr_role_id equals role.role_id into T2
                        from t2 in T2.DefaultIfEmpty()
                        join ue in db.User_Extend
                        on user.user_id equals ue.user_id into T3
                        from t3 in T3.DefaultIfEmpty()
                        join dept in db.Dic_Department
                        on t3.user_dept_id equals dept.dept_id into T4
                        from t4 in T4.DefaultIfEmpty()
                        join post in db.Dic_Post
                        on t3.user_post_id equals post.post_id into T5
                        from t5 in T5.DefaultIfEmpty()
                        orderby user.user_id ascending
                        select new UserListModel
            {
                id = user.user_id,
                name = user.user_name,
                roleName = t2.role_name == null?"":t2.role_name,
                stateTxt = user.user_state == 1 ? "正常" : (user.user_state == 2 ? "锁定" : (user.user_state == 0 ? "未启用" : "未知")),
                realName = user.real_name,
                times = user.user_login_times,
                deptName = t4.dept_name == null?"":t4.dept_name,
                postName = t5.post_name == null?"":t5.post_name,
                picture = t3.user_picture == null?"default.jpg":t3.user_picture,
                loginTimes = user.user_login_times
            }).Skip((pager.PageIndex - 1) * pager.PageSize).Take(pager.PageSize).ToList();

            foreach (var item in list)
            {
                item.realName = Common.DEncrypt.AESEncrypt.Decrypt(item.realName);
            }
            return(View(list));
        }
예제 #19
0
        List <TeacherCourse> getTeacherCourse(TeacherSearch model)
        {
            var courses = (from c in db.Course_Infos
                           join a in db.User_Infos
                           on c.c_assistant_id equals a.user_id into T1
                           from t1 in T1.DefaultIfEmpty()
                           join s in db.Dic_Subjects
                           on c.c_sub_id equals s.sub_id
                           join se in db.Course_Seasons
                           on c.c_cs_id equals se.c_season_id
                           join room in db.Sys_ClassRooms
                           on c.c_room equals room.room_id into T2
                           from t2 in T2.DefaultIfEmpty()
                           join school in db.Sys_Schools
                           on t2.room_school_id equals school.sys_school_id into T3
                           from t3 in T3.DefaultIfEmpty()
                           where (c.c_teacher_id == model.id || c.c_assistant_id == model.id) && (se.c_is_used == model.isAll ? se.c_is_used : true)
                           orderby new { se.c_is_used, se.c_season_id, c.c_sub_id }
                           select new TeacherCourse
            {
                name = c.course_name,
                assistantName = t1.user_name,
                subjectName = s.sub_name,
                timeInfo = c.c_time_info == null ? "" : c.c_time_info,
                stunum = db.Student_vs_Courses.Where(x => x.svc_course_id == c.course_id).Count(),
                roomName = t2.room_name == null ? "" : t2.room_name,
                schoolName = t3.sys_school_name == null ? "" : t3.sys_school_name,
                c_is_used = se.c_is_used,
                season = se.c_season_id,
                subject = c.c_sub_id
            }).ToList();

            if (courses.Count() == 0)
            {
                return(null);
            }

            foreach (var course in courses)
            {
                DateTime min = DateTime.Now.AddMinutes(-10);
                DateTime max = DateTime.Now.AddMinutes(120);
                var      cvt = db.Course_vs_Times.Where(x => x.cvt_course_id == course.id && x.cvt_time >= min && x.cvt_time <= max).FirstOrDefault();
                if (cvt != null)
                {
                    course.cvt = cvt.cvt_id;
                }
                else
                {
                    course.cvt = 0;
                }
            }
            return(courses);
        }
예제 #20
0
        public void SequenceInChoice()
        {
            var particle = new CompositeParticle.Builder(ParticleType.Choice, 0, 1)
            {
                new ElementParticle(typeof(T1), 0, 1),
                new CompositeParticle.Builder(ParticleType.Sequence, 0, 1)
                {
                    new ElementParticle(typeof(T2), 0, 1),
                    new ElementParticle(typeof(T3), 0, 1),
                },
                new ElementParticle(typeof(T4), 0, 1),
            }.Compile();
            var data = new TestOpenXmlCompositeElement();

            var t1 = new T1();
            var t2 = new T2();
            var t3 = new T3();
            var t4 = new T4();

            Assert.True(particle.Set(data, t1));
            Assert.Collection(
                data,
                e => Assert.Same(t1, e));

            Assert.True(particle.Set(data, t2));
            Assert.Collection(
                data,
                e => Assert.Same(t2, e));

            Assert.True(particle.Set(data, t3));
            Assert.Collection(
                data,
                e => Assert.Same(t2, e),
                e => Assert.Same(t3, e));

            Assert.True(particle.Set(data, t4));
            Assert.Collection(
                data,
                e => Assert.Same(t4, e));

            Assert.True(particle.Set(data, t3));
            Assert.Equal(new object[] { t3 }, data.ToArray());
            Assert.Collection(
                data,
                e => Assert.Same(t3, e));

            Assert.True(particle.Set(data, t2));
            Assert.Collection(
                data,
                e => Assert.Same(t2, e),
                e => Assert.Same(t3, e));
        }
예제 #21
0
        public void SendMessage(object clientSocket)
        {
            // while (true)
            // {
            Socket  myClientSocket = (Socket)clientSocket;
            Message c = DealMsg7(Encoding.Unicode.GetString(result));

            //MessageBox.Show(c.type);
            if (c.type == "05")
            {
                //Message b = new Message();
                c.msg5_Au_TS5 = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                //this.Dispatcher.Invoke(new Action(() => { TextBox1.AppendText(c.msg2_TS2); }));
                this.Dispatcher.Invoke(new Action(() => { T3.AppendText(c.MMessage5(c)); }));
                DateTime ssmg = DateTime.Parse(c.msg5_Au_TS5).AddSeconds(1);
                this.Dispatcher.Invoke(new Action(() => { T5.AppendText(ssmg.ToString("yyyy/MM/dd HH:mm:ss")); }));
                // this.Dispatcher.Invoke(new Action(() => { TextBox1.AppendText(ssmg.Length.ToString()); }));
                string Cssmg;
                Cssmg = ssMessage(c);
                this.Dispatcher.Invoke(new Action(() => { T4.AppendText(Cssmg); }));
                Byte[] ssmg1 = new byte[1024];
                ssmg1 = Encoding.ASCII.GetBytes(Cssmg);
                //int num1 = myClientSocket.Send(ssmg1);
                myClientSocket.Send(ssmg1, ssmg1.Length, 0);
                // Thread sendThread = new Thread(SendMessage);
                // sendThread.Start(myClientSocket);
                // myClientSocket.Close();
            }
            if (c.type == "09")
            {
                // MessageBox.Show(c.msg1_IDc);
                string ssmg;
                ssmg = ssMessage12(c);
                //MessageBox.Show(ssmg);
                Byte[] ssmg1 = new byte[1024];
                ssmg1 = Encoding.Unicode.GetBytes(ssmg);
                myClientSocket.Send(ssmg1, ssmg1.Length, 0);
                // myClientSocket.Close();
            }
            if (c.type == "07")
            {
                string ssmg;
                ssmg = ssMessage8(c);
                //MessageBox.Show(ssmg);
                Byte[] ssmg1 = new byte[2048];
                ssmg1 = Encoding.Unicode.GetBytes(ssmg);
                myClientSocket.Send(ssmg1, ssmg1.Length, 0);
                //myClientSocket.Close();
            }
            // myClientSocket.Close();
            //}
        }
예제 #22
0
        public void TestWorkstepSequentialOverride()
        {
            // defines and executes a basic sequential workflow using classes
            var w = new SequentialStep();

            w.Initialise(_workContext);
            var t1 = new T1 {
                a = 42
            };
            T3 t3 = w.Execute(t1).Result;

            Assert.AreEqual(42, t3.c);
        }
예제 #23
0
        /// <summary>
        /// This method is used to configure the strategy and is called once before any strategy method is called.
        /// </summary>
        protected override void Initialize()
        {
            t3 = this.T3(14, 3, 0.7);
            Add(t3);

            hma = this.HMARick(55, 50);
            Add(hma);

            Add(VHF(14, 0.35));

            Add(PitColor(Color.Black, 80000, 25, 161500));

            CalculateOnBarClose = true;
        }
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <typeparam name="T3"></typeparam>
        /// <returns></returns>
        public Dictionary <string, List <ITable> > Execute <T1, T2, T3>() where T1 : class, ITable, new() where T2 : class, ITable, new() where T3 : class, ITable, new()
        {
            Dictionary <string, List <ITable> > result = new Dictionary <string, List <ITable> >();

            try
            {
                Connection.Open();
                var           reader = Command.ExecuteReader();
                List <ITable> data   = new List <ITable>();
                while (reader.Read())
                {
                    T1 t = new T1();
                    t.Parse(reader);
                    data.Add(t);
                }
                result.Add(typeof(T1).Name, data);
                if (reader.NextResult())
                {
                    List <ITable> data2 = new List <ITable>();
                    while (reader.Read())
                    {
                        T2 s = new T2();
                        s.Parse(reader);
                        data2.Add(s);
                    }
                    result.Add(typeof(T2).Name, data2);
                }
                if (reader.NextResult())
                {
                    List <ITable> data3 = new List <ITable>();
                    while (reader.Read())
                    {
                        T3 k = new T3();
                        k.Parse(reader);
                        data3.Add(k);
                    }
                    result.Add(typeof(T3).Name, data3);
                }
            }
            finally
            {
                Connection.Close();
            }
            return(result);
        }
예제 #25
0
        public (T1[], T2[], T3[]) ReadArrayUntilFacade <T1, T2, T3>()
        {
            var bytes = ReadUntilFacade();

            var array = new T1[(int)Math.Ceiling(bytes.Length / (float)Marshal.SizeOf(default(T1)))];

            Buffer.BlockCopy(bytes, 0, array, 0, bytes.Length);

            var array2 = new T2[(int)Math.Ceiling(bytes.Length / (float)Marshal.SizeOf(default(T2)))];

            Buffer.BlockCopy(bytes, 0, array2, 0, bytes.Length);

            var array3 = new T3[(int)Math.Ceiling(bytes.Length / (float)Marshal.SizeOf(default(T3)))];

            Buffer.BlockCopy(bytes, 0, array3, 0, bytes.Length);

            return(array, array2, array3);
        }
예제 #26
0
        public override int GetHashCode()
        {
            var hashCode = 2018318558;

            hashCode = hashCode * -1521134295 + T1.GetHashCode();
            hashCode = hashCode * -1521134295 + T2.GetHashCode();
            hashCode = hashCode * -1521134295 + T3.GetHashCode();
            hashCode = hashCode * -1521134295 + T4.GetHashCode();
            hashCode = hashCode * -1521134295 + T5.GetHashCode();
            hashCode = hashCode * -1521134295 + P1.GetHashCode();
            hashCode = hashCode * -1521134295 + P2.GetHashCode();
            hashCode = hashCode * -1521134295 + P3.GetHashCode();
            hashCode = hashCode * -1521134295 + P4.GetHashCode();
            hashCode = hashCode * -1521134295 + P5.GetHashCode();
            hashCode = hashCode * -1521134295 + JunctionIndex.GetHashCode();
            hashCode = hashCode * -1521134295 + NearestJunctionIndex.GetHashCode();
            return(hashCode);
        }
        public override int GetHashCode()
        {
            var hashCode = -1044093539;

            hashCode = hashCode * -1521134295 + T1.GetHashCode();
            hashCode = hashCode * -1521134295 + T2.GetHashCode();
            hashCode = hashCode * -1521134295 + T3.GetHashCode();
            hashCode = hashCode * -1521134295 + T4.GetHashCode();
            hashCode = hashCode * -1521134295 + T5.GetHashCode();
            hashCode = hashCode * -1521134295 + P1.GetHashCode();
            hashCode = hashCode * -1521134295 + P2.GetHashCode();
            hashCode = hashCode * -1521134295 + P3.GetHashCode();
            hashCode = hashCode * -1521134295 + P4.GetHashCode();
            hashCode = hashCode * -1521134295 + P5.GetHashCode();
            hashCode = hashCode * -1521134295 + JunctionIndex.GetHashCode();
            hashCode = hashCode * -1521134295 + NearestJunctionIndex.GetHashCode();
            hashCode = hashCode * -1521134295 + Length.GetHashCode();
            hashCode = hashCode * -1521134295 + Lock.GetHashCode();
            return(hashCode);
        }
예제 #28
0
 private void Clear(object sender, RoutedEventArgs e)
 {
     T1.Clear();
     T2.Clear();
     T3.Clear();
     T4.Clear();
     T5.Clear();
     T6.Clear();
     T7.Clear();
     T8.Clear();
     T9.Clear();
     T10.Clear();
     T11.Clear();
     T12.Clear();
     T13.Clear();
     T14.Clear();
     T15.Clear();
     T16.Clear();
     T17.Clear();
 }
예제 #29
0
 public void Read(EndianStream stream)
 {
     if (IsVector3)
     {
         T3.Read(stream);
     }
     else
     {
         T4.Read(stream);
     }
     Q.Read(stream);
     if (IsVector3)
     {
         S3.Read(stream);
     }
     else
     {
         S4.Read(stream);
     }
 }
        private String Step(T3 s, String inp)
        {
            Char c;

            try
            {
                c = PreStep(ref inp);
            }
            catch (EndOfStringException)
            {
                return("");
            }

            if (DECIMAL.Contains(c))
            {
                return(c.ToString() + Step(new T3(), inp));
            }

            throw new CannotParseException();
        }
예제 #31
0
 static bool Do3(T3 t) {
   Nullable<T3> n = new Nullable<T3>(t);
   return Ensure(n.HasValue && n.Value == t);
 }