示例#1
0
        public override void Bind(Bind Options)
        {
            Console.WriteLine ("Bind Account:{0} PIN:{1}",
                Options.Account.Value, Options.PIN.Value);

            TicketBroker TicketBroker = new TicketBroker () ;

            TicketBroker.Bind (Options.Account.Value, Options.PIN.Value);
        }
示例#2
0
文件: Window.cs 项目: cpdean/di
 public Window(Main _controller, Model.Buffer _model)
 {
     Controller = _controller;
     Model = new Bind<Model.Buffer>(_model);
     CurrentMode = new BindList<WindowMode>();
     CurrentMode.Event.Changed += (list) => { CurrentKeyMap = list.FoldLeft(EmptyKeyMap, (a, b) => a + b.KeyMap); };
     CurrentMode.Add(Controller.WindowModes[0]);
     CurrentMode.Add(Controller.WindowModes[2]);
     CurrentMode.Add(Controller.WindowModes[3]);
     Parser = new CommandParser();
 }
示例#3
0
文件: Window.cs 项目: ktvoelker/di
 public Window(Main _controller, Model.Buffer _model)
 {
     Controller = _controller;
     Model = new Bind<Model.Buffer>(_model);
     CurrentMode = new BindSet<WindowMode>();
     CurrentMode.Changed.Add(() =>
     {
         CurrentKeyMap = CurrentMode.ToList().FoldLeft(EmptyKeyMap, (a, b) => a + b.KeyMap);
     });
     DefaultMode.ForEach(CurrentMode.Add);
     Parser = new CommandParser();
 }
示例#4
0
        public void Second_Func_ThreeArgs()
        {
            Func <TimeSpan, uint, double, string> functionToBind =
                (duration, number, ratio) => duration.ToString() + number.ToString() + ratio.ToString();

            uint bindingValue = 0xdeadbeef;
            Func <TimeSpan, double, string> boundFunction = Bind.Second(functionToBind, bindingValue);

            for (uint i = 0; i < 20; ++i)
            {
                TimeSpan functionArg_1 = TimeSpan.FromSeconds(i);
                double   functionArg_2 = 2.5 * i;
                Assert.That(boundFunction(functionArg_1, functionArg_2),
                            Is.EqualTo(functionArg_1.ToString() + bindingValue.ToString() + functionArg_2.ToString()));
            }
        }
示例#5
0
        private void LL()
        {
            // 账户余额
            DataTable dt = User_InfoL.GetUserCanMoney(LoginInfo.UserID);

            if (dt.Rows.Count > 0)
            {
                pageUserCanMoney = dt.Rows[0]["UserCanMoney"].ToString();
            }


            Paging pg = Log_SetUserMoneyL.List(LoginInfo.UserID, 10);

            Bind.BGRepeater(pg.GetRead(), this.rpList);
            this.ucPS1.f = pg;
        }
示例#6
0
        public void First_Action_OneArg()
        {
            StringBuilder builder        = new StringBuilder();
            Action <uint> functionToBind = number => builder.Append(number);

            uint   bindingValue  = 0xdeadbeef;
            Action boundFunction = Bind.First(functionToBind, bindingValue);

            for (uint i = 0; i < 20; ++i)
            {
                boundFunction();

                Assert.That(builder.ToString(), Is.EqualTo(bindingValue.ToString()));
                builder.Length = 0;
            }
        }
示例#7
0
        public Chart1Form()
        {
            InitializeComponent();

            dtSample = new DataTable("Test");
            dtSample.Columns.Add("X", typeof(Int32));
            dtSample.Columns.Add("12.3", typeof(Double));
            dtSample.Columns.Add("Test", typeof(Int32));

            dtSample.Rows.Add(19, -0.1, 22);
            dtSample.Rows.Add(12, 21.5, 0);
            dtSample.Rows.Add(0, 31.5, 25);
            dtSample.Rows.Add(10, 20, -15);

            dgv.DataSource = dtSample;

            //Events
            lblValue.Text                   = lblItem.Text = "";
            bar1.MouseLeaveAxisArea        += new System.EventHandler(axisComponent_MouseLeaveAxisArea);
            bar1.MouseLocationValueChange  += new AxileBase.MouseLocationValueEventHandler(axisComponent_MouseLocationValueChange);
            bar1.MouseEnterBar             += new Bar.MouseAndItemEventHandler(component_MouseEnterItem);
            bar1.MouseLeaveBar             += new Bar.MouseAndItemEventHandler(component_MouseLeaveItem);
            line1.MouseLeaveAxisArea       += new System.EventHandler(axisComponent_MouseLeaveAxisArea);
            line1.MouseLocationValueChange += new AxileBase.MouseLocationValueEventHandler(axisComponent_MouseLocationValueChange);
            line1.MouseEnterPoint          += new Line.MouseAndItemEventHandler(component_MouseEnterItem);
            line1.MouseLeavePoint          += new Line.MouseAndItemEventHandler(component_MouseLeaveItem);


            chart1.DataMember = Bind.FromDataTable(dtSample);

            chart1.LegendItems.Clear();
            chart1.LegendItems.Add(new SingleLineText("Legend"));
            SingleLineText slt = new SingleLineText();

            slt.Add("E=X_1!Y^2!Z", '!', '_', '^');
            chart1.LegendItems.Add(slt);
            chart1.LegendItems.Add(new SingleLineText("123"));
            slt = new SingleLineText();
            slt.Add("فارسی", SingleLineText.TextFromBaseLine.Normal, true);
            chart1.LegendItems.Add(slt);

            list = new List <BaseChartComponent>();
            list.Add(bar1);
            list.Add(line1);

            lblNearset.Text = "";
        }
