Inheritance: Barrel
Exemple #1
0
 public FickReaction(FickReaction r) : base(r)
 {
   _surface = r._surface;
   _P = r._P;
   _medium1 = r._medium1;
   _medium2 = r._medium2;
 }
 /// <summary>
 /// Constructs a new playlist object
 /// </summary>
 /// <param name="medium">The medium the playlist belongs to</param>
 /// <param name="persistentID">The persistent ID of the playlist</param>
 /// <param name="name">The name of the playlist</param>
 /// <param name="trackIDs">List of IDs of tracks which are part of the playlist</param>
 public Playlist(Medium medium, string persistentID, string name, IEnumerable<string> trackIDs)
     : this(medium)
 {
     this.PersistentID = persistentID;
     this.Name = name;
     this.SetTracks(trackIDs.ToList());
 }
 // Use this for initialization
 void Start()
 {
     GameObject explosion = this.gameObject.transform.FindChild ("Explosion").gameObject;
     barrel = this.gameObject.AddComponent<Medium>() as Medium;
     sounds = GetComponents<AudioSource> ();
     barrel.construct (this.gameObject, explosion, sounds[1]);
 }
    /*!
    \brief This function create a new Medium based on the information in the given XML Node
    \param node The XmlNode to load.
    \return Return the new Medium
      */
    public Medium loadMedium(XmlNode node)
    {
        Medium medium = new Medium();

        foreach (XmlNode attr in node)
          {
        switch (attr.Name)
          {
          case "Id":
            medium.setId(Convert.ToInt32(attr.InnerText));
            break;
          case "Name":
            medium.setName(attr.InnerText);
            break;
          case "Energy":
            loadEnergy(attr.InnerText, medium);
            break;
          case "EnergyProductionRate":
            loadEnergyProductionRate(attr.InnerText, medium);
            break;
          case "MaxEnergy":
            loadMaxEnergy(attr.InnerText, medium);
            break;
          case "ReactionsSet":
            medium.setReactionsSet(attr.InnerText);
            break;
          case "MoleculesSet":
            medium.setMoleculesSet(attr.InnerText);
            break;
          }
          }
        return medium;
    }
 /// <summary>
 /// Constructs a new MediaFinder
 /// </summary>
 /// <param name="medium">The medium in which to place new media</param>
 /// <param name="directory">The directory to watch</param>
 /// <param name="collectionRequired">Whether an initial collection is required</param>
 public MusicDirectoryWatcher(Medium medium, DirectoryInfo directory, IEnumerable<string> extensions)
     : base(medium, directory, extensions)
 {
     _masterPlaylist = (MasterPlaylist)medium.MasterContainer;
     if (_masterPlaylist == null)
         throw new ArgumentException("The medium " + medium.Name + " does not have a master playlist (yet)");
 }
        /// <summary>
        /// Start watching the given medium. Only if a medium with type Local is given, is iTunes going to be watched.
        /// </summary>
        /// <param name="medium">The Medium to watch</param>
        public bool Watch(Medium medium)
        {
            // TODO: Check if the itunes plugin is disabled

            // First, collect all media
            if (medium.Type == MediumType.Local && _localMedium == null)
                _localMedium = medium;
            else if (medium.Type == MediumType.Web && _webMedium == null)
                _webMedium = medium;
            else
                return false;

            // Bail out if we do not have both media
            if (_localMedium == null || _webMedium == null) return false;

            // Do initial library load
            LoadLibrary();

            // Watch library xml for any changes
            var file = new FileInfo(ITunes.LibraryXMLPath);
            var watcher = new FileSystemWatcher(file.DirectoryName, file.Name);
            watcher.Changed += new FileSystemEventHandler(LibraryXMLChanged);
            watcher.EnableRaisingEvents = true;

            return true;
        }
Exemple #7
0
 private Medium _medium2;      //!< The second Medium
 
 //! Default constructor.
 public FickReaction()
 {
   _surface = 0;
   _P = 0;
   _medium1 = null;
   _medium2 = null;
 }
Exemple #8
0
 public void setMedium(Medium medium)
 {
     _molecules = medium.getMolecules();
     if (_molecules == null)
       return ;
     foreach (Molecule mol in _molecules)
       _curves.AddLast(new Curve(mol, gameObject.GetComponent<Transform>().localPosition, _VectrosityCam));
 }
Exemple #9
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="medium"></param>
        /// <param name="spPlaylist"></param>
        public Playlist(SpotiFire.Playlist spPlaylist, Medium medium)
            : base(spPlaylist.Name, medium)
        {
            var link = spPlaylist.GetLink();
            this.AltId = link.ToString();
            link.Dispose();

            this.Master = medium.MasterContainer;
        }
Exemple #10
0
  /*!
    \brief This method gets all molecular concentrations
    \sa Molecule
    \sa Molecule.getConcentration()
   */
  public void initMolecules()
  {
    LinkedList<Medium>    mediums = _reactionEngine.getMediumList();
    _mediumRef = ReactionEngine.getMediumFromId(_mediumId, mediums);

    if(_mediumRef != null && _molecules == null)
    {
      _molecules = _mediumRef.getMolecules();
    }
  }
Exemple #11
0
 //! Copy Constructor
 public IReaction(IReaction r)
 {
   _products = new LinkedList<Product>();
   foreach(Product p in r._products)
     _products.AddLast(p);
     _isActive = r._isActive;
     _reactionSpeed = r._reactionSpeed;
     _energyCost = r._energyCost;
     enableSequential = r.enableSequential;
     enableEnergy = r.enableEnergy;
     _medium = r._medium;
 }
