Пример #1
0
 public MainWindow()
 {
     InitializeComponent();
     rBtnEncrypt.IsChecked = true;
     update    = updateList;
     _setModel = setModel;
 }
        public override void Recover()
        {
            var queueName = IsServerNamed ? string.Empty : Name;
            var result    = ModelDelegate.QueueDeclare(queueName, _durable, _exclusive, IsAutoDelete, _arguments);

            Name = result.QueueName;
        }
Пример #3
0
        public async Task <string> Recover()
        {
            ConsumerTag = await ModelDelegate.BasicConsume(Queue, AutoAck,
                                                           ConsumerTag, false, Exclusive,
                                                           Arguments, Consumer);

            return(ConsumerTag);
        }
Пример #4
0
        public string Recover()
        {
            ConsumerTag = ModelDelegate.BasicConsume(Queue, AutoAck,
                                                     ConsumerTag, false, Exclusive,
                                                     Arguments, Consumer);

            return(ConsumerTag);
        }
        public void Recover()
        {
            QueueDeclareOk ok = ModelDelegate.QueueDeclare(NameToUseForRecovery, durable,
                                                           exclusive, IsAutoDelete,
                                                           arguments);

            Name = ok.QueueName;
        }
        public void Recover()
        {
            var ok = ModelDelegate.QueueDeclare(NameToUseForRecovery, this.durable,
                                                this.exclusive, this.autoDelete,
                                                this.arguments);

            this.name = ok.QueueName;
        }
Пример #7
0
 /// <summary>
 /// Registers a new hook to be executed before the model
 /// is deleted from the database.
 /// </summary>
 /// <param name="hook">The hook</param>
 internal void RegisterOnBeforeDelete <T>(ModelDelegate <T> hook)
 {
     if (!onBeforeDelete.ContainsKey(typeof(T)))
     {
         onBeforeDelete[typeof(T)] = new List <ModelDelegate <T> >();
     }
     ((List <ModelDelegate <T> >)onBeforeDelete[typeof(T)]).Add(hook);
 }
Пример #8
0
 /// <summary>
 /// Registers a new hook to be executed after the model
 /// is deleted from the database.
 /// </summary>
 /// <param name="hook">The hook</param>
 internal void RegisterOnAfterDelete <T>(ModelDelegate <T> hook)
 {
     if (!_onAfterDelete.ContainsKey(typeof(T)))
     {
         _onAfterDelete[typeof(T)] = new List <ModelDelegate <T> >();
     }
     ((List <ModelDelegate <T> >)_onAfterDelete[typeof(T)]).Add(hook);
 }
Пример #9
0
        public string Recover()
        {
            this.consumerTag = ModelDelegate.BasicConsume(this.queue, this.autoAck,
                                                          this.consumerTag, false, this.exclusive,
                                                          this.arguments, this.consumer);

            return(this.consumerTag);
        }
Пример #10
0
        /// <summary>
        /// Will update algorithm result according to <code>newPoint</code> and will notify UI
        /// </summary>
        /// <param name="oldPoint">saved point in algorithm result</param>
        /// <param name="newPoint">new point modified by UI</param>
        public void UpdatePoints(Point3D oldPoint, Point3D newPoint)
        {
            Point3D foundPoint = this.CreatedResult.KMatrix.Find(p3D => p3D.X.CompareTo(oldPoint.X) == 0 &&
                                                                 p3D.Y.CompareTo(oldPoint.Y) == 0);

            if (foundPoint != null)
            {
                foundPoint.X = newPoint.X;
                foundPoint.Y = newPoint.Y;
                foundPoint.Z = newPoint.Z;
            }
            this.CreatedResult = this.Builder.RebuildSurface(this.CreatedResult.KMatrix);
            ModelDelegate.OnPointsAlgProcessed();
        }
Пример #11
0
    public static void RemoveHandle <T>(ModelDelegate <T> handler)
    {
        className = typeof(T);

        if (_instance._binding.ContainsKey(className))
        {
            ModelDelegate <T> modelDelegate = (ModelDelegate <T>)_instance._binding[className];
            modelDelegate -= handler;

            if (modelDelegate == null)
            {
                _instance._binding.Remove(className);
            }
            else
            {
                _instance._binding[className] = modelDelegate;
            }
        }
    }
Пример #12
0
    public static void HandleGet <T>(ModelDelegate <T> handler)
    {
        className = typeof(T);

        if (!_instance._binding.ContainsKey(className))
        {
            _instance._binding.Add(className, handler);
        }
        else
        {
            ModelDelegate <T> modelDelegate = (ModelDelegate <T>)_instance._binding[className];
            modelDelegate += handler;
            _instance._binding[className] = modelDelegate;
        }

        if (_instance._models.ContainsKey(className))
        {
            handler((T)_instance._models[className]);
        }
    }