示例#8
0
        public void ShouldSubscribeToNewLinkInPath()
        {
            var source = new Source {
                InnerSource = new Source()
            };
            var target = new Target();

            Bind.Property(() => source.InnerSource.SourceName)
            .To(() => target.TargetName);

            source.InnerSource = new Source {
                SourceName = "not this"
            };
            source.InnerSource.SourceName = "changed";

            Assert.AreEqual("changed", target.TargetName);
        }
示例#9
0
        public void First_Func_FourArgs()
        {
            Func <uint, TimeSpan, double, DayOfWeek, string> functionToBind =
                (number, duration, ratio, day) => number.ToString() + duration.ToString() + ratio.ToString() + day.ToString();

            uint bindingValue = 0xdeadbeef;
            Func <TimeSpan, double, DayOfWeek, string> boundFunction = Bind.First(functionToBind, bindingValue);

            for (uint i = 0; i < 20; ++i)
            {
                TimeSpan  functionArg_1 = TimeSpan.FromSeconds(i);
                double    functionArg_2 = 2.5 * i;
                DayOfWeek functionArg_3 = DayOfWeek.Thursday;
                Assert.That(boundFunction(functionArg_1, functionArg_2, functionArg_3),
                            Is.EqualTo(bindingValue.ToString() + functionArg_1.ToString() + functionArg_2.ToString() + functionArg_3.ToString()));
            }
        }
        public ServiceCollectionBusConfigurator(IServiceCollection collection)
            : base(collection, new DependencyInjectionContainerRegistrar <TBus>(collection))
        {
            IBusRegistrationContext CreateRegistrationContext(IServiceProvider serviceProvider)
            {
                var provider = serviceProvider.GetRequiredService <IConfigurationServiceProvider>();

                return(new BusRegistrationContext(provider, Endpoints, Consumers, Sagas, ExecuteActivities, Activities, Futures));
            }

            collection.AddScoped(provider => Bind <TBus> .Create(GetSendEndpointProvider(provider)));
            collection.AddScoped(provider => Bind <TBus> .Create(GetPublishEndpoint(provider)));
            collection.AddSingleton(provider =>
                                    Bind <TBus> .Create(ClientFactoryProvider(provider.GetRequiredService <IConfigurationServiceProvider>(), provider.GetRequiredService <TBus>())));

            collection.AddSingleton(provider => Bind <TBus> .Create(CreateRegistrationContext(provider)));
        }
        public virtual void SetBusFactory <T>(T busFactory)
            where T : IRegistrationBusFactory
        {
            if (busFactory == null)
            {
                throw new ArgumentNullException(nameof(busFactory));
            }

            ThrowIfAlreadyConfigured(nameof(SetBusFactory));

            Collection.AddSingleton(provider => Bind <IBus> .Create(CreateBus(busFactory, provider)));

            Collection.AddSingleton(provider => provider.GetRequiredService <Bind <IBus, IBusInstance> >().Value);
            Collection.AddSingleton <IReceiveEndpointConnector>(provider => provider.GetRequiredService <Bind <IBus, IBusInstance> >().Value);
            Collection.AddSingleton(provider => provider.GetRequiredService <Bind <IBus, IBusInstance> >().Value.BusControl);
            Collection.AddSingleton(provider => provider.GetRequiredService <Bind <IBus, IBusInstance> >().Value.Bus);
        }
示例#12
0
        protected override void OnUpdateFrame(FrameEventArgs args)
        {
            if (_server != null)
            {
                _renderer.MainCamera.Position    = LocalPlayer.Position;
                _renderer.MainCamera.AspectRatio = Size.X / (float)Size.Y;
                _renderer.MainCamera.Fov         = 95f;

                if (Bind.GetBindKeyDown("forward"))
                {
                    LocalPlayer.Position += _renderer.MainCamera.Front;
                }

                if (Bind.GetBindKeyDown("backward"))
                {
                    LocalPlayer.Position -= _renderer.MainCamera.Front;
                }

                if (Bind.GetBindKeyDown("left"))
                {
                    LocalPlayer.Position -= _renderer.MainCamera.Right;
                }

                if (Bind.GetBindKeyDown("right"))
                {
                    LocalPlayer.Position += _renderer.MainCamera.Right;
                }

                if (Bind.GetBindKeyDown("jump"))
                {
                    LocalPlayer.Position += Vector3.UnitY;
                }

                var deltaX = MouseState.X - LastPos.X;
                var deltaY = MouseState.Y - LastPos.Y;
                LastPos = new Vector2(MouseState.X, MouseState.Y);

                _renderer.MainCamera.Yaw   += deltaX * 0.15f;
                _renderer.MainCamera.Pitch -= deltaY * 0.15f;
            }

            _server?.Update(args.Time);

            _renderer.Update(args.Time);
            base.OnUpdateFrame(args);
        }