Exemple #12
0
 /// <summary>
 /// Stop watching the given medium
 /// </summary>
 /// <param name="medium">The medium to stop watching</param>
 public bool UnWatch(Medium medium)
 {
     if (SpotifyMedium.Instance == medium) {
         // TODO: clear containers
         // For now, we can assume this call is never made, since the local
         // medium will never be ejected
         if (this.StoppedWatching != null)
             this.StoppedWatching.Invoke(this, medium);
         return true;
     }
     return false;
 }
 /// <summary>
 /// Stop watching the given medium
 /// </summary>
 /// <param name="medium">The medium to stop watching</param>
 public bool UnWatch(Medium medium)
 {
     if (_localMedium == medium) {
         _localMedium = null;
         // TODO: clear containers
         // For now, we can assume this call is never made, since the local
         // medium will never be ejected
         return true;
     }
     else if (_webMedium == medium) {
         _webMedium = null;
         return true;
     }
     return false;
 }
        /// <summary>
        /// Constructs a new DirectoryWatcher for the given directory
        /// </summary>
        /// <param name="directoryInfo">The DirectoryInfo instance for the directory to watch</param>
        /// <param name="extensions">The extensions to watch for</param>
        public DirectoryWatcher(Medium medium, DirectoryInfo directoryInfo, IEnumerable<string> extensions)
        {
            this.Directory = directoryInfo;
            this.Medium = medium;
            this.SearchOption = SearchOption.AllDirectories;
            this.Extensions = extensions;
            this.CollectionState = CollectionState.Uncollected;

            _watcher = new FileSystemWatcher(this.Directory.FullName, "*.*");
            _watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.Size | NotifyFilters.LastWrite;
            _watcher.IncludeSubdirectories = true;
            _watcher.Deleted += FileSystemWatcherDeleted;
            _watcher.Changed += FileSystemWatcherChanged;
            _watcher.Created += FileSystemWatcherCreated;
            _watcher.Renamed += FileSystemWatcherRenamed;
            _watcher.Error += FileSystemWatcherError;
        }
Exemple #15
0
 public bool setMedium(Medium m)
 {
     if (m != null && _graphWindow != null)
       {
     _medium = m;
     _graphWindow.setMedium(_medium);
     _checkBoxes = gameObject.GetComponentInChildren<MolCheckBoxList>();
     if (_checkBoxes != null && _medium != null)
       _checkBoxes.setMedium(_medium);
     UILabel[] labelTab = gameObject.GetComponentsInChildren<UILabel>();
     foreach (UILabel l in labelTab)
       if (l.name == "Title")
         l.text = m.getName();
     return true;
       }
     return false;
 }