Пример #13
0
        /// <summary>
        /// Creates a BaseModel.
        /// </summary>
        /// <param name="model">The Model to use. Cannot be null.</param>
        /// <param name="glass">If true, the model is rendered as glass.</param>
        /// <param name="mobile">True if the model is dynamic, false if kinetic. Null means 
        /// kinetic but moves via velocity.</param>
        /// <param name="origin">The position of the model. Use Vector3.Zero if mobile is false.</param>
        public BaseModel(ModelDelegate modelDelegate, bool glass, bool? mobile, Vector3 origin)
        {
            UseCustomAlpha = false;
            this.modelDelegate = modelDelegate;

            Transform = Matrix.Identity;
            RenderAsGlass = glass;
            Origin = origin;
            OriginalOrientation = Quaternion.Identity;
            //this.ignoreLight = ignoreLight;

            Vector3[] verts;
            int[] indices;
            TriangleMesh.GetVerticesAndIndicesFromModel(Model, out verts, out indices);
            Model.Tag = this;

            if(mobile.HasValue)
            {
                if(mobile.Value)
                {
                    // If it's mobile, it's a box!
                    if(Model == Resources.boxModel || Model == Resources.blueBoxModel || Model == Resources.blackBoxModel)
                    {
                        Ent = new BEPUphysics.Entities.Prefabs.Box(Origin, 1.45f, 2.05f, 1.25f, 7); // originally 1.4x2x1.2
                        Ent.ActivityInformation.IsAlwaysActive = true;
                        Ent.Material = boxMaterial;
                        //Ent.CollisionInformation.CollisionRules.Group = dynamicGroup;
                        Ent.CollisionInformation.CollisionRules.Group = noSolverGroupB;
                    }
                    else
                    {
                        // unless it's not a box.
                        Ent = new BEPUphysics.Entities.Prefabs.Box(Origin, 0.592f, 1.193f, 2f, 0.05f);
                        Ent.Material = machineMaterial;
                        Ent.CollisionInformation.CollisionRules.Group = machineGroup;
                    }
                }
                else
                {
                    // If false, it never moves.
                    Ent = new MobileMesh(verts, indices, AffineTransform.Identity, MobileMeshSolidity.DoubleSided);
                    //Transform = mesh.WorldTransform.Matrix;
                    Ent.Material = machineMaterial; // Make it slippery.
                    Ent.CollisionInformation.CollisionRules.Group = kinematicGroup;
                    //Transform = Ent.WorldTransform;
                    //Ent.Position = Origin;
                    IsTerrain = true;
                }
            }
            else
            {
                // If null, it is kinematic, but does move. (no longer true)
                //Ent = new MobileMesh(verts, indices, AffineTransform.Identity, solid ? MobileMeshSolidity.Solid : MobileMeshSolidity.Counterclockwise);
                Ent = new MobileMesh(verts, indices, AffineTransform.Identity, MobileMeshSolidity.DoubleSided, 30);
                Ent.CollisionInformation.CollisionRules.Group = machineGroup;
                //Ent.IsAffectedByGravity = false;
                Transform = Matrix.CreateTranslation(-Ent.Position);
                Ent.Position += Origin;
                Ent.Material = machineMaterial; // Make it slippery.
                Ent.CollisionInformation.Tag = this;
            }

            //foreach(ModelMesh mesh in internalModel.Meshes)
            //    foreach(BasicEffect effect in mesh.Effects)
            //        effect.EnableDefaultLighting();

            //if(Ent != null)
            //{
            OriginalOrientation = Ent.Orientation;
            Ent.Tag = this;
            //}
            //if(Mesh != null)
            //    Mesh.Tag = this;
        }
Пример #14
0
 /// <summary>
 /// Registers a new hook to be executed after the OnBeforeSave
 /// hook as been executed but before the model is saved to the
 /// database. This hook should be used to extend default model
 /// validation.
 /// </summary>
 /// <param name="hook">The hook</param>
 public void RegisterOnValidate(ModelDelegate <T> hook)
 {
     App.Hooks.RegisterOnLoad <T>(hook);
 }
Пример #15
0
 /// <summary>
 /// Registers a new hook to be executed after the model
 /// is deleted from the database.
 /// </summary>
 /// <param name="hook">The hook</param>
 public void RegisterOnAfterDelete(ModelDelegate <T> hook)
 {
     App.Hooks.RegisterOnAfterDelete(hook);
 }