示例#13
0
        private void AssignProperties(Document document, object model)
        {
            Type docType = typeof(Document);
            IEnumerable <System.Reflection.FieldInfo> propinfos = docType.GetFields().Where(prop => Attribute.IsDefined(prop, typeof(Bind)));

            foreach (var info in propinfos)
            {
                Bind bindAttr = (Bind)Attribute.GetCustomAttribute(info, typeof(Bind));
                System.Reflection.FieldInfo modelProp = model.GetType().GetField(bindAttr.ModelProperty);
                object value = modelProp.GetValue(model);

                IBindingRenderer renderer = (IBindingRenderer)Activator.CreateInstance(bindAttr.RendererType);
                string           res      = renderer.Render(value);

                info.SetValue(document, res);
            }
        }
示例#14
0
 public static bool Create(Bind b, out BindSerialized result)
 {
     result = null;
     if (!(b.First is Block block1 && b.Second is Block block2))
     {
         return(false);
     }
     result = new BindSerialized
     {
         FirstX   = block1.logic.X,
         FirstY   = block1.logic.Y,
         SecondX  = block2.logic.X,
         SecondY  = block2.logic.Y,
         Strength = b.Strength,
     };
     return(true);
 }
示例#15
0
        public void Explode()
        {
            if (CurrentState != State.ALIVE)
            {
                return;
            }

            CurrentState = State.EXPLODING;

            Bind colorCntrl = new Bind(
                delegate { return(mothershipColor); },
                delegate(object value) { mothershipColor = (Color)value; }
                );

            core2d.CoreAnimation.Instance.AnimateColor("mothership color transition", colorCntrl, Color.Transparent, 0.3f);
            SoundPlayer.Instance.StopSound("mothershipSound");
        }
示例#16
0
        public void Second_Action_TwoArgs()
        {
            StringBuilder           builder        = new StringBuilder();
            Action <TimeSpan, uint> functionToBind = (duration, number) => builder.Append(duration).Append(number);
            uint bindingValue = 0xdeadbeef;

            Action <TimeSpan> boundFunction = Bind.Second(functionToBind, bindingValue);

            for (uint i = 0; i < 20; ++i)
            {
                TimeSpan functionArg = TimeSpan.FromSeconds(i);
                boundFunction(functionArg);

                Assert.That(builder.ToString(), Is.EqualTo(functionArg.ToString() + bindingValue.ToString()));
                builder.Length = 0;
            }
        }
示例#17
0
        public ActionResult RobotLogon(Dictionary <string, string> queryvalues)
        {
            int gametype   = queryvalues.ContainsKey("gametype") ? Convert.ToInt32(queryvalues["gametype"]) : -1;
            int openmodule = queryvalues.ContainsKey("openmodule") ? Convert.ToInt32(queryvalues["openmodule"]) : -1;
            int second     = queryvalues.ContainsKey("second") ? Convert.ToInt32(queryvalues["second"]) : 0;
            int num        = queryvalues.ContainsKey("num") ? Convert.ToInt32(queryvalues["num"]) : 0;



            RobotControl robotCon = new RobotControl();

            LoginRequest LoginRequest;

            LoginRequest = LoginRequest.CreateBuilder()
                           .SetGameType((uint)gametype)
                           .SetLoginFrequency((uint)second)
                           .SetLoginCnt(num)
                           .SetStrategy((uint)openmodule)
                           .Build();

            Bind tbind = Cmd.runClientRobot(new Bind(ServiceCmd.SC_ROBOT_LOGIN, LoginRequest.ToByteArray()), 12001);

            switch ((CenterCmd)tbind.header.CommandID)
            {
            case CenterCmd.CS_ROBOT_STATU:

                return(Json(new
                {
                    res = 1,
                    Data = ""
                }));

            case CenterCmd.C2S_ROBOT_ERRMSG:
                ErrorMessage ErrorMessage = ErrorMessage.ParseFrom(tbind.body.ToBytes());
                return(Json(new
                {
                    res = 0,
                    Data = ErrorMessage.ErrorMessage_
                }));
            }
            return(Json(new
            {
                res = 0,
                Data = ""
            }));
        }
