Ejemplo n.º 1
0
        /// <summary>
        /// Get entries for the context menu when a user right clicks the
        /// application icon.
        /// </summary>
        public override MenuEntry[] Menu()
        {
            List<MenuEntry> ret = new List<MenuEntry>();

              // entry for drag animation
              ret.Add(new MenuEntry() {
            IsAnimateItem = true,
            Text = "$safeprojectname$",
            Action = new Action(DragAnimation),
            Image = this.m_BmpIcon
              });

              // entry for drag screenshot
              ret.Add(new MenuEntry() {
            IsDragItem = true,
            Text = "$safeprojectname$",
            Action = new Action(DragScreenshot),
            Image = this.m_BmpIcon
              });

              // entry for upload paste
              ret.Add(new MenuEntry() {
            Visible = ClipboardContainsText
              || ClipboardContainsImage
              || ClipboardContainsFileList,
            Text = "$safeprojectname$",
            Action = new Action(UploadClipboard),
            Image = this.m_BmpIcon
              });

              return ret.ToArray();
        }
Ejemplo n.º 2
0
 void OnTouchesEnded(List<CCTouch> touches, CCEvent touchEvent)
 {
     if (touches.Count > 0)
     {
         // Perform touch handling here
     }
 }
Ejemplo n.º 3
0
		public Player(string name = "", Content.Avatars avatar = Content.Avatars.Dragon)
		{
			Name = name;
			AvailableAvatars = new List<Avatar>();
			UnlockAvatar(avatar);
			//UnlockAvatar(Content.Avatars.PiggyBank);
			//UnlockAvatar(Content.Avatars.Penguin);
		}
Ejemplo n.º 4
0
		public List<Color> GetAvailableColors()
		{
			availableColors = new List<Color>();
			GetHomeColors();
			for (int x = 0; x < board.Width; x++)
				for (int y = 0; y < board.Height; y++)
					AddColorIfAvailable(x, y);
			return availableColors;
		}
 public ICollection<Assembly> GetAssemblies()
 {
     var assemblies = new List<Assembly>();
     var directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
     foreach (var file in Directory.GetFiles(directory, "*.dll"))
     {
         assemblies.Add(Assembly.LoadFile(file));
     }
     return assemblies;
 }
Ejemplo n.º 6
0
		private void CreateBricks()
		{
			int numberOfBricks = content.AreFiveBrickBlocksAllowed
				? GetNumberOfBricks() : NormalNumberOfBricks;
			var material = new Material(ShaderFlags.Position2DColoredTextured,
				content.Prefix + "Block" + Randomizer.Current.Get(1, 8));
			var newBrick = new Brick(material, Vector2D.Zero, displayMode);
			Bricks = new List<Brick> { newBrick };
			for (int i = 1; i < numberOfBricks; i++)
				AddBrick(Bricks[i - 1], material);
			ShiftToTopLeft();
		}
Ejemplo n.º 7
0
        private static void LoadApiAreas(HttpConfiguration config)
        {
            var typeFinder = EngineContext.Current.Resolve<ITypeFinder>();
            var findClassesOfType = typeFinder.FindClassesOfType<IWebApiConfiguration>();

            var apiConfigs = new List<IWebApiConfiguration>();
            findClassesOfType.ForEachItem(ac =>
                apiConfigs.Add((IWebApiConfiguration) Activator.CreateInstance(ac)));

            foreach (var apiConfig in apiConfigs.OrderBy(ac => ac.ConfigureOrder))
                config.Routes.MapHttpRoute(apiConfig.Name, apiConfig.RouteTemplate, apiConfig.Defaults,
                    apiConfig.Constraints);
        }
Ejemplo n.º 8
0
        public SIPApp(TransportInfo transport)
        {
            log4net.Config.XmlConfigurator.Configure();
            TempBuffer = new byte[4096];
            transport.Socket = transport.Type == ProtocolType.Tcp ? new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) : new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            IPEndPoint localEP = new IPEndPoint(transport.Host, transport.Port);
            transport.Socket.Bind(localEP);

            IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0);
            EndPoint sendEP = sender;
            transport.Socket.BeginReceiveFrom(TempBuffer, 0, TempBuffer.Length, SocketFlags.None, ref sendEP, ReceiveDataCB, sendEP);
            Transport = transport;
            Useragents = new List<UserAgent>();
        }