Exemple #16
0
        private async void releaseCmd_Click(object sender, EventArgs e)
        {
            var approveText = "";

            if (CurSel != null)
            {
                approveText = $"Are you sure you want to release the disk image file:\n\r{CurSel.Location}?";
                if (!string.IsNullOrEmpty(CurSel.AttachedTo))
                {
                    approveText += $"\n\r\n\rThis will detach it from the following virtual machines:\n\r{CurSel.AttachedTo}";
                }
            }
            else
            {
                approveText = "Are you sure you want to release the selected disk image files?\n\r\n\rThis will detach them from any virtual machines.";
            }
            if (MessageBox.Show(this, approveText, Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            await RunMultiple(async di =>
            {
                if (di?.Location == null)
                {
                    MessageBox.Show(this, "Error getting disk information", null, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    await RunAsyncAction("Releasing", async(t, p) => await Task.Run(() => { Medium.Release(di.Location); }, t), di.UUID);
                }
            });
        }
Exemple #17
0
 /// <summary>
 /// Check whether this watcher can watch the given medium
 /// </summary>
 /// <param name="medium">The medium to check</param>
 public bool CanWatch(Medium medium)
 {
     return medium == SpotifyMedium.Instance;
 }
Exemple #18
0
        // Methods
        private static IEnumerable <string> GetResults(Role role)
        {
            switch (role)
            {
            case Vigilante _:
            case Veteran _:
            case Mafioso _:
            // case Pirate _:
            case Ambusher _:
                return(new[] { Vigilante.GetName(), Veteran.GetName(), Mafioso.GetName(), Ambusher.GetName() });

            case Medium _:
            case Janitor _:
            case Retributionist _:
            // case Necromancer _:
            case Trapper _:
                return(new[] { Medium.GetName(), Janitor.GetName(), Retributionist.GetName(), Trapper.GetName() });

            case Survivor _:
            case VampireHunter _:
            case Amnesiac _:
            // case Medusa _:
            case Psychic _:
                return(new[] { Survivor.GetName(), VampireHunter.GetName(), Amnesiac.GetName(), Psychic.GetName() });

            case Spy _:
            case Blackmailer _:
            case Jailor _:
            case GuardianAngel _:
                return(new[] { Spy.GetName(), Blackmailer.GetName(), Jailor.GetName(), GuardianAngel.GetName() });

            case Sheriff _:
            case Executioner _:
            case Werewolf _:
                // case Poisoner _:
                return(new[] { Sheriff.GetName(), Executioner.GetName(), Werewolf.GetName() });

            case Framer _:
            case Vampire _:
            case Jester _:
                // case HexMaster _:
                return(new[] { Framer.GetName(), Vampire.GetName(), Jester.GetName() });

            case Lookout _:
            case Forger _:
                // case Juggernaut _:
                // case CovenLeader _:
                return(new[] { Lookout.GetName(), Forger.GetName() });

            case Escort _:
            case Transporter _:
            case Consort _:
            case Hypnotist _:
                return(new[] { Escort.GetName(), Transporter.GetName(), Consort.GetName(), Hypnotist.GetName() });

            case Doctor _:
            case Disguiser _:
            case SerialKiller _:
                // case PotionMaster _:
                return(new[] { Doctor.GetName(), Disguiser.GetName(), SerialKiller.GetName() });

            case Investigator _:
            case Consigliere _:
            case Mayor _:
            case Tracker _:
                // case Plaguebearer _:
                return(new[] { Investigator.GetName(), Consigliere.GetName(), Mayor.GetName(), Tracker.GetName() });

            case Bodyguard _:
            case Godfather _:
            case Arsonist _:
            case Crusader _:
                return(new[] { Bodyguard.GetName(), Godfather.GetName(), Arsonist.GetName(), Crusader.GetName() });
            }

            return(new string[] { });
        }
Exemple #19
0
 public void initialize() {
   _reactionEngine = null;
   _mediumRef = null;
   _molecules = null;
 }
 /// <summary>
 /// Base constructor
 /// </summary>
 /// <param name="medium">The medium this playlist belongs to</param>
 public Playlist(Medium medium)
     : base("Playlist", medium)
 {
     this.Medium = medium;
 }
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Communication;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (Identifier != null)
            {
                dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
            }
            if (InstantiatesCanonicalElement != null)
            {
                dest.InstantiatesCanonicalElement = new List <Hl7.Fhir.Model.Canonical>(InstantiatesCanonicalElement.DeepCopy());
            }
            if (InstantiatesUriElement != null)
            {
                dest.InstantiatesUriElement = new List <Hl7.Fhir.Model.FhirUri>(InstantiatesUriElement.DeepCopy());
            }
            if (BasedOn != null)
            {
                dest.BasedOn = new List <Hl7.Fhir.Model.ResourceReference>(BasedOn.DeepCopy());
            }
            if (PartOf != null)
            {
                dest.PartOf = new List <Hl7.Fhir.Model.ResourceReference>(PartOf.DeepCopy());
            }
            if (InResponseTo != null)
            {
                dest.InResponseTo = new List <Hl7.Fhir.Model.ResourceReference>(InResponseTo.DeepCopy());
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.EventStatus>)StatusElement.DeepCopy();
            }
            if (StatusReason != null)
            {
                dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopy();
            }
            if (Category != null)
            {
                dest.Category = new List <Hl7.Fhir.Model.CodeableConcept>(Category.DeepCopy());
            }
            if (PriorityElement != null)
            {
                dest.PriorityElement = (Code <Hl7.Fhir.Model.RequestPriority>)PriorityElement.DeepCopy();
            }
            if (Medium != null)
            {
                dest.Medium = new List <Hl7.Fhir.Model.CodeableConcept>(Medium.DeepCopy());
            }
            if (Subject != null)
            {
                dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
            }
            if (Topic != null)
            {
                dest.Topic = (Hl7.Fhir.Model.CodeableConcept)Topic.DeepCopy();
            }
            if (About != null)
            {
                dest.About = new List <Hl7.Fhir.Model.ResourceReference>(About.DeepCopy());
            }
            if (Encounter != null)
            {
                dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy();
            }
            if (SentElement != null)
            {
                dest.SentElement = (Hl7.Fhir.Model.FhirDateTime)SentElement.DeepCopy();
            }
            if (ReceivedElement != null)
            {
                dest.ReceivedElement = (Hl7.Fhir.Model.FhirDateTime)ReceivedElement.DeepCopy();
            }
            if (Recipient != null)
            {
                dest.Recipient = new List <Hl7.Fhir.Model.ResourceReference>(Recipient.DeepCopy());
            }
            if (Sender != null)
            {
                dest.Sender = (Hl7.Fhir.Model.ResourceReference)Sender.DeepCopy();
            }
            if (Reason != null)
            {
                dest.Reason = new List <Hl7.Fhir.Model.CodeableReference>(Reason.DeepCopy());
            }
            if (Payload != null)
            {
                dest.Payload = new List <Hl7.Fhir.Model.Communication.PayloadComponent>(Payload.DeepCopy());
            }
            if (Note != null)
            {
                dest.Note = new List <Hl7.Fhir.Model.Annotation>(Note.DeepCopy());
            }
            return(dest);
        }
Exemple #22
0
 public ActionResult CreatePicture(Medium medium)
 {
     return(Create(medium));
 }
Exemple #23
0
 public virtual OpticalSurface.Builder rightMaterial(Medium right)
 {
     this._right = right;
     return(this);
 }
        protected override void Seed(MMContext context)
        {
            base.Seed(context);

            var medium画布 = new Medium()
            {
                Name = "画布"
            };

            medium画布.ChangeCurrentIdentity(Guid.Parse("00000000-0000-0000-0001-000000000001"));
            context.Mediums.Add(medium画布);

            var medium画纸 = new Medium()
            {
                Name = "画纸"
            };

            medium画纸.ChangeCurrentIdentity(Guid.Parse("00000000-0000-0000-0001-000000000002"));
            context.Mediums.Add(medium画纸);

            var lecture = new Lecture()
            {
                Name        = "水粉画基础",
                Price       = 998,
                Count       = 14,
                Medium      = medium画纸,
                Description = "从零开始学习水粉画的基本画法"
            };

            lecture.ChangeCurrentIdentity(Guid.Parse("00000000-0000-0001-0001-000000000001"));
            context.Lectures.Add(lecture);

            lecture = new Lecture()
            {
                Name        = "水粉画基础test",
                Price       = 998,
                Count       = 14,
                Medium      = medium画纸,
                Description = "从零开始学习水粉画的基本画法"
            };
            lecture.ChangeCurrentIdentity(Guid.Parse("00000000-0000-0001-0001-000000000002"));
            context.Lectures.Add(lecture);

            var timesCard = new TimesCard()
            {
                Name   = "500元画纸",
                Price  = 500,
                Count  = 12,
                Medium = medium画纸
            };

            timesCard.ChangeCurrentIdentity(Guid.Parse("00000000-0000-0001-0002-000000000001"));
            context.TimesCards.Add(timesCard);

            timesCard = new TimesCard()
            {
                Name   = "500元画布",
                Price  = 500,
                Count  = 8,
                Medium = medium画布
            };
            timesCard.ChangeCurrentIdentity(Guid.Parse("00000000-0000-0001-0002-000000000002"));
            context.TimesCards.Add(timesCard);

            timesCard = new TimesCard()
            {
                Name   = "1000元画纸",
                Price  = 1000,
                Count  = 26,
                Medium = medium画纸
            };
            timesCard.ChangeCurrentIdentity(Guid.Parse("00000000-0000-0001-0002-000000000003"));
            context.TimesCards.Add(timesCard);

            timesCard = new TimesCard()
            {
                Name   = "1000元画布",
                Price  = 1000,
                Count  = 18,
                Medium = medium画布
            };
            timesCard.ChangeCurrentIdentity(Guid.Parse("00000000-0000-0001-0002-000000000004"));
            context.TimesCards.Add(timesCard);

            timesCard = new TimesCard()
            {
                Name   = "1000元画布test",
                Price  = 1000,
                Count  = 18,
                Medium = medium画布
            };
            timesCard.ChangeCurrentIdentity(Guid.Parse("00000000-0000-0001-0002-000000000005"));
            context.TimesCards.Add(timesCard);

            timesCard = new TimesCard()
            {
                Name   = "1000元画布test",
                Price  = 1000,
                Count  = 18,
                Medium = medium画布
            };
            timesCard.ChangeCurrentIdentity(Guid.Parse("00000000-0000-0001-0002-000000000006"));
            context.TimesCards.Add(timesCard);

            var oneTimeExperience = new OneTimeExperience()
            {
                Name = "一次性画纸", Price = 20, Medium = medium画纸
            };

            oneTimeExperience.ChangeCurrentIdentity(Guid.Parse("00000000-0000-0001-0003-000000000001"));
            context.OneTimeExperiences.Add(oneTimeExperience);

            oneTimeExperience = new Model.OneTimeExperience()
            {
                Name = "一次性画布", Price = 30, Medium = medium画纸
            };
            oneTimeExperience.ChangeCurrentIdentity(Guid.Parse("00000000-0000-0001-0003-000000000002"));
            context.OneTimeExperiences.Add(oneTimeExperience);

            oneTimeExperience = new Model.OneTimeExperience()
            {
                Name = "一次性画布test", Price = 30, Medium = medium画纸
            };
            oneTimeExperience.ChangeCurrentIdentity(Guid.Parse("00000000-0000-0001-0003-000000000003"));
            context.OneTimeExperiences.Add(oneTimeExperience);

            Tutor tutor = new Tutor()
            {
                Name      = "admin",
                IsManager = true
            };

            tutor.SetPassword("password");
            tutor.ChangeCurrentIdentity(Guid.Parse("00000000-0000-0002-0001-000000000001"));
            context.Tutors.Add(tutor);
        }
Exemple #25
0
 public ActionResult CreateFlash(Medium medium)
 {
     return(Create(medium));
 }
Exemple #26
0
 /// <summary>
 /// Add a new book to the stock of the library.
 /// </summary>
 /// <param name="book"></param>
 public void AddNewMedium(Medium m)
 {
     media[mediumCount] = m;
     mediumCount++;
 }
        protected override void Initialize()
        {
            this.Dock = DockStyle.Fill;

            //Init camera and dimensions
            this.worldDimensions = new Rectangle(0, 0, this.Width, this.Height);
            previousScroll       = Mouse.GetState().ScrollWheelValue;
            zoomIncrement        = 0.01f;
            camera = new Camera(GraphicsDevice.Viewport, (int)worldDimensions.Width * worldSizeMultiplier, (int)worldDimensions.Height * worldSizeMultiplier, 1f);

            numOfMasses = 80;

            ContentManager content = new ContentManager(Services);

            content.RootDirectory = "Content";
            massTexture           = content.Load <Texture2D>("Image1");
            selectedTexture       = content.Load <Texture2D>("selectedRing");
            spriteBatch           = new SpriteBatch(GraphicsDevice);
            selectedMass          = null;

            lastLMouse = Microsoft.Xna.Framework.Input.ButtonState.Released;
            lastRMouse = Microsoft.Xna.Framework.Input.ButtonState.Released;

            //area selection
            startVector = new Vector2();

            //group list
            objectGroupList = new List <ObjectGroup>();


            // Start the animation timer.
            timer          = new Timer();
            timer.Interval = 1;
            timer.Tick    += Tick;
            timer.Start();

            //create simulation
            springSim               = new Simulation(this);
            springSim.Stiffness     = stiffness;
            springSim.Damping       = damping;
            springSim.Length        = 10f;
            springSim.MassPerString = numOfMasses;
            stringLists             = new List <SimString>();

            //add forces
            gravity = new Gravity(new Vector2(0f, 9.81f));
            springSim.AddGlobalForceGenerator(gravity);

            air = new Medium(0.5f);
            springSim.AddGlobalForceGenerator(air);

            barrier = new ControlSide(new Rectangle(worldDimensions.X, worldDimensions.Y,
                                                    worldDimensions.Width * worldSizeMultiplier, worldDimensions.Height * worldSizeMultiplier));
            springSim.AddGlobalForceGenerator(barrier);

            //add integrator
            integrator           = new ForwardEulerIntegrator(this);
            springSim.Integrator = integrator;

            parentForm.saveState();
        }
Exemple #28
0
        public ActionResult Index(Medium model, HttpPostedFileBase file, string submit)
        {
            var listSource = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("SAT", "SAT"),
                new KeyValuePair <string, string>("IELTS", "IELTS"),
                //new KeyValuePair<string, string>("SAT","SAT"),
            };

            ViewBag.ListSource = new SelectList(listSource, "Key", "Value");
            var medias = _mediaRepo.GetAll().OrderByDescending(t => t.CreatedDate);

            if (ModelState.IsValidField("DisplayName"))
            {
                string file_name = string.Empty, file_src = string.Empty;
                if (submit == "Hủy")
                {
                    return(RedirectToAction("Index"));
                }
                else if (submit == "Thêm")
                {
                    //for (int i = 0; i < Request.Files.Count; i++)
                    //{
                    var _file = Request.Files[0];

                    if (_file != null && _file.ContentLength > 0)
                    {
                        if (_file.ContentLength > 2000000)
                        {
                            ModelState.AddModelError("DisplayName", "Tên tài liệu không được để trống");
                            ViewBag.ErrorMessage = "Dung lượng file quá giới hạn";

                            ViewBag.Medias = medias;
                            return(View(model));
                        }
                        var fileName = Path.GetFileName(_file.FileName);
                        file_name = fileName.Replace(Path.GetExtension(fileName), string.Empty) + DateTime.Now.Ticks + Path.GetExtension(fileName);
                        if (_file.ContentType.Contains("image"))
                        {
                            model.Type = 1;
                            file_src   = Path.Combine(Server.MapPath("~/photo/post/"), file_name);
                            model.Name = file_name;
                            model.Link = "/photo/post/" + file_name;
                        }
                        else
                        {
                            model.Type = 2;
                            file_src   = Path.Combine(Utils.Instance.CreateFolderIfNeeded(Server.MapPath("~/Uploads/")), file_name);
                            model.Name = file_name;
                            model.Link = "/Uploads/" + file_name;
                        }


                        try
                        {
                            _file.SaveAs(file_src);
                        }
                        catch (Exception)
                        {
                            ModelState.AddModelError("SavePath", "Không thể lưu file!");
                            ViewBag.ErrorMessage = "Không thể lưu file!";

                            ViewBag.Medias = medias;
                            return(View(model));
                        }
                        //break;
                    }
                    //}

                    model.IsDeleted   = false;
                    model.CreatedBy   = User.UserId;
                    model.CreatedDate = DateTime.Now;
                    _mediaRepo.InsertAndSubmit(model);
                }
                else
                {
                    var entity = _mediaRepo.GetById(model.Id);
                    var _file  = Request.Files[0];
                    if (_file != null && _file.ContentLength > 0)
                    {
                        if (_file.ContentLength > 2000000)
                        {
                            ModelState.AddModelError("DisplayName", "Tên tài liệu không được để trống");
                            ViewBag.ErrorMessage = "Dung lượng file quá giới hạn";

                            ViewBag.Medias = medias;
                            return(View(model));
                        }
                        var fileName = Path.GetFileName(_file.FileName);
                        file_name = fileName.Replace(Path.GetExtension(fileName), string.Empty) + DateTime.Now.Ticks + Path.GetExtension(fileName);
                        if (_file.ContentType.Contains("image"))
                        {
                            model.Type = 1;
                            file_src   = Path.Combine(Server.MapPath("~/photo/post/"), file_name);
                            model.Name = file_name;
                            model.Link = "/photo/post/" + file_name;
                        }
                        else
                        {
                            model.Type = 2;
                            file_src   = Path.Combine(Utils.Instance.CreateFolderIfNeeded(Server.MapPath("~/Uploads/")), file_name);
                            model.Name = file_name;
                            model.Link = "/Uploads/" + file_name;
                        }


                        try
                        {
                            _file.SaveAs(file_src);
                        }
                        catch (Exception)
                        {
                            ModelState.AddModelError("SavePath", "Không thể lưu file!");
                            ViewBag.ErrorMessage = "Không thể lưu file!";

                            ViewBag.Medias = medias;
                            return(View(model));
                        }

                        entity = model.MapUpdateWithStatus <Medium>(User.UserId, entity);

                        entity.ModifiedDate = model.ModifiedDate = DateTime.Now;
                        entity.ModifiedBy   = User.UserId;
                        _mediaRepo.Update(entity);
                        _mediaRepo.SaveChanges();
                    }
                    else
                    {
                        entity.DisplayName = model.DisplayName;
                        entity.FileSource  = model.FileSource;
                        //entity.Type = model.Type;
                        entity.ModifiedDate = model.ModifiedDate = DateTime.Now;
                        entity.ModifiedBy   = User.UserId;
                        _mediaRepo.Update(entity);
                        _mediaRepo.SaveChanges();
                    }
                }



                //var mediaModel = new IEE.Infrastructure.Media();
                //mediaModel.Name = model.Name;
                //mediaModel.Link = model.Link;
                //mediaModel.IsDeleted = model.IsDeleted;
                //mediaModel.CreatedBy = model.CreatedBy;
                //mediaModel.CreatedDate = model.CreatedDate;

                //using (var db= new IEE.Infrastructure.nhieevwp_webEntities())
                //{
                //    db.Media.Add(mediaModel);
                //    db.SaveChanges();
                //}



                return(RedirectToAction("Index"));
            }
            ModelState.AddModelError("DisplayName", "Tên tài liệu không được để trống");
            ViewBag.ErrorMessage = "Tên tài liệu không được để trống";

            ViewBag.Medias = medias;
            return(View(model));
        }