示例#18
0
        //评论列表
        private void List()
        {
            //PagingList pl = new PagingList("News_Msg", "MsgSN", new PagingUrlVar(10, pageIndex));

            //pl.SqlSelect = "select N.FK_User,Detail,N.AddDate as AddDate,UserName";
            //pl.SqlFrom = "from News_Msg as N left join User_Info as U on N.FK_User=U.UserSN";
            //pl.SqlWhere = "where Purview=1 and FK_News=" + id;
            //pl.SqlOrder = "order by N.AddDate desc";

            //Paging pg = pl.List(true);

            //Bind.BGRepeater(pg.GetDataTable(), this.rpMsgList);

            //this.ucPS1.f = pg;
            //this.ucPS1.cs = GetURL.News.Msg(id) + "-{0}";

            #region ajax提交
            int cur_pageIndex = Fn.IsInt(Req.GetForm("ajax_page"), 1);

            string sqlSelect, sqlFrom, sqlWhere = string.Empty, sqlOrder, pkName;
            sqlSelect = "select N.FK_User,Detail,N.AddDate as AddDate,UserName";
            sqlFrom   = " from News_Msg as N left join User_Info as U on N.FK_User=U.UserSN";
            sqlWhere  = " where Purview=1 and FK_News=" + id;
            sqlOrder  = " order by N.AddDate desc";

            pkName = "MsgSN";

            PagingVar pv = new PagingVar();
            pv.SQLCount = "select count(0)" + sqlFrom + sqlWhere;
            pv.SQLRead  = "select " + pkName + sqlFrom + sqlWhere + sqlOrder;
            pv.SQL      = sqlSelect + sqlFrom + " where " + pkName + " in({0})" + sqlOrder;


            Paging pg = new Paging(pv, new PagingUrlVar(30, cur_pageIndex));//页记录
            pg.load();

            Bind.BGRepeater(pg.GetDataTable(), this.rpMsgList);

            lNum = pg.um.records_count.ToString();

            this.ucPS1.f  = pg;
            this.ucPS1.cs = "javascript:ajaxPage('ajax_page_msg',{0});";


            #endregion
        }
示例#19
0
 static public int setColor(IntPtr ctx)
 {
     try
     {
         Text textobj = (Text)Bind.RequireThis(ctx);
         int  r       = Native.duk_require_int(ctx, 0);
         int  g       = Native.duk_require_int(ctx, 1);
         int  b       = Native.duk_require_int(ctx, 2);
         int  a       = Native.duk_require_int(ctx, 3);
         textobj.color = new Color(r / 255f, g / 255f, b / 255f, a / 255f);
         return(0);
     }
     catch (Exception e)
     {
         return(Native.duk_throw_error(ctx, e.ToString()));
     }
 }
示例#20
0
                /// <summary>
                /// Unregisters a bind from its key combo if it has one.
                /// </summary>
                private void UnregisterBindFromCombo(Bind bind)
                {
                    for (int n = 0; n < usedControls.Count; n++)
                    {
                        List <IBind> registeredBinds = controlMap[usedControls[n].Index];
                        registeredBinds.Remove(bind);

                        if (registeredBinds.Count == 0)
                        {
                            bindMap.Remove(registeredBinds);
                            usedControls.Remove(usedControls[n]);
                        }
                    }

                    bind.Analog = false;
                    bind.length = 0;
                }
示例#21
0
 private void InitializeListView()
 {
     olvColumn_Address.AspectGetter = delegate(object row)
     {
         Bind bind = row as Bind;
         if (bind.Error != null)
         {
             return(bind.Error.Message);
         }
         else
         {
             return(bind.Address.ToString());
         }
     };
     olvColumn_Description.AspectGetter     = delegate(object row) { return((row as Bind).Description); };
     olvColumn_OriginalAddress.AspectGetter = delegate(object row) { return((row as Bind).OriginalAddress); };
 }
示例#22
0
        private int LL()
        {
            int userID       = LoginInfo.UserID;
            int userLevel    = LoginInfo.UserLevel;
            int userIdentity = LoginInfo.UserIdentity;

            Dictionary <int, DataTable> dic = User_Cart.List(userID, userLevel, userIdentity);
            DataTable dtTotal   = dic[0];
            DataTable dtProList = dic[10];

            this.txtTotalPriceAll.Text = dtTotal.Rows[0][0].ToString();
            this.txtProN.Text          = dtProList.Rows.Count.ToString();

            Bind.BGRepeater(dtProList, this.rpList);

            return(dtProList.Rows.Count);
        }
示例#23
0
 internal static Bind BuildBind(this Geocoding.IGeocoder geocoder, string address)
 {
     if (Geocoding.Location.TryParse(address, out Geocoding.Location location))
         return BuildBind(geocoder, location);
     else
     {
         try
         {
             IEnumerable<Address> addresses = geocoder.Geocode(address);
             return Bind.Create(address, addresses);
         }
         catch (Exception ex)
         {
             return Bind.Create(address, ex);
         }
     }
 }