Ejemplo n.º 9
0
 public static void Main(string[] args)
 {
     try
     {
         List<object> instances = new List<object>();
         GeneratorContext context = new GeneratorContext();
         Generator generator = new Generator(instances, context);
         generator.Execute();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
Ejemplo n.º 10
0
		public Match(ScreenSpace screen, NumberFactory numberFactory, LogoFactory logoFactory)
			: base(Rectangle.Zero)
		{
			this.screen = screen;
			this.logoFactory = logoFactory;
			hud = new HudScene(screen, numberFactory);
			pause = new PausePage(screen);
			pause.Hide();
			Slice = new Slice();
			PointsTips = new List<PointsTip>();
			ErrorFlags = new List<ErrorFlag>();
			HideScore();
			screen.ViewportSizeChanged += RefreshSize;
			RefreshSize();
		}
Ejemplo n.º 11
0
		private void CreateDisplayCharacterButtons()
		{
			displayCharacters = new List<CharacterButton>();
			float xCenter = DisplayCharactersCenterStartX;
			float yCenter = 0.6935f;
			for (int i = 0; i < 12; i++)
			{
				if (i != 0 && i % 6 == 0)
				{
					xCenter = DisplayCharactersCenterStartX;
					yCenter += FullCharacterGap;
				}
				AddNewDisplayCharToList(xCenter, yCenter, i);
				xCenter += FullCharacterGap;
			}
		}
Ejemplo n.º 12
0
        /// <summary>
        /// 取得帳號所有角色
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns></returns>
        public List<RoleCheck> GetRoleByAdminId(Guid? id)
        {
            IEnumerable<Role> data = null;
            if (id != null)
            {
                // 帳號所有角色
                data = Db.Admins.Find(id).Roles.Where(x => x.IsDelete == false).ToList();
            }

            var roleList = Db.Roles.Where(x => x.IsDelete == false).OrderBy(x => x.Sort);
            var checkList = new List<RoleCheck>();

            // 全部角色
            foreach (var role in roleList)
            {
                var check = new RoleCheck
                {
                    Id = role.Id,
                    Name = role.Name,
                    // 帳號是否包含角色
                    IsChecked = (id != null) && data.Any(x => x.Id == role.Id)
                };
                checkList.Add(check);
            }

            return checkList;
        }
Ejemplo n.º 13
0
 public Course()
 {
     Students = new List<Student>();
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Function referenced from the Menu() function for uploading the clipboard.
        /// </summary>
        void UploadClipboard()
        {
            if (ClipboardContainsImage) {
            Image image = Clipboard.GetImage();

            //TODO: Do something with image

            Uploaded("Image", "http://example.com/image.png", "Pasted image");

              } else if (ClipboardContainsText) {
            string text = Clipboard.GetText();

            //TODO: Do something with text

            Uploaded("Text", "http://example.com/text.txt", "Pasted text");

              } else if (ClipboardContainsFileList) {
            StringCollection files = Clipboard.GetFileDropList();

            List<UploadedFile> uploadedFiles = new List<UploadedFile>();

            foreach (string file in files) {
              //TODO: Do something with files

              uploadedFiles.Add(new UploadedFile() {
            URL = "http://example.com/" + Path.GetFileName(file),
            Info = (new FileInfo(file).Length / 1000) + " kB"
              });
            }

            UploadedFiles(uploadedFiles);
              }
        }
Ejemplo n.º 15
0
		protected PropertiesXml(string contentName)
			: base(contentName)
		{
			agentData = new List<AgentData>();
		}
Ejemplo n.º 16
0
		private void CreateSolutionCharacterButtons()
		{
			if (solutionCharacters != null)
				foreach (CharacterButton character in solutionCharacters)
					character.Clicked -= character.OnSolutionCharButtonClicked;
			solutionCharacters = new List<CharacterButton>();
			int numberOfCharacters = currentRiddle.SearchedWord.Length;
			float xCenter = GetSolutionCharacterCenterStartX(numberOfCharacters);
			const float YCenter = 0.6f;
			const float ButtonGap = CharacterButton.Dimension + 0.00025f;
			for (int i = 0; i < numberOfCharacters; i++)
			{
				AddNewSolutionButtonToList(xCenter, YCenter, i);
				xCenter += ButtonGap;
			}
		}
Ejemplo n.º 17
0
        /// <summary>
        /// 修改角色選單
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="menuCheck">The menu check.</param>
        /// <returns></returns>
        public CiResult DbUpdateRoleMenus(Guid id, List<TreeViewModel> menuCheck)
        {
            CiResult ciResult = new CiResult();

            // treeview reindex 無遞迴
            var data = Db.Roles.Find(id);
            if (data != null)
            {
                try
                {
                    data.Menus.Clear();

                    foreach (var c in menuCheck)
                    {
                        if (c.IsChecked)
                        {
                            var menu = Db.Menus.Find(c.Id);
                            data.Menus.Add(menu);
                        }
                    }

                    Db.SaveChanges();

                    ciResult.ReturnResult = ReturnResult.Success;
                }
                catch (Exception)
                {
                    ciResult.Message = "選單修改失敗。";
                }

            }
            else
            {
                ciResult.Message = "角色不存在,無法修改。";
            }
            return ciResult;
        }
Ejemplo n.º 18
0
 public bool IsCollidingWithSnake(List<FilledRect> snakeBodies)
 {
     return snakeBodies.Any(IsBodyColliding);
 }
Ejemplo n.º 19
0
 //ncrunch: no coverage start
 private List<int> GetAllValidStartingColumns(Block block)
 {
     var validStartingColumns = new List<int>();
     for (int x = 0; x < Width; x++)
         if (IsAValidStartingColumn(block, x))
             validStartingColumns.Add(x);
     return validStartingColumns;
 }
Ejemplo n.º 20
0
		private List<char> GetWordPlusFillCharacters()
		{
			var list = new List<char>(currentRiddle.SearchedWord.ToUpper().ToCharArray());
			while (list.Count < displayCharacters.Count)
				list.Add(GetRandomUpperCaseLetter());
			list = RandomizeList(list);
			return list;
		}
        /// <summary>
        /// Randomizes character positions in string
        /// </summary>
        static string Scramble(string input)
        {
            if (string.IsNullOrEmpty(input))
            return input;

              List<char> inputChars = new List<char>(input);
              char[] outputChars = new char[inputChars.Count];

              Random rand = new Random();

              for (int i = inputChars.Count - 1; i >= 0; i--)
              {
            int index = rand.Next(i);
            outputChars[i] = inputChars[index];
            inputChars.RemoveAt(index);
              }

              return new string(outputChars);
        }
Ejemplo n.º 22
0
		public void Draw(List<DrawableEntity> visibleEntities)
		{
			foreach (var entity in visibleEntities)
				AddVerticesToBatch((Track)entity);
		}
Ejemplo n.º 23
0
		private void CreateLevels()
		{
			levels = new List<LevelData>();
			levels.Add(CreateLevelData("Wurm", "WORM"));
			levels.Add(CreateLevelData("Mouse", "MOUSE"));
			levels.Add(CreateLevelData("Sea", "WATER"));
		}
Ejemplo n.º 24
0
        /// <summary>
        /// 修改帳號角色
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="roleCheck">The role check.</param>
        /// <returns></returns>
        public CiResult DbUpdateAdminRoles(Guid id, List<RoleCheck> roleCheck)
        {
            CiResult ciResult = new CiResult();

            var data = Db.Admins.Find(id);
            if (data != null)
            {
                try
                {
                    data.Roles.Clear();

                    foreach (var c in roleCheck)
                    {
                        if (c.IsChecked)
                        {
                            var role = Db.Roles.Find(c.Id);
                            data.Roles.Add(role);
                        }
                    }

                    Db.SaveChanges();

                    ciResult.ReturnResult = ReturnResult.Success;
                }
                catch (Exception)
                {
                    ciResult.Message = "角色修改失敗。";
                }

            }
            else
            {
                ciResult.Message = "帳號不存在,無法修改。";
            }
            return ciResult;
        }
Ejemplo n.º 25
0
 public Student()
 {
     Courses =  new List<Course>();
 }
Ejemplo n.º 26
0
		protected DialoguesXml(string contentName)
			: base(contentName)
		{
			messages = new List<Dialogue>();
		}
Ejemplo n.º 27
0
		public InGameCommands()
		{
			CommandsList = new List<Command>();
			SetInputCommands();
		}
Ejemplo n.º 28
0
 public Venue()
 {
     Courses = new List<Course>();
 }
Ejemplo n.º 29
0
        private List<int> GetMiddleColumnIfValid(Block block)
        {
            var validStartingColumns = new List<int>();
            if (IsAValidStartingColumn(block, Middle))
                validStartingColumns.Add(Middle - (int)block.Center.X);

            return validStartingColumns;
        }
Ejemplo n.º 30
0
		private List<char> RandomizeList(List<char> list)
		{
			var randomizedList = new List<char>();
			while (list.Count > 0)
			{
				int randomSelectionIndex = randomizer.Get(0, list.Count);
				randomizedList.Add(list[randomSelectionIndex]);
				list.RemoveAt(randomSelectionIndex);
			}
			return randomizedList;
		}