Exemple #29
0
 /// <summary>
 /// Start watching the given medium. Only if the SpotifyMedium
 /// is given, is it going to be watched.
 /// </summary>
 /// <param name="medium">The Medium to watch</param>
 public bool Watch(Medium medium)
 {
     if (medium == SpotifyMedium.Instance) {
         if (this.StartedWatching != null)
             this.StartedWatching.Invoke(this, medium);
         return true;
     }
     else
         return false;
 }
Exemple #30
0
 public ActionResult CreatePowerpoint(Medium medium)
 {
     return(Create(medium));
 }
Exemple #31
0
 public void setMedium1(Medium medium)
 {
     _medium1 = medium;
 }
Exemple #32
0
 public ActionResult CreateMarquee(Medium medium, string foreColor, string backColor)
 {
     medium.Options = "foreColor=" + foreColor + ";backColor=" + backColor;
     return(Create(medium));
 }
 /// <summary>
 /// Builds a new playlist object
 /// </summary>
 /// <param name="medium">The medium the playlist belongs to</param>
 /// <param name="persistentID">The persistent ID of the playlist</param>
 /// <param name="name">The name of the playlist</param>
 /// <param name="trackIDs">List of IDs of tracks which are part of the playlist</param>
 /// <param name="master">Whether the playlist should be a master playlist</param>
 public static Playlist Build(Medium medium, string persistentID, string name, IEnumerable<string> trackIDs, bool master)
 {
     return master ? new MasterPlaylist(medium, persistentID, name, trackIDs) : new Playlist(medium, persistentID, name, trackIDs);
 }
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Communication;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (Category != null)
                {
                    dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopy();
                }
                if (Sender != null)
                {
                    dest.Sender = (Hl7.Fhir.Model.ResourceReference)Sender.DeepCopy();
                }
                if (Recipient != null)
                {
                    dest.Recipient = new List <Hl7.Fhir.Model.ResourceReference>(Recipient.DeepCopy());
                }
                if (Payload != null)
                {
                    dest.Payload = new List <Hl7.Fhir.Model.Communication.PayloadComponent>(Payload.DeepCopy());
                }
                if (Medium != null)
                {
                    dest.Medium = new List <Hl7.Fhir.Model.CodeableConcept>(Medium.DeepCopy());
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.Communication.CommunicationStatus>)StatusElement.DeepCopy();
                }
                if (Encounter != null)
                {
                    dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy();
                }
                if (SentElement != null)
                {
                    dest.SentElement = (Hl7.Fhir.Model.FhirDateTime)SentElement.DeepCopy();
                }
                if (ReceivedElement != null)
                {
                    dest.ReceivedElement = (Hl7.Fhir.Model.FhirDateTime)ReceivedElement.DeepCopy();
                }
                if (Reason != null)
                {
                    dest.Reason = new List <Hl7.Fhir.Model.CodeableConcept>(Reason.DeepCopy());
                }
                if (Subject != null)
                {
                    dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
                }
                if (RequestDetail != null)
                {
                    dest.RequestDetail = (Hl7.Fhir.Model.ResourceReference)RequestDetail.DeepCopy();
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Exemple #35
0
        void medium(out Medium m)
        {
            m = Medium.all;
            switch (la.kind)
            {
            case 12:
            {
                Get();
                m = Medium.all;
                break;
            }

            case 13:
            {
                Get();
                m = Medium.aural;
                break;
            }

            case 14:
            {
                Get();
                m = Medium.braille;
                break;
            }

            case 15:
            {
                Get();
                m = Medium.embossed;
                break;
            }

            case 16:
            {
                Get();
                m = Medium.handheld;
                break;
            }

            case 17:
            {
                Get();
                m = Medium.print;
                break;
            }

            case 18:
            {
                Get();
                m = Medium.projection;
                break;
            }

            case 19:
            {
                Get();
                m = Medium.screen;
                break;
            }

            case 20:
            {
                Get();
                m = Medium.tty;
                break;
            }

            case 21:
            {
                Get();
                m = Medium.tv;
                break;
            }

            default: SynErr(52); break;
            }
        }
Exemple #36
0
 /// <summary>
 /// Constructs a playlist, giving it the name "Playlist"
 /// </summary>
 /// <param name="medium">The Medium the playlist resides in</param>
 public Playlist(Medium medium) : this("Playlist", medium)
 {
 }
Exemple #37
0
        //
        // GET: /Default1/Details/5

        public ViewResult Details(long id)
        {
            Medium medium = _db.Media.Single(m => m.MediaID == id);

            return(View(medium));
        }
        public void OverAllAdminFuntionTest()
        {
            //Add OneTimeExperience : Product
            var ote = new OneTimeExperience()
            {
                Name  = "testOTE",
                Price = 10.3M
            };

            ote.GenerateNewIdentity();
            _admin.AddProduct(ote);
            Assert.AreEqual(context.Products.Count(), 1);
            var result = context.Products.FirstOrDefault(x => x.Id == ote.Id);

            Assert.AreEqual(context.Products.FirstOrDefault(x => x.Id == ote.Id), ote);

            //Add Lecture : MemberProduct : Product
            var lecture = new Lecture()
            {
                Count       = 10,
                Description = "test description",
                Name        = "testLecture",
                Price       = 10.4M
            };

            lecture.GenerateNewIdentity();
            _admin.AddProduct(lecture);
            Assert.AreEqual(context.Products.Count(), 2);
            Assert.AreEqual(context.Products.FirstOrDefault(x => x.Id == lecture.Id), lecture);

            //Add Medium
            var medium = new Medium()
            {
                Name = "testMedium"
            };

            medium.GenerateNewIdentity();
            _admin.AddMedium(medium);
            Assert.AreEqual(context.Mediums.Count(), 1);
            Assert.AreEqual(context.Mediums.FirstOrDefault(x => x.Name == medium.Name).Id, medium.Id);

            //Add TimesCard : MemberProduct : Product
            var timesCard = new TimesCard()
            {
                Count  = 10,
                Medium = medium,
                Name   = "testTimesCard",
                Price  = 9.9M
            };

            timesCard.GenerateNewIdentity();
            _admin.AddProduct(timesCard);
            Assert.AreEqual(context.Products.Count(), 3);
            Assert.AreEqual(context.Products.FirstOrDefault(x => x.Id == timesCard.Id), timesCard);

            var tutor = new Tutor()
            {
                Address     = "testAddress",
                Gender      = Model.Enums.Gender.Female,
                IsManager   = true,
                Name        = "testName",
                PhoneNumber = "12345678"
            };

            _admin.AddTutor(tutor);
            Assert.AreEqual(context.Tutors.Count(), 1);
            Assert.AreEqual(context.Tutors.FirstOrDefault(x => x.Name == tutor.Name).Id, tutor.Id);

            //_admin.Sell(tutor.Id, timesCard.Id, "testMember", "testPhoneNumber");
            Assert.AreEqual(context.Purchases.Count(), 1);
            var testSell = context.Purchases.FirstOrDefault(x => x.ProductId == timesCard.Id);

            Assert.AreEqual(testSell.Product, timesCard);
            Assert.AreNotEqual(testSell.PurchaseDate, null);
            Assert.AreEqual(testSell.Tutor, tutor);
            Assert.AreEqual(context.Members.Count(), 1);
            var testMember = context.Members.FirstOrDefault();

            Assert.AreEqual(testMember.Name, "testMember");
            Assert.AreEqual(testMember.PhoneNumber, "testPhoneNumber");
            Assert.AreEqual(testMember.Address, null);
            Assert.AreEqual(testMember.Balances.Count, 1);
            Assert.AreEqual(testMember.Balances.FirstOrDefault().Product, timesCard);
            Assert.AreEqual(testMember.Gender, Model.Enums.Gender.Male);

            //var newMember = new Member()
            //{
            //    Address = "testAddress",
            //    PhoneNumber = "testPhoneNunber",
            //    Name ="testMember"
            //};
            //_admin.ModifyMember(newMember);
            //Assert.AreEqual(_context.Members.Count(), 1);
            //Assert.AreEqual(_context.Members.FirstOrDefault().Id, testMember.Id);
            //Assert.AreEqual(_context.Members.FirstOrDefault().Address, "testAddress");
        }
Exemple #39
0
 private void initializeIfNecessary()
 {
     //???
     //gameObject.SetActive(true);
     _isAlive = true;
     
     //LinkedList<Medium> mediums = ReactionEngine.get ().getMediumList();
     _medium = ReactionEngine.getMediumFromId(1, ReactionEngine.get ().getMediumList());
     _maxMediumEnergy = _medium.getMaxEnergy();
     _energy = _medium.getEnergy()/_maxMediumEnergy;
 }
Exemple #40
0
        //
        // GET: /Default1/Delete/5

        public ActionResult Delete(long id)
        {
            Medium medium = _db.Media.Single(m => m.MediaID == id);

            return(View(medium));
        }
 /// <summary>
 /// Constructs a new webcast container
 /// </summary>
 /// <param name="name">The name of the container</param>
 /// <param name="medium">The medium this container came from</param>
 public WebcastContainer(string name, Medium medium)
     : base(name, medium)
 {
     this.Webcasts = new SortedSet<Webcast>();
 }
Exemple #42
0
 public ActionResult CreateVideo(Medium medium)
 {
     return(Create(medium));
 }
Exemple #43
0
 Medium GenerateFriction()
 {
     medium = new Medium(FRICTION);
     return(medium);
 }
 /// <summary>
 /// Constructs a new DirectoryWatcher for the given path
 /// </summary>
 /// <param name="path">The path of the directory to watch</param>
 /// <param name="extensions">The extensions to watch for</param>
 public DirectoryWatcher(Medium medium, string path, IEnumerable <string> extensions) : this(medium, new DirectoryInfo(path), extensions)
 {
 }
Exemple #45
0
 public void setMedium(Medium med) { _medium = med; }
 public MasterPlaylist(Medium medium)
     : base(medium)
 {
 }
Exemple #47
0
 public Thumbnails()
 {
     Default = new Default();
     Medium  = new Medium();
     High    = new High();
 }
Exemple #48
0
 public Playlist(string name, Medium medium, Container master) : base(name, medium)
 {
     this.Master = master;
 }
Exemple #49
0
        /// <summary>
        /// This functions loads the content for the level.
        /// </summary>
        /// <param name="fileStream">stream used to load level from text file</param>
        /// <param name="difficulty">difficulty setting to create level in</param>
        /// <param name="gameplayTextures">gameplay textures (i.e. background/tiles)</param>
        /// <param name="playerTextures">player animation textures</param>
        /// <param name="playerSounds"> player sound effects</param>
        /// <param name="enemyTextures">enemy animation textures</param>
        public void LoadContent(
            Stream fileStream, 
            int difficulty, 
            Texture2D[] gameplayTextures,
            Texture2D[] playerTextures,
            SoundEffect[] playerSounds,
            Texture2D[] enemyTextures)
        {
            switch (difficulty) //difficulty state switch
            {
                case 0: this.difficulty = DifficultySetting.Easy;
                    easy = new Easy();
                    this.winScore = easy.winScore;
                    this.textureLimit = easy.textureLimit;
                    break;

                case 1: this.difficulty = DifficultySetting.Medium;
                    medium = new Medium();
                    this.winScore = medium.winScore;
                    this.textureLimit = medium.textureLimit;
                    break;

                case 2: this.difficulty = DifficultySetting.Hard;
                    hard = new Hard();
                    this.winScore = hard.winScore;
                    this.textureLimit = hard.textureLimit;
                    break;
            }

            timeCount = TimeSpan.FromMinutes(0.0); //set start time of game to zero

            this.backgroundTexture = gameplayTextures[0]; //load background texture

            //load the tile textures
            this.platformTexture = gameplayTextures[1];
            this.floorATexture = gameplayTextures[2];
            this.floorBTexture = gameplayTextures[3];
            this.floorEdgeLTexture = gameplayTextures[4];
            this.floorEdgeRTexture = gameplayTextures[5];
            LoadTiles(fileStream); //load the tile map

            //create new player object
            playerStart = new Vector2(60, 448); //define start position
            player = new Player(this, playerStart);
            player.LoadContent(playerTextures, playerSounds);

            //create new enemy list (i.e. room for multiple enemies)
            enemies = new List<Enemy>();
            enemySpawn = 0;
            enemyType = new String[3] { "Body", "Robe", "Armour" };
            enemyIndex = 0;
            this.enemyTextures = enemyTextures;
            walkLeft = false;
            enemyKilled = playerSounds[2];
            LoadEnemy(); //load an initial enemy
        }
Exemple #50
0
 public void AddMedium(Medium medium)
 {
     _mediumList.Add(medium);
 }
Exemple #51
0
 public void setMedium2(Medium medium)
 {
     _medium2 = medium;
 }
Exemple #52
0
 private void AddMediumTokens(Dictionary <string, Func <TokenMatch, string> > tokenHandlers, Medium medium)
 {
     tokenHandlers["{Medium Format}"] = m => medium.Format;
 }
Exemple #53
0
 public void setMedium(Medium med)
 {
     _medium = med;
     UpdateCheckBoxes();
 }
Exemple #54
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as CommunicationRequest;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (Identifier != null)
            {
                dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
            }
            if (BasedOn != null)
            {
                dest.BasedOn = new List <Hl7.Fhir.Model.ResourceReference>(BasedOn.DeepCopy());
            }
            if (Replaces != null)
            {
                dest.Replaces = new List <Hl7.Fhir.Model.ResourceReference>(Replaces.DeepCopy());
            }
            if (GroupIdentifier != null)
            {
                dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopy();
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.RequestStatus>)StatusElement.DeepCopy();
            }
            if (Category != null)
            {
                dest.Category = new List <Hl7.Fhir.Model.CodeableConcept>(Category.DeepCopy());
            }
            if (PriorityElement != null)
            {
                dest.PriorityElement = (Code <Hl7.Fhir.Model.RequestPriority>)PriorityElement.DeepCopy();
            }
            if (Medium != null)
            {
                dest.Medium = new List <Hl7.Fhir.Model.CodeableConcept>(Medium.DeepCopy());
            }
            if (Subject != null)
            {
                dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
            }
            if (Recipient != null)
            {
                dest.Recipient = new List <Hl7.Fhir.Model.ResourceReference>(Recipient.DeepCopy());
            }
            if (Topic != null)
            {
                dest.Topic = new List <Hl7.Fhir.Model.ResourceReference>(Topic.DeepCopy());
            }
            if (Context != null)
            {
                dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopy();
            }
            if (Payload != null)
            {
                dest.Payload = new List <Hl7.Fhir.Model.CommunicationRequest.PayloadComponent>(Payload.DeepCopy());
            }
            if (Occurrence != null)
            {
                dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopy();
            }
            if (AuthoredOnElement != null)
            {
                dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopy();
            }
            if (Sender != null)
            {
                dest.Sender = (Hl7.Fhir.Model.ResourceReference)Sender.DeepCopy();
            }
            if (Requester != null)
            {
                dest.Requester = (Hl7.Fhir.Model.CommunicationRequest.RequesterComponent)Requester.DeepCopy();
            }
            if (ReasonCode != null)
            {
                dest.ReasonCode = new List <Hl7.Fhir.Model.CodeableConcept>(ReasonCode.DeepCopy());
            }
            if (ReasonReference != null)
            {
                dest.ReasonReference = new List <Hl7.Fhir.Model.ResourceReference>(ReasonReference.DeepCopy());
            }
            if (Note != null)
            {
                dest.Note = new List <Hl7.Fhir.Model.Annotation>(Note.DeepCopy());
            }
            return(dest);
        }
        /// <summary>
        /// Gets or creates the playlist corresponding to the given parameters
        /// </summary>
        /// <param name="medium">The medium the playlist belongs to</param>
        /// <param name="persistentID">The persistent ID of the playlist</param>
        /// <param name="name">The name of the playlist</param>
        /// <param name="trackIDs">List of IDs of tracks which are part of the playlist</param>
        /// <param name="master">Whether the playlist should be a master playlist</param>
        /// <returns>The corresponding Touchee playlist</returns>
        public static Playlist CreateOrUpdate(Medium medium, string persistentID, string name, IEnumerable<string> trackIDs, bool master)
        {
            Playlist playlist;
            var newPlaylist = Playlist.Build(medium, persistentID, name, trackIDs, master);

            if (Playlist.ExistsBySourceID(persistentID)) {
                playlist = Playlist.FindBySourceID<Playlist>(persistentID);
                playlist.Update(newPlaylist);
            }
            else {
                playlist = newPlaylist;
                playlist.Save();
            }

            return playlist;
        }
Exemple #56
0
 /// <summary>
 /// Constructs a playlist
 /// </summary>
 /// <param name="name">The name of the playlist</param>
 /// <param name="medium">The Medium the playlist resides in</param>
 public Playlist(string name, Medium medium) : base(name, medium)
 {
 }
 /// <summary>
 /// Constructs a new DirectoryWatcher for the given directory
 /// </summary>
 /// <param name="directoryInfo">The DirectoryInfo instance for the directory to watch</param>
 public DirectoryWatcher(Medium medium, DirectoryInfo directoryInfo) : this(medium, directoryInfo, new List <string>())
 {
 }
 public void setMedium(Medium med)
 {
     _medium = med;
     UpdateCheckBoxes();
 }
 public MasterPlaylist(Medium medium, string persistentID, string name, IEnumerable<string> trackIDs)
     : base(medium, persistentID, name, trackIDs)
 {
 }
 /// <summary>
 /// Constructs a new DirectoryWatcher for the given path
 /// </summary>
 /// <param name="path">The path of the directory to watch</param>
 public DirectoryWatcher(Medium medium, string path) : this(medium, new DirectoryInfo(path))
 {
 }