示例#24
0
        public override void Execute(Tag data = null)
        {
            if (data == null)
            {
                var a = TagRegistry.GetTag <Bind>("bind", Namespaces.Bind);
                var b = TagRegistry.GetTag <Iq>("iq", Namespaces.Client);

                if (UbietySettings.Id.Resource != null)
                {
                    var res = TagRegistry.GetTag <GenericTag>("resource", Namespaces.Bind);
                    res.InnerText = UbietySettings.Id.Resource;
                    a.AddChildTag(res);
                }

                b.IqType  = IqType.Set;
                b.Payload = a;

                ProtocolState.Socket.Write(b);
            }
            else
            {
                var  iq   = data as Iq;
                Bind bind = null;
                if (iq != null)
                {
                    if (iq.IqType == IqType.Error)
                    {
                        var e = iq["error"];
                        if (e != null)
                        {
                            Errors.SendError(this, ErrorType.XMLError, e.InnerText);
                        }
                    }
                    bind = iq.Payload as Bind;
                }
                if (bind != null)
                {
                    UbietySettings.Id = bind.JidTag.JID;
                }
                Logger.InfoFormat(this, "Current XID is now: {0}", UbietySettings.Id);

                ProtocolState.State = new SessionState();
                ProtocolState.State.Execute();
            }
        }
 public void Start(TimelineCode global)
 {
     if (!this._gui.enabled)
     {
         return;
     }
     this._gui.Start(global, this._gui);
     this.seek.Init(_timeline);
     this.seek.insert.Init(_timeline);
     this.seek.insert.action.Init(_timeline);
     this.seek.insert.comment.Init(_timeline);
     this.seek.insert.segment.Init(_timeline);
     this.seek.insert.sound.Init(_timeline);
     this.seek.insert.dialog.Init(_timeline);
     this.seek._slider.proxy = new float[1];
     Bind.OnRevert(this.seek._slider /* this.gui.slider_box*/, this._code.timeframe, OnRevert);
     Bind.OnRuntime(this.seek._slider /* this.gui.slider_box*/, this._code.timeframe, OnRuntime);
 }
示例#26
0
        private void GetCaiPu()
        {
            string sOrder = " order by a.AddDate desc";
            string sWhere = " where a.FK_User="******" and InfoType=" + t;

            PagingVar pv = new PagingVar();

            pv.SQLCount = "select count(0) from User_Fav a" + sWhere;
            pv.SQLRead  = "select FavSN from User_Fav a" + sWhere + sOrder;
            pv.SQL      = "select FavSN,FK_All,FK_User,ProName,PicS,Item,a.AddDate from User_Fav a left join CaiPu_Info b on a.FK_All=b.ProSN where FavSN in({0})" + sOrder;

            Paging pg = new Paging(pv, new PagingUrlVar(10));

            pg.load();

            Bind.BGRepeater(pg.GetRead(), this.rpCaiPu);
            this.ucPS1.f = pg;
        }
示例#27
0
        private void BindResource()
        {
            if (SupportsFeature(XmppStreamFeatures.ResourceBinding))
            {
                var bind = new Bind();
                bind.Resource = UserId.ResourceName;

                var iq = new IQ();
                iq.Type = IQType.Set;
                iq.ID   = XmppIdentifierGenerator.Generate();

                iq.Items.Add(bind);

                Send(iq);

                bindResourceEvent.WaitOne();
            }
        }
示例#28
0
        public GUIRenderer()
        {
            Texture  = new Texture();
            _program = new ShaderProgram("Shaders/GUI.vert", "Shaders/GUI.frag");
            _vao     = new VAO();
            var flatBuffer = new VBO();

            using (Bind.These(_vao, flatBuffer))
            {
                var flatData = new float[] { -1, -1, 0, 1, 1, -1, 1, 1, 1, 1, 1, 0, -1, 1, 0, 0 };
                flatBuffer.Update(flatData, flatData.Length * sizeof(float));
                const int stride = sizeof(float) * 4;
                GL.EnableVertexAttribArray(0);
                GL.VertexAttribPointer(0, 2, VertexAttribPointerType.Float, false, stride, new IntPtr(0));
                GL.EnableVertexAttribArray(1);
                GL.VertexAttribPointer(1, 2, VertexAttribPointerType.Float, false, stride, new IntPtr(sizeof(float) * 2));
            }
        }
示例#29
0
        public void ShouldApplyBindingOnceAfterCreation(BindingMode mode)
        {
            var calls  = 0;
            var source = new Source {
                SourceName = "changed"
            };
            var target = new Target();

            target.PropertyChanged += (sender, e) => calls++;

            Bind.Property(() => source.SourceName)
            .In(mode)
            .To(() => target.TargetName);

            target.PropertyChanged += (sender, e) => { };

            Assert.AreEqual(1, calls);
        }