Пример #16
0
 /// <summary>
 /// Registers a new hook to be executed before the model
 /// is saved to the database.
 /// </summary>
 /// <param name="hook">The hook</param>
 public void RegisterOnBeforeSave(ModelDelegate <T> hook)
 {
     App.Hooks.RegisterOnBeforeSave(hook);
 }
 public override void Recover()
 {
     ModelDelegate.ExchangeDeclare(Name, _type, _durable, IsAutoDelete, _arguments);
 }
Пример #18
0
 /// <summary>
 /// Registers a new hook to be executed after the model
 /// is saved to the database.
 /// </summary>
 /// <param name="hook">The hook</param>
 internal void RegisterOnAfterSave<T>(ModelDelegate<T> hook) { 
     if (!onAfterSave.ContainsKey(typeof(T)))
         onAfterSave[typeof(T)] = new List<ModelDelegate<T>>();
     ((List<ModelDelegate<T>>)onAfterSave[typeof(T)]).Add(hook);            
 }
 public void Recover()
 {
     ModelDelegate.ExchangeDeclare(Name, type, Durable, IsAutoDelete, Arguments);
 }
Пример #20
0
 /// <summary>
 /// Will process collected points and pass notification to UI when algorithm result is ready
 /// </summary>
 public void ProcessData()
 {
     this.NoiseFilter.Reset();
     this.CreatedResult = this.Builder.BuildSurface(this.AlgPoints.ConvertAll(hand => hand.Position));
     ModelDelegate.OnPointsAlgProcessed();
 }
Пример #21
0
 public static void Initialize(EffectDelegate eff, Texture2D[] bblist, Texture2D[] activebblist, ModelDelegate disp)
 {
     effectDelegate = eff;
     billboardList = bblist;
     activeBillboardList = activebblist;
     Dispenser = disp;
 }
Пример #22
0
 protected BaseModel(ModelDelegate m, bool glass, Vector3 origin)
 {
     //internalModel = m;
     modelDelegate = m;
     RenderAsGlass = glass;
     Origin = origin;
 }
Пример #23
0
 public override void Recover()
 {
     ConsumerTag = ModelDelegate.BasicConsume(Queue, AutoAck, ConsumerTag, false, Exclusive, Arguments, Consumer);
 }
Пример #24
0
        /// <summary>
        /// Creates a BaseModel without a model.
        /// </summary>
        /// <param name="e">The entity to use.</param>
        /// <param name="origin">The position of the model.</param>
        public BaseModel(Entity e, Vector3 origin)
        {
            UseCustomAlpha = false;
            RenderAsGlass = false;
            modelDelegate = delegate { return null; };
            Origin = origin;

            Ent = e;
            e.Tag = this;
            OriginalOrientation = Ent.Orientation;
        }
Пример #25
0
 /// <summary>
 /// Registers a new hook to be executed when the sitemap
 /// is invalidated due to a change in the site structure.
 /// </summary>
 /// <param name="hook">The hook</param>
 public void RegisterOnInvalidate(ModelDelegate <Sitemap> hook)
 {
     App.Hooks.RegisterOnBeforeDelete(hook);
 }
Пример #26
0
 /// <summary>
 /// Load algorithm result from xml
 /// </summary>
 /// <param name="layout">xml format of algorithm result</param>
 public void LoadRequest(XElement layout)
 {
     this.CreatedResult = this.Builder.RebuildSurface(layout);
     ModelDelegate.OnPointsAlgProcessed();
 }
 public override Task Recover()
 {
     return(ModelDelegate.ExchangeBind(Destination, Source, RoutingKey, Arguments));
 }
 public override void Recover()
 {
     ModelDelegate.ExchangeBind(Destination, Source, RoutingKey, Arguments);
 }
Пример #29
0
 /// <summary>
 /// Registers a new hook to be executed after the model
 /// has been loaded but BEFORE it has been added into
 /// the cache.
 /// </summary>
 /// <param name="hook">The hook</param>
 public void RegisterOnLoad(ModelDelegate <T> hook)
 {
     App.Hooks.RegisterOnLoad(hook);
 }
 public void Recover()
 {
     ModelDelegate.ExchangeDeclare(this.name, this.type,
                                   this.durable, this.autoDelete,
                                   this.arguments);
 }
Пример #31
0
 public Task Recover()
 {
     return(ModelDelegate.ExchangeDeclare(Name, type, Durable, IsAutoDelete, Arguments));
 }