示例#30
0
        public void ShouldUnsubscribeFromBrokenLinkInPath()
        {
            var source = new Source {
                InnerSource = new Source()
            };
            var brokenLink = source.InnerSource;
            var target     = new Target();

            Bind.Property(() => source.InnerSource.SourceName)
            .To(() => target.TargetName);

            source.InnerSource = new Source {
                SourceName = "changed"
            };
            brokenLink.SourceName = "not this";

            Assert.AreEqual("changed", target.TargetName);
        }
示例#31
0
        //客户调查
        private void Vote()
        {
            if (ShowType == "0")
            {
                ShowType = "checkbox";
            }
            else
            {
                ShowType = "radio";
            }

            string    sql = "select VoteSN,VoteName,Total from Questionnaire_Vote where FK_Questionnaire=" + QuSN + " order by Taxis asc";
            DataTable dt  = DbHelp.GetDataTable(sql);

            Bind.BGRepeater(dt, rpVote, false);

            Bind.BGRepeater(dt, rpVoteN);
        }
示例#32
0
        public void BindNodeToHTTP() {
            string host = "http://localhost:8080/";
            TestServer s = new TestServer(host);
            s.response = "key: value";
            s.Run();

            Bind b = new Bind(host);

            Assert.IsTrue(b.data["key"] == "value", "Bound node did not read from HTTP");

            s.response = "key: updated";

            Thread.Sleep(6000); // Bind is on a 5 sec refresh

            Assert.IsTrue(b.data["key"] == "updated", "Bound node did not update from HTTP");

            s.Stop();
        }
示例#33
0
        private void LL()
        {
            string sSQL = "select UserIntegral from User_Info where UserSN=" + LoginInfo.UserID;

            using (IDataReader dr = DbHelp.Read(sSQL))
            {
                if (dr.Read())
                {
                    pageUserIntegral = dr["UserIntegral"].ToString();
                }
            }


            Paging pg = Log_SetUserIntegralL.List(LoginInfo.UserID, 10);

            Bind.BGRepeater(pg.GetRead(), this.rpList);
            this.ucPS1.f = pg;
        }
示例#34
0
 public DatePicker BorderBrush( Bind<System.Windows.Media.Brush> bind )
 {
     C.BorderBrush = bind.V;
     return this;
 }
示例#35
0
 public DatePicker DisplayDateStart( Bind<DateTime?> bind )
 {
     C.DisplayDateStart = bind.V;
     return this;
 }
示例#36
0
 public new DatePicker DataContext( Bind<System.Object> bind )
 {
     return  base.DataContext( bind ) as DatePicker;
 }
示例#37
0
        void TranslateType(Bind.Structures.Type type,
            XPathNavigator function_override, XPathNavigator overrides,
            EnumProcessor enum_processor, EnumCollection enums,
            string category, string apiname)
        {
            Bind.Structures.Enum @enum;
            string s;

            category = enum_processor.TranslateEnumName(category);

            // Try to find out if it is an enum. If the type exists in the normal GLEnums list, use this.
            // Special case for Boolean which is there simply because C89 does not support bool types.
            // We don't really need that in C#
            bool normal =
                enums.TryGetValue(type.CurrentType, out @enum) ||
                enums.TryGetValue(enum_processor.TranslateEnumName(type.CurrentType), out @enum);

            // Translate enum types
            type.IsEnum = false;
            if (normal && @enum.Name != "GLenum" && @enum.Name != "Boolean")
            {
                type.IsEnum = true;

                if ((Settings.Compatibility & Settings.Legacy.ConstIntEnums) != Settings.Legacy.None)
                {
                    type.QualifiedType = "int";
                }
                else
                {
                    // Some functions and enums have the same names.
                    // Make sure we reference the enums rather than the functions.
                    if (normal)
                    {
                        type.QualifiedType = String.Format("{0}.{1}", Settings.EnumsOutput, @enum.Name);
                    }
                }
            }
            else if (Generator.GLTypes.TryGetValue(type.CurrentType, out s))
            {
                // Check if the parameter is a generic GLenum. If it is, search for a better match,
                // otherwise fallback to Settings.CompleteEnumName (named 'All' by default).
                if (s.Contains("GLenum") /*&& !String.IsNullOrEmpty(category)*/)
                {
                    type.IsEnum = true;

                    if ((Settings.Compatibility & Settings.Legacy.ConstIntEnums) != Settings.Legacy.None)
                    {
                        type.QualifiedType = "int";
                    }
                    else
                    {
                        // Better match: enum.Name == function.Category (e.g. GL_VERSION_1_1 etc)
                        // Note: for backwards compatibility we use "category" only for the gl api.
                        // glcore, gles1 and gles2 use the All enum instead.
                        if (apiname == "gl" && enums.ContainsKey(category))
                        {
                            type.QualifiedType = String.Format("{0}{1}{2}", Settings.EnumsOutput,
                                Settings.NamespaceSeparator, enum_processor.TranslateEnumName(category));
                        }
                        else
                        {
                            type.QualifiedType = String.Format("{0}{1}{2}", Settings.EnumsOutput,
                                Settings.NamespaceSeparator, Settings.CompleteEnumName);
                        }
                    }
                }
                else
                {
                    // Todo: what is the point of this here? It is overwritten below.
                    // A few translations for consistency
                    switch (type.CurrentType.ToLower())
                    {
                        case "string":
                            type.QualifiedType = "String";
                            break;
                    }

                    type.QualifiedType = s;
                }
            }

            type.CurrentType =
                Generator.CSTypes.ContainsKey(type.CurrentType) ?
                Generator.CSTypes[type.CurrentType] : type.CurrentType;

            // Make sure that enum parameters follow enum overrides, i.e.
            // if enum ErrorCodes is overriden to ErrorCode, then parameters
            // of type ErrorCodes should also be overriden to ErrorCode.
            XPathNavigator enum_override = overrides.SelectSingleNode(
                EnumProcessor.GetOverridesPath(apiname, type.CurrentType));
            if (enum_override != null)
            {
                // For consistency - many overrides use string instead of String.
                if (enum_override.Value == "string")
                    type.QualifiedType = "String";
                else if (enum_override.Value == "StringBuilder")
                    type.QualifiedType = "StringBuilder";
                else
                    type.CurrentType = enum_override.Value;
            }

            if (type.CurrentType == "IntPtr" && String.IsNullOrEmpty(type.PreviousType))
                type.Pointer = 0;

            if (type.Pointer >= 3)
            {
                System.Diagnostics.Trace.WriteLine(String.Format(
                    "[Error] Type '{0}' has a high pointer level. Bindings will be incorrect.",
                    type));
            }

            if (!type.IsEnum)
            {
                // Remove qualifier if type is not an enum
                // Resolves issues when replacing / overriding
                // an enum parameter with a non-enum type
                type.QualifiedType = type.CurrentType;
            }
        }
示例#38
0
        private static void Usage()
        {
            Console.WriteLine ("Omnibroker Client");
                Console.WriteLine ("");

                {
                    Resolve		Dummy = new Resolve ();

                    Console.Write ("{0}resolve ", UsageFlag);
                    Console.Write ("[{0}] ", Dummy.Domain.Usage (null, "domain", UsageFlag));
                    Console.Write ("[{0}] ", Dummy.Service.Usage (null, "service", UsageFlag));
                    Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag));
                    Console.WriteLine ();

                }

                {
                    Bind		Dummy = new Bind ();

                    Console.Write ("{0}bind ", UsageFlag);
                    Console.Write ("[{0}] ", Dummy.Account.Usage (null, "account", UsageFlag));
                    Console.Write ("[{0}] ", Dummy.PIN.Usage (null, "pin", UsageFlag));
                    Console.Write ("[{0}] ", Dummy.Server.Usage ("server", "value", UsageFlag));
                    Console.Write ("[{0}] ", Dummy.Port.Usage ("port", "value", UsageFlag));
                    Console.WriteLine ();

                }

                {
                    Unbind		Dummy = new Unbind ();

                    Console.Write ("{0}unbind ", UsageFlag);
                    Console.WriteLine ();

                }
        }
示例#39
0
        public virtual void Bind( Bind Options
				)
        {
            char UsageFlag = '-';
                {
                    Bind		Dummy = new Bind ();

                    Console.Write ("{0}bind ", UsageFlag);
                    Console.Write ("[{0}] ", Dummy.Account.Usage (null, "account", UsageFlag));
                    Console.Write ("[{0}] ", Dummy.PIN.Usage (null, "pin", UsageFlag));
                    Console.Write ("[{0}] ", Dummy.Server.Usage ("server", "value", UsageFlag));
                    Console.Write ("[{0}] ", Dummy.Port.Usage ("port", "value", UsageFlag));
                    Console.WriteLine ();

                }

                Console.WriteLine ("    {0}\t{1} = [{2}]", "String",
                            "Account", Options.Account);
                Console.WriteLine ("    {0}\t{1} = [{2}]", "String",
                            "PIN", Options.PIN);
                Console.WriteLine ("    {0}\t{1} = [{2}]", "String",
                            "Server", Options.Server);
                Console.WriteLine ("    {0}\t{1} = [{2}]", "Integer",
                            "Port", Options.Port);
            Console.WriteLine ("Not Yet Implemented");
        }
示例#40
0
 public Control Width( Bind<double> width )
 {
     C.Width = width.V;
     return this;
 }
示例#41
0
 public Control Height( Bind<double> height )
 {
     C.Height = height.V;
     return this;
 }
示例#42
0
 public Control Background( Bind<System.Windows.Media.Brush> background )
 {
     C.Background = background;
     return this;
 }
示例#43
0
 public Control AllowDrop( Bind<bool> allowDrop )
 {
     C.AllowDrop = allowDrop.V;
     return this;
 }
示例#44
0
 public new AccessText Width( Bind<System.Double> bind )
 {
     return  base.Width( bind ) as AccessText;
 }
示例#45
0
 public new DatePicker Cursor( Bind<System.Windows.Input.Cursor> bind )
 {
     return  base.Cursor( bind ) as DatePicker;
 }
示例#46
0
 public void Write(Bind.Structures.Enum e)
 {
     foreach (string s in splitLines.Split(e.ToString()))
         WriteLine(s.TrimEnd('\r', '\n'));
 }
示例#47
0
 public void Write(Bind.Structures.Function f)
 {
     foreach (string s in splitLines.Split(f.ToString()))
         WriteLine(s);
 }
示例#48
0
 public new DatePicker ContextMenu( Bind<System.Windows.Controls.ContextMenu> bind )
 {
     return  base.ContextMenu( bind ) as DatePicker;
 }
示例#49
0
        private static void Handle_Bind(
					OBPClient Dispatch, string[] args, int index)
        {
            Bind		Options = new Bind ();

            Registry Registry = new Registry ();

            Options.Account.Register ("account", Registry, (int) TagType_Bind.Account);
            Options.PIN.Register ("pin", Registry, (int) TagType_Bind.PIN);
            Options.Server.Register ("server", Registry, (int) TagType_Bind.Server);
            Options.Port.Register ("port", Registry, (int) TagType_Bind.Port);

            // looking for parameter Param.Name}
            if (index < args.Length && !IsFlag (args [index][0] )) {
                // Have got the parameter, call the parameter value method
                Options.Account.Parameter (args [index]);
                index++;
                }
            // looking for parameter Param.Name}
            if (index < args.Length && !IsFlag (args [index][0] )) {
                // Have got the parameter, call the parameter value method
                Options.PIN.Parameter (args [index]);
                index++;
                }

            #pragma warning disable 162
            for (int i = index; i< args.Length; i++) {
                if 	(!IsFlag (args [i][0] )) {
                    throw new Exception ("Unexpected parameter: " + args[i]);}
                string Rest = args [i].Substring (1);

                TagType_Bind TagType = (TagType_Bind) Registry.Find (Rest);

                // here have the cases for what to do with it.

                switch (TagType) {
                    case TagType_Bind.Server : {
                        int OptionParams = Options.Server.Tag (Rest);

                        if (OptionParams>0 && ((i+1) < args.Length)) {
                            if 	(!IsFlag (args [i+1][0] )) {
                                i++;
                                Options.Server.Parameter (args[i]);
                                }
                            }
                        break;
                        }
                    case TagType_Bind.Port : {
                        int OptionParams = Options.Port.Tag (Rest);

                        if (OptionParams>0 && ((i+1) < args.Length)) {
                            if 	(!IsFlag (args [i+1][0] )) {
                                i++;
                                Options.Port.Parameter (args[i]);
                                }
                            }
                        break;
                        }
                    default : throw new Exception ("Internal error");
                    }
                }

            #pragma warning restore 162
            Dispatch.Bind (Options);
        }
示例#50
0
 public new DatePicker ClipToBounds( Bind<System.Boolean> bind )
 {
     return  base.ClipToBounds( bind ) as DatePicker;
 }
示例#51
0
 public new DatePicker AllowDrop( Bind<System.Boolean> bind )
 {
     return  base.AllowDrop( bind ) as DatePicker;
 }
示例#52
0
 public Border Background( Bind<System.Windows.Media.Brush> bind )
 {
     C.Background = bind.V;
     return this;
 }
示例#53
0
 public new AccessText Visibility( Bind<System.Windows.Visibility> bind )
 {
     return  base.Visibility( bind ) as AccessText;
 }
示例#54
0
 public DatePicker DisplayDate( Bind<System.DateTime> bind )
 {
     C.DisplayDate = bind.V;
     return this;
 }
示例#55
0
 public DatePicker CalendarStyle( Bind<System.Windows.Style> bind )
 {
     C.CalendarStyle = bind.V;
     return this;
 }
示例#56
0
 public new Border AllowDrop( Bind<System.Boolean> bind )
 {
     return  base.AllowDrop( bind ) as Border;
 }
示例#57
0
 public new DataGrid Width( Bind<System.Double> bind )
 {
     return  base.Width( bind ) as DataGrid;
 }
示例#58
0
 public DatePicker BorderThickness( Bind<System.Windows.Thickness> bind )
 {
     C.BorderThickness = bind.V;
     return this;
 }
示例#59
0
 public BindData(Bind bind)
 {
     control = bind.control;
     keys = bind.keys;
 }
示例#60
0
 public DatePicker DisplayDateEnd( Bind<DateTime?> bind )
 {
     C.DisplayDateEnd = bind.V;
     return this;
 }