コード例 #1
0
        public IActionResult PopupContact(int id)
        {
            List <System.Security.Claims.Claim> c = User.Claims.Where(x => x.Type.Contains("mail")).ToList();
            string email = c[0].Value;

            ViewData["ActionID"] = id;
            return(PartialView("_ContactList", (context.GetAllUsers(email), context.GetUserGroups(email))));
        }
コード例 #2
0
        public async Task <ActionResult> GetSongGroup(string key, SongSort sort)
        {
            IGrouping <string, Track> group = default;
            bool hasPlaylists = await dataService.Exists <Playlist>(item => item.Type == (int)PlaylistTabs.Music);

            await musicService.GetSongGroups(sort).ContinueWith(task => group = task.Result.FirstOrDefault(item => item.Key == key));

            return(PartialView("~/Views/Music/SongGroup.cshtml", (Group: group, PlaylistCount: hasPlaylists)));
        }
コード例 #3
0
        public async Task <IActionResult> GetContentForLocation(int sifraGrada)
        {
            var statistike = await _context.Statistika.Include(st => st.SifraOrganizacijeNavigation).Where(s => s.SifraGrada == sifraGrada).ToListAsync();

            var putovanjaIds = _context.PutovanjeLokacija.Where(s => s.SifraGrada == sifraGrada)
                               .Select(pl => pl.SifraPutovanja);
            var putovanja = await _context.Putovanje.Include(p => p.IdentifikacijskiBrojNavigation).Join(putovanjaIds, p => p.SifraPutovanja, pi => pi, (p, pi) => p).ToListAsync();


            return(PartialView("ContentMaster", (Statistike: statistike, Putovanja: putovanja)));
        }
コード例 #4
0
        public async Task <IActionResult> ChangeVenue(long tid, CancellationToken cancellationToken)
        {
            var teamEntity = await
                             _appDb.TeamRepository.GetTeamEntityAsync(new PredicateExpression(TeamFields.Id == tid),
                                                                      cancellationToken);

            if (teamEntity == null)
            {
                return(NotFound());
            }

            return(PartialView(ViewNames.Team._ChangeVenueModalPartial, (TeamId: teamEntity.Id, VenueId: teamEntity.VenueId)));
        }
コード例 #5
0
        void LoadWebview()
        {
            WebSettings settings = PartialView.Settings;

            //启用js事件
            settings.SetSupportZoom(true);
            settings.JavaScriptEnabled = true;
            //启用js的dom缓存
            settings.DomStorageEnabled = true;
            //加载javascript接口方法,以便调用前台方法
            PartialView.AddJavascriptInterface(new AndroidScript(this, PartialView), "AndroidScript");
            PartialView.AddJavascriptInterface(new PartialScript(this, PartialView), "PartialScript");
            PartialView.AddJavascriptInterface(new BuinessScript(this, PartialView), "BuinessScript");
            PartialView.SetWebViewClient(new AgreementRouteClient($"ViewScript.RequestPartial('#MainContent','{PartialLoadForm.Replace}' ,'{Partial.Host}','{Partial.Path}',null);"));
            SetTitle("首页");


            var intColor = Resource.Color.MenuMainPanel_Background;
            var color    = GetColor(intColor);
            var setting  = new Template.Setting
            {
                Background = string.Format("#%06X", 0xFFFFFF & color),
            };

            PartialView.LoadDataWithBaseURL("file:///android_asset/", Template.Layout(setting), "text/html", "UTF-8", null);
        }
コード例 #6
0
        public override IPartialView Get(string id)
        {
            // get the relative path within the filesystem
            // (though... id should be relative already)
            var path = FileSystem.GetRelativePath(id);

            if (FileSystem.FileExists(path) == false)
            {
                return(null);
            }

            // content will be lazy-loaded when required
            var created = FileSystem.GetCreated(path).UtcDateTime;
            var updated = FileSystem.GetLastModified(path).UtcDateTime;
            //var content = GetFileContent(path);

            var view = new PartialView(ViewType, path, file => GetFileContent(file.OriginalPath))
            {
                //id can be the hash
                Id  = path.GetHashCode(),
                Key = path.EncodeAsGuid(),
                //Content = content,
                CreateDate  = created,
                UpdateDate  = updated,
                VirtualPath = FileSystem.GetUrl(id)
            };

            //on initial construction we don't want to have dirty properties tracked
            // http://issues.umbraco.org/issue/U4-1946
            view.ResetDirtyProperties(false);

            return(view);
        }
コード例 #7
0
        public HttpResponseMessage PostCreate(string type, CodeFileDisplay display)
        {
            if (display == null)
            {
                throw new ArgumentNullException("display");
            }
            if (string.IsNullOrWhiteSpace(type))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", "type");
            }

            switch (type)
            {
            case Core.Constants.Trees.PartialViews:
                var view = new PartialView(PartialViewType.PartialView, display.VirtualPath);
                view.Content = display.Content;
                var result = Services.FileService.CreatePartialView(view, display.Snippet, Security.CurrentUser.Id);
                return(result.Success == true?Request.CreateResponse(HttpStatusCode.OK) : Request.CreateNotificationValidationErrorResponse(result.Exception.Message));

            case Core.Constants.Trees.PartialViewMacros:
                var viewMacro = new PartialView(PartialViewType.PartialViewMacro, display.VirtualPath);
                viewMacro.Content = display.Content;
                var resultMacro = Services.FileService.CreatePartialViewMacro(viewMacro, display.Snippet, Security.CurrentUser.Id);
                return(resultMacro.Success == true?Request.CreateResponse(HttpStatusCode.OK) : Request.CreateNotificationValidationErrorResponse(resultMacro.Exception.Message));

            case Core.Constants.Trees.Scripts:
                var script = new Script(display.VirtualPath);
                Services.FileService.SaveScript(script, Security.CurrentUser.Id);
                return(Request.CreateResponse(HttpStatusCode.OK));

            default:
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }
        }
コード例 #8
0
        /// <summary>
        /// Helper method to take care of persisting partial views or partial view macros - so we're not duplicating the same logic
        /// </summary>
        /// <param name="display"></param>
        /// <param name="systemDirectory"></param>
        /// <param name="getView"></param>
        /// <param name="saveView"></param>
        /// <param name="createView"></param>
        /// <returns></returns>
        private Attempt <IPartialView> CreateOrUpdatePartialView(
            CodeFileDisplay display, string systemDirectory,
            Func <string, IPartialView> getView,
            Func <IPartialView, int, Attempt <IPartialView> > saveView,
            Func <IPartialView, string, int, Attempt <IPartialView> > createView)
        {
            //must always end with the correct extension
            display.Name = EnsureCorrectFileExtension(display.Name, ".cshtml");

            Attempt <IPartialView> partialViewResult;
            var virtualPath = NormalizeVirtualPath(display.VirtualPath, systemDirectory);
            var view        = getView(virtualPath);

            if (view != null)
            {
                // might need to find the path
                var orgPath = view.OriginalPath.Substring(0, view.OriginalPath.IndexOf(view.Name));
                view.Path = orgPath + display.Name;

                view.Content      = display.Content;
                partialViewResult = saveView(view, Security.CurrentUser.Id);
            }
            else
            {
                view              = new PartialView(PartialViewType.PartialView, virtualPath + display.Name);
                view.Content      = display.Content;
                partialViewResult = createView(view, display.Snippet, Security.CurrentUser.Id);
            }

            return(partialViewResult);
        }
コード例 #9
0
 public bool ValidatePartialViewMacro(PartialView partialView)
 {
     using (var scope = ScopeProvider.CreateScope(autoComplete: true))
     {
         return(_partialViewMacroRepository.ValidatePartialView(partialView));
     }
 }
コード例 #10
0
        public async Task <IActionResult> GetDeleteModal(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var user = await _context.Users.Where(x => x.RoleId != 3).FirstOrDefaultAsync(m => m.Id.Equals(id));

            if (user == null)
            {
                return(NotFound());
            }

            return(PartialView("_DeleteModal", (user.Name, user.Id, "Users")));
        }
コード例 #11
0
ファイル: PartitionableList.cs プロジェクト: olesar/Altaxo
        /// <summary>
        /// Creates the partial view that consisist of elements of type M that fullfil a condition provided by the argument <paramref name="selectionCriterium"/>.
        /// </summary>
        /// <typeparam name="M">Type of the elements of the partial view.</typeparam>
        /// <param name="selectionCriterium">The selection criterium. If this function applied to an element returns <c>true</c>, this element is included into the partial view.</param>
        /// <param name="actionBeforeInsertion">Action that is called before elements are included into the partial view. Note that this action is executed only if items are directly added into the partial view,
        /// but it is not executed if items are indirectly included into the partial view by adding items that fullfil the selection criterium to the parent list.</param>
        /// <returns></returns>
        public IObservableList <M> CreatePartialViewOfType <M>(Func <M, bool> selectionCriterium, Action <M> actionBeforeInsertion) where M : T
        {
            var result = new PartialView <M>(this, x => (x is M) && selectionCriterium((M)x), actionBeforeInsertion);

            _partialViews.AddLast(new WeakReference(result));
            return(result);
        }
コード例 #12
0
ファイル: PartitionableList.cs プロジェクト: olesar/Altaxo
        /// <summary>
        /// Creates a partial view. A partial view is a view of the list of items of the original collection, that fulfill a certain condition.
        /// </summary>
        /// <param name="selectionCriterium">
        /// The selection condition.
        /// If this function returns <c>true</c> on an item of the original collection, that item is member of the partial view.
        /// Note that during the lifetime of the partition, the behaviour of the selection criterion must not change.
        /// </param>
        /// <returns>List of items of the original collection, that fullfils the selection condition. The returned list is automatically updated, when the original collection changed or when
        /// the user changed the partial view itself.</returns>
        public IObservableList <T> CreatePartialView(Func <T, bool> selectionCriterium)
        {
            var result = new PartialView <T>(this, selectionCriterium);

            _partialViews.AddLast(new WeakReference(result));
            return(result);
        }
コード例 #13
0
        public ActionResult Postdata(PartialView partialView)
        {
            var redirectUrl = new UrlHelper(Request.RequestContext).Action("Postdata", "Home", new { });

            try
            {
                if (ModelState.IsValid)
                {
                    entities.PartialViews.Add(partialView);
                    entities.SaveChanges();
                    partialView.partialviewDBItems = entities.PartialViews.ToList();
                    //return RedirectToAction("Postdata");
                    // return View(partialView);
                    //return Json(new { Url = redirectUrl });
                }
                //return View();
            }
            catch (Exception ex)
            {
                return(Json(new { Url = redirectUrl, status = "Error" }));

                throw new Exception(ex.Message);
            }

            return(Json(new { Url = redirectUrl, status = "OK" }));
        }
コード例 #14
0
ファイル: PartitionableList.cs プロジェクト: olesar/Altaxo
        /// <summary>
        /// Creates the partial view that consists of all elements in the original collection that are of type M.
        /// </summary>
        /// <typeparam name="M">Type of the elements of the partial view.</typeparam>
        /// <param name="actionBeforeInsertion">Action that is executed on an item before it is inserted.</param>
        /// <returns>View of all elements of type M of the original collection.</returns>
        public IObservableList <M> CreatePartialViewOfType <M>(Action <M> actionBeforeInsertion) where M : T
        {
            var result = new PartialView <M>(this, x => x is M, actionBeforeInsertion);

            _partialViews.AddLast(new WeakReference(result));
            return(result);
        }
コード例 #15
0
        public async Task <IActionResult> GetDeleteModal(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var company = await _context.Companies.FirstOrDefaultAsync(m => m.Id == id);

            if (company == null)
            {
                return(NotFound());
            }

            return(PartialView("_DeleteModal", (company.Name, company.Id, "Companies")));
        }
コード例 #16
0
 public bool ValidatePartialViewMacro(PartialView partialView)
 {
     using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
     {
         var repository = RepositoryFactory.CreatePartialViewMacroRepository(uow);
         return(repository.ValidatePartialView(partialView));
     }
 }
コード例 #17
0
 public bool ValidatePartialViewMacro(PartialView partialView)
 {
     var uow = _dataUowProvider.GetUnitOfWork();
     using (var repository = _repositoryFactory.CreatePartialViewMacroRepository(uow))
     {
         return repository.ValidatePartialView(partialView);
     }
 }
コード例 #18
0
        public async Task <IActionResult> GetLokacijaAddEdit(int sifraGrada)
        {
            Lokacija lokacija;

            if (sifraGrada > 0)
            {
                lokacija = await _context.Lokacija.FirstAsync(g => g.SifraGrada == sifraGrada);
            }
            else
            {
                lokacija = new Lokacija();
            }

            var drzave = await _context.Drzava.OrderBy(d => d.ImeDrzave).Select(d => new { d.ImeDrzave, d.SifraDrzave }).ToListAsync();

            return(PartialView("LocationEditMaster", (Lokacija: lokacija, drzave: new SelectList(drzave, nameof(Drzava.SifraDrzave), nameof(Drzava.ImeDrzave)))));
        }
コード例 #19
0
    public ActionResult <CodeFileDisplay> PostCreate(string type, CodeFileDisplay display)
    {
        if (display == null)
        {
            throw new ArgumentNullException("display");
        }

        if (string.IsNullOrWhiteSpace(type))
        {
            throw new ArgumentException("Value cannot be null or whitespace.", "type");
        }

        IUser?currentUser = _backOfficeSecurityAccessor.BackOfficeSecurity?.CurrentUser;

        switch (type)
        {
        case Constants.Trees.PartialViews:
            var view = new PartialView(PartialViewType.PartialView, display.VirtualPath ?? string.Empty)
            {
                Content = display.Content,
            };
            Attempt <IPartialView?> result = _fileService.CreatePartialView(view, display.Snippet, currentUser?.Id);
            if (result.Success)
            {
                return(Ok());
            }

            return(ValidationProblem(result.Exception?.Message));

        case Constants.Trees.PartialViewMacros:
            var viewMacro = new PartialView(PartialViewType.PartialViewMacro, display.VirtualPath ?? string.Empty)
            {
                Content = display.Content,
            };
            Attempt <IPartialView?> resultMacro =
                _fileService.CreatePartialViewMacro(viewMacro, display.Snippet, currentUser?.Id);
            if (resultMacro.Success)
            {
                return(Ok());
            }

            return(ValidationProblem(resultMacro.Exception?.Message));

        case Constants.Trees.Scripts:
            var script = new Script(display.VirtualPath ?? string.Empty);
            _fileService.SaveScript(script, currentUser?.Id);
            return(Ok());

        default:
            return(NotFound());
        }
    }
コード例 #20
0
//        [HttpPost]
//        public ActionResult Cancel( //parameters here )
//{
//            var redirectUrl = new UrlHelper(Request.RequestContext).Action("Index", "user", new { });

//            try
//            {
//                // perform some action
//            }
//            catch (Exception)
//            {
//                return Json(new { Url = redirectUrl, status = "Error" });
//            }

//            return Json(new { Url = redirectUrl, status = "OK" });
//        }

        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PartialView partialView = entities.PartialViews.Find(id);

            if (partialView == null)
            {
                return(HttpNotFound());
            }
            return(View(partialView));
        }
コード例 #21
0
 public ActionResult Postdata()
 {
     try
     {
         ViewBag.Message = "Welcome to my demo!";
         PartialView partialView = new PartialView();
         partialView.partialviewDBItems = entities.PartialViews.ToList();
         return(View(partialView));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
コード例 #22
0
 public ActionResult DeleteConfirmed(int?id)
 {
     try
     {
         PartialView partialView = entities.PartialViews.Find(id);
         entities.PartialViews.Remove(partialView);
         entities.SaveChanges();
         return(RedirectToAction("Postdata"));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
コード例 #23
0
 public ActionResult Details(int?id)
 {
     try
     {
         if (id == null)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         PartialView partialView = entities.PartialViews.Find(id);
         if (partialView == null)
         {
             return(HttpNotFound());
         }
         return(View(partialView));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
コード例 #24
0
        public override bool PerformSave()
        {
            var pipesIndex  = Alias.IndexOf("|||", StringComparison.Ordinal);
            var snippetName = Alias.Substring(0, pipesIndex).Trim();
            var fileName    = Alias.Substring(pipesIndex + 3, Alias.Length - pipesIndex - 3);

            if (fileName.ToLowerInvariant().EndsWith(".cshtml") == false)
            {
                fileName += ".cshtml";
            }

            var model        = new PartialView(fileName);
            var fileService  = (FileService)ApplicationContext.Current.Services.FileService;
            var macroService = ApplicationContext.Current.Services.MacroService;

            if (IsPartialViewMacro == false)
            {
                var attempt = fileService.CreatePartialView(model, snippetName, User.Id);
                _returnUrl = string.Format("settings/views/EditView.aspx?treeType=partialViews&file={0}", model.Path.TrimStart('/'));
                return(attempt.Success);
            }
            else
            {
                var attempt = fileService.CreatePartialViewMacro(model, /*ParentID == 1,*/ snippetName, User.Id);
                // if ParentId = 0 then that means that the "Create macro" checkbox was OFF, so don't try to create an actual macro
                // See PartialViewMacro.ascx.cs and PartialView.ascx.cs: SubmitButton_Click
                if (attempt && ParentID != 0)
                {
                    //The partial view path to be saved with the macro must be a fully qualified virtual path
                    var virtualPath = string.Format("{0}/{1}/{2}", SystemDirectories.MvcViews, "MacroPartials", attempt.Result.Path);
                    macroService.Save(new Macro(attempt.Result.Alias, attempt.Result.Alias)
                    {
                        ScriptPath = virtualPath
                    });
                }

                _returnUrl = string.Format("settings/views/EditView.aspx?treeType=partialViewMacros&file={0}", model.Path.TrimStart('/'));
                return(attempt.Success);
            }
        }
コード例 #25
0
    public override IPartialView?Get(string?id)
    {
        if (FileSystem is null)
        {
            return(null);
        }

        // get the relative path within the filesystem
        // (though... id should be relative already)
        var path = FileSystem.GetRelativePath(id !);

        if (FileSystem.FileExists(path) == false)
        {
            return(null);
        }

        // content will be lazy-loaded when required
        DateTime created = FileSystem.GetCreated(path).UtcDateTime;
        DateTime updated = FileSystem.GetLastModified(path).UtcDateTime;

        // var content = GetFileContent(path);
        var view = new PartialView(ViewType, path, file => GetFileContent(file.OriginalPath))
        {
            // id can be the hash
            Id  = path.GetHashCode(),
            Key = path.EncodeAsGuid(),

            // Content = content,
            CreateDate  = created,
            UpdateDate  = updated,
            VirtualPath = FileSystem.GetUrl(id),
        };

        // reset dirty initial properties (U4-1946)
        view.ResetDirtyProperties(false);

        return(view);
    }
コード例 #26
0
        public ActionResult Edit(PartialView partialView)//[Bind(Include = "CustomerID,CustomerName,ContactMidName,PhoneNumber,EmailID,Password,ConfirmPassword")]Customer customer
        {
            var redirectUrl1 = new UrlHelper(Request.RequestContext).Action("Postdata", "Home", new { });

            try
            {
                if (ModelState.IsValid)
                {
                    //PartialView partialView = new PartialView();
                    UpdateModel(partialView);//UpdateModel<Customer>(customers);
                    entities.Entry(partialView).State = EntityState.Modified;
                    entities.SaveChanges();
                    partialView.partialviewDBItems = entities.PartialViews.ToList();
                }
            }
            catch (Exception ex)
            {
                return(Json(new { Url = redirectUrl1, status = "Error" }));

                throw new Exception(ex.Message);
            }
            return(Json(new { Url = redirectUrl1, status = "OK" }));
        }
コード例 #27
0
        public void PathTests()
        {
            // unless noted otherwise, no changes / 7.2.8

            var fileSystems = Mock.Of <IFileSystems>();

            Mock.Get(fileSystems).Setup(x => x.PartialViewsFileSystem).Returns(_fileSystem);

            var provider = TestObjects.GetScopeProvider(Logger);

            using (var scope = provider.CreateScope())
            {
                var repository = new PartialViewRepository(fileSystems);

                var partialView = new PartialView(PartialViewType.PartialView, "test-path-1.cshtml")
                {
                    Content = "// partialView"
                };
                repository.Save(partialView);
                Assert.IsTrue(_fileSystem.FileExists("test-path-1.cshtml"));
                Assert.AreEqual("test-path-1.cshtml", partialView.Path);
                Assert.AreEqual("/Views/Partials/test-path-1.cshtml", partialView.VirtualPath);

                partialView = new PartialView(PartialViewType.PartialView, "path-2/test-path-2.cshtml")
                {
                    Content = "// partialView"
                };
                repository.Save(partialView);
                Assert.IsTrue(_fileSystem.FileExists("path-2/test-path-2.cshtml"));
                Assert.AreEqual("path-2\\test-path-2.cshtml", partialView.Path); // fixed in 7.3 - 7.2.8 does not update the path
                Assert.AreEqual("/Views/Partials/path-2/test-path-2.cshtml", partialView.VirtualPath);

                partialView = (PartialView)repository.Get("path-2/test-path-2.cshtml");
                Assert.IsNotNull(partialView);
                Assert.AreEqual("path-2\\test-path-2.cshtml", partialView.Path);
                Assert.AreEqual("/Views/Partials/path-2/test-path-2.cshtml", partialView.VirtualPath);

                partialView = new PartialView(PartialViewType.PartialView, "path-2\\test-path-3.cshtml")
                {
                    Content = "// partialView"
                };
                repository.Save(partialView);
                Assert.IsTrue(_fileSystem.FileExists("path-2/test-path-3.cshtml"));
                Assert.AreEqual("path-2\\test-path-3.cshtml", partialView.Path);
                Assert.AreEqual("/Views/Partials/path-2/test-path-3.cshtml", partialView.VirtualPath);

                partialView = (PartialView)repository.Get("path-2/test-path-3.cshtml");
                Assert.IsNotNull(partialView);
                Assert.AreEqual("path-2\\test-path-3.cshtml", partialView.Path);
                Assert.AreEqual("/Views/Partials/path-2/test-path-3.cshtml", partialView.VirtualPath);

                partialView = (PartialView)repository.Get("path-2\\test-path-3.cshtml");
                Assert.IsNotNull(partialView);
                Assert.AreEqual("path-2\\test-path-3.cshtml", partialView.Path);
                Assert.AreEqual("/Views/Partials/path-2/test-path-3.cshtml", partialView.VirtualPath);

                partialView = new PartialView(PartialViewType.PartialView, "\\test-path-4.cshtml")
                {
                    Content = "// partialView"
                };
                Assert.Throws <UnauthorizedAccessException>(() => // fixed in 7.3 - 7.2.8 used to strip the \
                {
                    repository.Save(partialView);
                });

                partialView = (PartialView)repository.Get("missing.cshtml");
                Assert.IsNull(partialView);

                // fixed in 7.3 - 7.2.8 used to...
                Assert.Throws <UnauthorizedAccessException>(() =>
                {
                    partialView = (PartialView)repository.Get("\\test-path-4.cshtml");  // outside the filesystem, does not exist
                });
                Assert.Throws <UnauthorizedAccessException>(() =>
                {
                    partialView = (PartialView)repository.Get("../../packages.config");  // outside the filesystem, exists
                });
            }
        }
コード例 #28
0
        public ApplicationCanvas()
        {
            Width = DefaultWidth;
            Height = DefaultHeight;


            this.Background = Brushes.Blue;

            var left = new PartialView(Colors.Blue, true).AttachTo(this);
            var right = new PartialView(Colors.Green).AttachTo(this).MoveTo(DefaultWidth / 2, 0);

            this.InfoOverlay = new Canvas().AttachTo(this);

            this.About = new TextBox
            {
                BorderThickness = new Thickness(0),
                Background = Brushes.Transparent,
                Foreground = Brushes.Black,
                AcceptsReturn = true,

                Text =

@"Windows Presentation Foundation Touch demo
- Debuggable under .NET (fullscreen when maximized and touch events)
- Adobe Flash 10.1 version via jsc
     No touch events in fullscreen
     Browser fullscreen feature shall be used instead
     Tested for IE, Firefox, Chrome

- Javascript version for Firefox4 via jsc
- Tested with 4 touch points on Dell Latitude XT
- Galaxy S/ Galaxy Tab within browser have only 1 touchpoint
- 2012.09 flash no longer available on android
- multitouch seems to work in firefox/ flash (11.0)
- multitouch seems to work in ie/flash (10.0)
- p2p LAN no longer works?
- Works on AIR for Android! :) 2013-03-05
- Works on AIR for iPad! :) 2014-03-01
"


            }.AttachTo(InfoOverlay).MoveTo(128, 32);

            var c1 = new cloud_mid().AttachTo(InfoOverlay);
            var c2 = new cloud_mid().AttachTo(InfoOverlay);


            this.TouchOverlay = new Canvas
            {



            }.AttachTo(this); //.SizeTo(DefaultWidth, DefaultHeight);

            var TouchArea = new Rectangle
            {
                Width = DefaultWidth,
                Height = DefaultHeight,
                Fill = Brushes.White,
                Opacity = 0
            }.AttachTo(TouchOverlay);


            var t = TouchOverlay.ToTouchEvents(
                m =>
                {
                    // a new reusable finger introduced by the system!
                    var Content = new Canvas();

                    new Avalon.Images.white_jsc().AttachTo(Content).MoveTo(
                        Avalon.Images.white_jsc.ImageDefaultWidth / -2,
                        Avalon.Images.white_jsc.ImageDefaultHeight / -2
                    );

                    var CurrentTouchPoint = default(Tuple<double, double>);

                    Func<Tuple<double, double>> GetTouchPoint = () => CurrentTouchPoint;

                    m.TouchDown += e =>
                    {
                        var p = e.GetTouchPoint(TouchOverlay).Position;

                        CurrentTouchPoint = Tuple.Create(p.X, p.Y);
                        Content.AttachTo(InfoOverlay);
                    };

                    m.TouchUp += e =>
                    {
                        CurrentTouchPoint = null;
                        Content.Orphanize();
                    };

                    m.TouchMove += e =>
                    {
                        var p = e.GetTouchPoint(TouchOverlay).Position;

                        CurrentTouchPoint = Tuple.Create(p.X, p.Y);



                        Content.MoveTo(e, TouchOverlay);
                    };


                    // this is what will be visible for the rest.
                    return new
                    {
                        Content,
                        GetTouchPoint,
                    };
                }
            );




            var touches = from k in t.Touches
                          let p = k.GetTouchPoint()
                          where p != null
                          let x = p.Item1
                          let y = p.Item2
                          select new { x, y, touch = k };

            var left_touch = from k in touches
                             let x = k.x
                             let y = k.y
                             where x < 64
                             where y > Height - 64
                             select k;




            var RocketsPending = new Dictionary<object, Canvas>();

            var buildmode_touches =
                from c in left_touch.Take(1)
                from k in touches
                where k.y < Height - 64

                // um, this finger already seems to have a pending rocket...
                where !RocketsPending.ContainsKey(k.touch)

                select k;

            var RocketsPendingToUpdate =
                from c in touches
                where RocketsPending.ContainsKey(c.touch)
                let rocket = RocketsPending[c.touch]
                let Update = new Action(() => rocket.MoveTo(c.x, c.y))
                select new { rocket, c, Update };

            var __left_buildmode = false;


            #region NotifyBuildRocket
            this.NotifyBuildRocket =
                (x, y) =>
                {
                    #region create a pending rocket
                    var n = new { Content = new Canvas().AttachTo(InfoOverlay) };

                    //Tuple

                    var i = new Avalon.Images.rocket
                    {

                    }.AttachTo(n.Content).MoveTo(
                       Avalon.Images.rocket.ImageDefaultWidth / -4,
                       Avalon.Images.rocket.ImageDefaultHeight / -4
                   ).SizeTo(
                       Avalon.Images.rocket.ImageDefaultWidth / 2,
                       Avalon.Images.rocket.ImageDefaultHeight / 2
                   );


                    // hold/build!
                    //i.Opacity = 0.5;
                    n.Content.MoveTo(x, y);
                    MultitouchExample.Sounds.launch.Source.PlaySound();
                    n.Content.AccelerateAndFade();
                    #endregion
                };
            #endregion




            #region VisualizeTouch
            Action<double, double> VisualizeTouch = (x, y) =>
            {
                var n = new { Content = new Canvas().AttachTo(InfoOverlay) };

                //Tuple

                new Avalon.Images.white_jsc
                {

                }.AttachTo(n.Content).MoveTo(
                   Avalon.Images.white_jsc.ImageDefaultWidth / -4,
                   Avalon.Images.white_jsc.ImageDefaultHeight / -4
               ).SizeTo(
                   Avalon.Images.white_jsc.ImageDefaultWidth / 2,
                   Avalon.Images.white_jsc.ImageDefaultHeight / 2
               );

                n.Content.FadeOut();

                n.Content.MoveTo(x, y);
            };

            this.NotifyVisualizeTouch = VisualizeTouch;
            #endregion



            #region MouseLeftButtonUp
            TouchOverlay.MouseLeftButtonUp +=
                (sender, args) =>
                {
                    // um this device has no finger support?
                    // 2014! less tech?

                    var p = args.GetPosition(TouchOverlay);
                    var item = new { x = p.X, y = p.Y };


                    #region create a pending rocket
                    var n = new { Content = new Canvas().AttachTo(InfoOverlay) };

                    //Tuple

                    var rocket = new Avalon.Images.rocket
                    {

                    }.AttachTo(n.Content).MoveTo(
                       Avalon.Images.rocket.ImageDefaultWidth / -4,
                       Avalon.Images.rocket.ImageDefaultHeight / -4
                   ).SizeTo(
                       Avalon.Images.rocket.ImageDefaultWidth / 2,
                       Avalon.Images.rocket.ImageDefaultHeight / 2
                   );


                    // hold/build!
                    //i.Opacity = 0.5;
                    n.Content.Opacity = 0.5;
                    n.Content.MoveTo(item.x, item.y);
                    #endregion

                    MultitouchExample.Sounds.launch.Source.PlaySound();

                    rocket.Opacity = 1;
                    rocket.AccelerateAndFade();

                    //RocketsPending.Remove(item.touch);

                    if (AtNotifyBuildRocket != null)
                        AtNotifyBuildRocket(item.x, item.y);

                };
            #endregion

            (1000 / 15).AtInterval(
                delegate
                {


                    #region visualize all touches
                    foreach (var item in touches)
                    {
                        VisualizeTouch(item.x, item.y);

                        if (this.AtNotifyVisualizeTouch != null)
                            this.AtNotifyVisualizeTouch(item.x, item.y);
                    }
                    #endregion

                    foreach (var item in
                        from k in t.Touches
                        where k.GetTouchPoint() == null
                        where RocketsPending.ContainsKey(k)
                        select new { rocket = RocketsPending[k], touch = k }
                        )
                    {
                        // finger was lifted and rocked should be launched
                        // no sound in .net
                        // and NO fingers in this laptop!!!! 2014 
                        MultitouchExample.Sounds.launch.Source.PlaySound();

                        item.rocket.Opacity = 1;
                        item.rocket.AccelerateAndFade();

                        RocketsPending.Remove(item.touch);

                        if (AtNotifyBuildRocket != null)
                            AtNotifyBuildRocket(Canvas.GetLeft(item.rocket), Canvas.GetTop(item.rocket));
                    }

                    var left_buildmode = left_touch.Any();
                    if (left_buildmode)
                    {
                        if (!__left_buildmode)
                        {
                            MultitouchExample.Sounds.building.Source.PlaySound();
                            // sound: build mode engaged!
                        }

                        // all other touches in range are now build orders!

                        foreach (var item in RocketsPendingToUpdate)
                        {
                            item.Update();
                        }

                        #region build
                        foreach (var item in buildmode_touches)
                        {
                            #region create a pending rocket
                            var n = new { Content = new Canvas().AttachTo(InfoOverlay) };

                            //Tuple

                            var i = new Avalon.Images.rocket
                            {

                            }.AttachTo(n.Content).MoveTo(
                               Avalon.Images.rocket.ImageDefaultWidth / -4,
                               Avalon.Images.rocket.ImageDefaultHeight / -4
                           ).SizeTo(
                               Avalon.Images.rocket.ImageDefaultWidth / 2,
                               Avalon.Images.rocket.ImageDefaultHeight / 2
                           );


                            // hold/build!
                            //i.Opacity = 0.5;
                            n.Content.Opacity = 0.5;
                            n.Content.MoveTo(item.x, item.y);
                            #endregion

                            RocketsPending[item.touch] = n.Content;


                            //n.Content.AccelerateAndFade();
                        }
                        #endregion


                        left.buildmode_off.Hide();
                        left.buildmode_on.Show();
                    }
                    else
                    {
                        left.buildmode_on.Hide();
                        left.buildmode_off.Show();
                    }
                    __left_buildmode = left_buildmode;
                }
            );

            #region SizeChanged


            Action SizeChanged =
                delegate
                {
                    c1.MoveTo(
    (Width - c1.Width) / 2, 0);

                    c2.MoveTo(
                        (Width - c1.Width) / 2, Height / 2);

                    left.SizeTo(

                        Width / 2,
                        Height
                    );


                    right.MoveTo(
                        Width / 2, 0).SizeTo(

                        Width / 2,
                        Height
                    );

                    TouchArea.SizeTo(Width, Height);
                };

            this.SizeChanged +=
                (s, e) =>
                {
                    SizeChanged();
                };

            SizeChanged();
            #endregion


        }
コード例 #29
0
        public void PathTests()
        {
            // unless noted otherwise, no changes / 7.2.8

            var provider   = new FileUnitOfWorkProvider();
            var unitOfWork = provider.GetUnitOfWork();
            var repository = new PartialViewRepository(unitOfWork, _fileSystem);

            var partialView = new PartialView("test-path-1.cshtml")
            {
                Content = "// partialView"
            };

            repository.AddOrUpdate(partialView);
            unitOfWork.Commit();
            Assert.IsTrue(_fileSystem.FileExists("test-path-1.cshtml"));
            Assert.AreEqual("test-path-1.cshtml", partialView.Path);
            Assert.AreEqual("/Views/Partials/test-path-1.cshtml", partialView.VirtualPath);

            partialView = new PartialView("path-2/test-path-2.cshtml")
            {
                Content = "// partialView"
            };
            repository.AddOrUpdate(partialView);
            unitOfWork.Commit();
            Assert.IsTrue(_fileSystem.FileExists("path-2/test-path-2.cshtml"));
            Assert.AreEqual("path-2\\test-path-2.cshtml", partialView.Path); // fixed in 7.3 - 7.2.8 does not update the path
            Assert.AreEqual("/Views/Partials/path-2/test-path-2.cshtml", partialView.VirtualPath);

            partialView = (PartialView)repository.Get("path-2/test-path-2.cshtml");
            Assert.IsNotNull(partialView);
            Assert.AreEqual("path-2\\test-path-2.cshtml", partialView.Path);
            Assert.AreEqual("/Views/Partials/path-2/test-path-2.cshtml", partialView.VirtualPath);

            partialView = new PartialView("path-2\\test-path-3.cshtml")
            {
                Content = "// partialView"
            };
            repository.AddOrUpdate(partialView);
            unitOfWork.Commit();
            Assert.IsTrue(_fileSystem.FileExists("path-2/test-path-3.cshtml"));
            Assert.AreEqual("path-2\\test-path-3.cshtml", partialView.Path);
            Assert.AreEqual("/Views/Partials/path-2/test-path-3.cshtml", partialView.VirtualPath);

            partialView = (PartialView)repository.Get("path-2/test-path-3.cshtml");
            Assert.IsNotNull(partialView);
            Assert.AreEqual("path-2\\test-path-3.cshtml", partialView.Path);
            Assert.AreEqual("/Views/Partials/path-2/test-path-3.cshtml", partialView.VirtualPath);

            partialView = (PartialView)repository.Get("path-2\\test-path-3.cshtml");
            Assert.IsNotNull(partialView);
            Assert.AreEqual("path-2\\test-path-3.cshtml", partialView.Path);
            Assert.AreEqual("/Views/Partials/path-2/test-path-3.cshtml", partialView.VirtualPath);

            partialView = new PartialView("\\test-path-4.cshtml")
            {
                Content = "// partialView"
            };
            Assert.Throws <FileSecurityException>(() => // fixed in 7.3 - 7.2.8 used to strip the \
            {
                repository.AddOrUpdate(partialView);
            });

            partialView = (PartialView)repository.Get("missing.cshtml");
            Assert.IsNull(partialView);

            // fixed in 7.3 - 7.2.8 used to...
            Assert.Throws <FileSecurityException>(() =>
            {
                partialView = (PartialView)repository.Get("\\test-path-4.cshtml");  // outside the filesystem, does not exist
            });
            Assert.Throws <FileSecurityException>(() =>
            {
                partialView = (PartialView)repository.Get("../../packages.config");  // outside the filesystem, exists
            });
        }
コード例 #30
0
        public void PathTests()
        {
            // unless noted otherwise, no changes / 7.2.8
            FileSystems fileSystems = FileSystemsCreator.CreateTestFileSystems(LoggerFactory, IOHelper,
                                                                               GetRequiredService <IOptions <GlobalSettings> >(), HostingEnvironment,
                                                                               null, _fileSystem, null, null, null);

            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                var repository = new PartialViewRepository(fileSystems);

                var partialView = new PartialView(PartialViewType.PartialView, "test-path-1.cshtml")
                {
                    Content = "// partialView"
                };
                repository.Save(partialView);
                Assert.IsTrue(_fileSystem.FileExists("test-path-1.cshtml"));
                Assert.AreEqual("test-path-1.cshtml", partialView.Path);
                Assert.AreEqual("/Views/Partials/test-path-1.cshtml", partialView.VirtualPath);

                partialView = new PartialView(PartialViewType.PartialView, "path-2/test-path-2.cshtml")
                {
                    Content = "// partialView"
                };
                repository.Save(partialView);
                Assert.IsTrue(_fileSystem.FileExists("path-2/test-path-2.cshtml"));
                Assert.AreEqual("path-2\\test-path-2.cshtml".Replace("\\", $"{Path.DirectorySeparatorChar}"), partialView.Path); // fixed in 7.3 - 7.2.8 does not update the path
                Assert.AreEqual("/Views/Partials/path-2/test-path-2.cshtml", partialView.VirtualPath);

                partialView = (PartialView)repository.Get("path-2/test-path-2.cshtml");
                Assert.IsNotNull(partialView);
                Assert.AreEqual("path-2\\test-path-2.cshtml".Replace("\\", $"{Path.DirectorySeparatorChar}"), partialView.Path);
                Assert.AreEqual("/Views/Partials/path-2/test-path-2.cshtml", partialView.VirtualPath);

                partialView = new PartialView(PartialViewType.PartialView, "path-2\\test-path-3.cshtml")
                {
                    Content = "// partialView"
                };
                repository.Save(partialView);
                Assert.IsTrue(_fileSystem.FileExists("path-2/test-path-3.cshtml"));
                Assert.AreEqual("path-2\\test-path-3.cshtml".Replace("\\", $"{Path.DirectorySeparatorChar}"), partialView.Path);
                Assert.AreEqual("/Views/Partials/path-2/test-path-3.cshtml", partialView.VirtualPath);

                partialView = (PartialView)repository.Get("path-2/test-path-3.cshtml");
                Assert.IsNotNull(partialView);
                Assert.AreEqual("path-2\\test-path-3.cshtml".Replace("\\", $"{Path.DirectorySeparatorChar}"), partialView.Path);
                Assert.AreEqual("/Views/Partials/path-2/test-path-3.cshtml", partialView.VirtualPath);

                partialView = (PartialView)repository.Get("path-2\\test-path-3.cshtml");
                Assert.IsNotNull(partialView);
                Assert.AreEqual("path-2\\test-path-3.cshtml".Replace("\\", $"{Path.DirectorySeparatorChar}"), partialView.Path);
                Assert.AreEqual("/Views/Partials/path-2/test-path-3.cshtml", partialView.VirtualPath);

                partialView = new PartialView(PartialViewType.PartialView, "\\test-path-4.cshtml")
                {
                    Content = "// partialView"
                };
                Assert.Throws <UnauthorizedAccessException>(() => // fixed in 7.3 - 7.2.8 used to strip the \
                                                            repository.Save(partialView));

                partialView = (PartialView)repository.Get("missing.cshtml");
                Assert.IsNull(partialView);

                // fixed in 7.3 - 7.2.8 used to...
                Assert.Throws <UnauthorizedAccessException>(() => partialView = (PartialView)repository.Get("\\test-path-4.cshtml"));
                Assert.Throws <UnauthorizedAccessException>(() => partialView = (PartialView)repository.Get("../../packages.config"));
            }
        }
コード例 #31
0
        public ApplicationCanvas()
        {
            Width  = DefaultWidth;
            Height = DefaultHeight;


            this.Background = Brushes.Blue;

            var left  = new PartialView(Colors.Blue, true).AttachTo(this);
            var right = new PartialView(Colors.Green).AttachTo(this).MoveTo(DefaultWidth / 2, 0);

            this.InfoOverlay = new Canvas().AttachTo(this);

            this.About = new TextBox
            {
                BorderThickness = new Thickness(0),
                Background      = Brushes.Transparent,
                Foreground      = Brushes.Black,
                AcceptsReturn   = true,

                Text =

                    @"Windows Presentation Foundation Touch demo
- Debuggable under .NET (fullscreen when maximized and touch events)
- Adobe Flash 10.1 version via jsc
     No touch events in fullscreen
     Browser fullscreen feature shall be used instead
     Tested for IE, Firefox, Chrome

- Javascript version for Firefox4 via jsc
- Tested with 4 touch points on Dell Latitude XT
- Galaxy S/ Galaxy Tab within browser have only 1 touchpoint
- 2012.09 flash no longer available on android
- multitouch seems to work in firefox/ flash (11.0)
- multitouch seems to work in ie/flash (10.0)
- p2p LAN no longer works?
- Works on AIR for Android! :) 2013-03-05
- Works on AIR for iPad! :) 2014-03-01
"
            }.AttachTo(InfoOverlay).MoveTo(128, 32);

            var c1 = new cloud_mid().AttachTo(InfoOverlay);
            var c2 = new cloud_mid().AttachTo(InfoOverlay);


            this.TouchOverlay = new Canvas
            {
            }.AttachTo(this); //.SizeTo(DefaultWidth, DefaultHeight);

            var TouchArea = new Rectangle
            {
                Width   = DefaultWidth,
                Height  = DefaultHeight,
                Fill    = Brushes.White,
                Opacity = 0
            }.AttachTo(TouchOverlay);


            var t = TouchOverlay.ToTouchEvents(
                m =>
            {
                // a new reusable finger introduced by the system!
                var Content = new Canvas();

                new Avalon.Images.white_jsc().AttachTo(Content).MoveTo(
                    Avalon.Images.white_jsc.ImageDefaultWidth / -2,
                    Avalon.Images.white_jsc.ImageDefaultHeight / -2
                    );

                var CurrentTouchPoint = default(Tuple <double, double>);

                Func <Tuple <double, double> > GetTouchPoint = () => CurrentTouchPoint;

                m.TouchDown += e =>
                {
                    var p = e.GetTouchPoint(TouchOverlay).Position;

                    CurrentTouchPoint = Tuple.Create(p.X, p.Y);
                    Content.AttachTo(InfoOverlay);
                };

                m.TouchUp += e =>
                {
                    CurrentTouchPoint = null;
                    Content.Orphanize();
                };

                m.TouchMove += e =>
                {
                    var p = e.GetTouchPoint(TouchOverlay).Position;

                    CurrentTouchPoint = Tuple.Create(p.X, p.Y);



                    Content.MoveTo(e, TouchOverlay);
                };


                // this is what will be visible for the rest.
                return(new
                {
                    Content,
                    GetTouchPoint,
                });
            }
                );



            var touches = from k in t.Touches
                          let p = k.GetTouchPoint()
                                  where p != null
                                  let x                 = p.Item1
                                                  let y = p.Item2
                                                          select new { x, y, touch = k };

            var left_touch = from k in touches
                             let x                 = k.x
                                             let y = k.y
                                                     where x <64
                                                              where y> Height - 64
                                                     select k;



            var RocketsPending = new Dictionary <object, Canvas>();

            var buildmode_touches =
                from c in left_touch.Take(1)
                from k in touches
                where k.y < Height - 64

                // um, this finger already seems to have a pending rocket...
                where !RocketsPending.ContainsKey(k.touch)

                select k;

            var RocketsPendingToUpdate =
                from c in touches
                where RocketsPending.ContainsKey(c.touch)
                let rocket = RocketsPending[c.touch]
                             let Update = new Action(() => rocket.MoveTo(c.x, c.y))
                                          select new { rocket, c, Update };

            var __left_buildmode = false;


            #region NotifyBuildRocket
            this.NotifyBuildRocket =
                (x, y) =>
            {
                #region create a pending rocket
                var n = new { Content = new Canvas().AttachTo(InfoOverlay) };

                //Tuple

                var i = new Avalon.Images.rocket
                {
                }.AttachTo(n.Content).MoveTo(
                    Avalon.Images.rocket.ImageDefaultWidth / -4,
                    Avalon.Images.rocket.ImageDefaultHeight / -4
                    ).SizeTo(
                    Avalon.Images.rocket.ImageDefaultWidth / 2,
                    Avalon.Images.rocket.ImageDefaultHeight / 2
                    );


                // hold/build!
                //i.Opacity = 0.5;
                n.Content.MoveTo(x, y);
                MultitouchExample.Sounds.launch.Source.PlaySound();
                n.Content.AccelerateAndFade();
                #endregion
            };
            #endregion



            #region VisualizeTouch
            Action <double, double> VisualizeTouch = (x, y) =>
            {
                var n = new { Content = new Canvas().AttachTo(InfoOverlay) };

                //Tuple

                new Avalon.Images.white_jsc
                {
                }.AttachTo(n.Content).MoveTo(
                    Avalon.Images.white_jsc.ImageDefaultWidth / -4,
                    Avalon.Images.white_jsc.ImageDefaultHeight / -4
                    ).SizeTo(
                    Avalon.Images.white_jsc.ImageDefaultWidth / 2,
                    Avalon.Images.white_jsc.ImageDefaultHeight / 2
                    );

                n.Content.FadeOut();

                n.Content.MoveTo(x, y);
            };

            this.NotifyVisualizeTouch = VisualizeTouch;
            #endregion



            #region MouseLeftButtonUp
            TouchOverlay.MouseLeftButtonUp +=
                (sender, args) =>
            {
                // um this device has no finger support?
                // 2014! less tech?

                var p    = args.GetPosition(TouchOverlay);
                var item = new { x = p.X, y = p.Y };


                #region create a pending rocket
                var n = new { Content = new Canvas().AttachTo(InfoOverlay) };

                //Tuple

                var rocket = new Avalon.Images.rocket
                {
                }.AttachTo(n.Content).MoveTo(
                    Avalon.Images.rocket.ImageDefaultWidth / -4,
                    Avalon.Images.rocket.ImageDefaultHeight / -4
                    ).SizeTo(
                    Avalon.Images.rocket.ImageDefaultWidth / 2,
                    Avalon.Images.rocket.ImageDefaultHeight / 2
                    );


                // hold/build!
                //i.Opacity = 0.5;
                n.Content.Opacity = 0.5;
                n.Content.MoveTo(item.x, item.y);
                #endregion

                MultitouchExample.Sounds.launch.Source.PlaySound();

                rocket.Opacity = 1;
                rocket.AccelerateAndFade();

                //RocketsPending.Remove(item.touch);

                if (AtNotifyBuildRocket != null)
                {
                    AtNotifyBuildRocket(item.x, item.y);
                }
            };
            #endregion

            (1000 / 15).AtInterval(
                delegate
            {
                #region visualize all touches
                foreach (var item in touches)
                {
                    VisualizeTouch(item.x, item.y);

                    if (this.AtNotifyVisualizeTouch != null)
                    {
                        this.AtNotifyVisualizeTouch(item.x, item.y);
                    }
                }
                #endregion

                foreach (var item in
                         from k in t.Touches
                         where k.GetTouchPoint() == null
                         where RocketsPending.ContainsKey(k)
                         select new { rocket = RocketsPending[k], touch = k }
                         )
                {
                    // finger was lifted and rocked should be launched
                    // no sound in .net
                    // and NO fingers in this laptop!!!! 2014
                    MultitouchExample.Sounds.launch.Source.PlaySound();

                    item.rocket.Opacity = 1;
                    item.rocket.AccelerateAndFade();

                    RocketsPending.Remove(item.touch);

                    if (AtNotifyBuildRocket != null)
                    {
                        AtNotifyBuildRocket(Canvas.GetLeft(item.rocket), Canvas.GetTop(item.rocket));
                    }
                }

                var left_buildmode = left_touch.Any();
                if (left_buildmode)
                {
                    if (!__left_buildmode)
                    {
                        MultitouchExample.Sounds.building.Source.PlaySound();
                        // sound: build mode engaged!
                    }

                    // all other touches in range are now build orders!

                    foreach (var item in RocketsPendingToUpdate)
                    {
                        item.Update();
                    }

                    #region build
                    foreach (var item in buildmode_touches)
                    {
                        #region create a pending rocket
                        var n = new { Content = new Canvas().AttachTo(InfoOverlay) };

                        //Tuple

                        var i = new Avalon.Images.rocket
                        {
                        }.AttachTo(n.Content).MoveTo(
                            Avalon.Images.rocket.ImageDefaultWidth / -4,
                            Avalon.Images.rocket.ImageDefaultHeight / -4
                            ).SizeTo(
                            Avalon.Images.rocket.ImageDefaultWidth / 2,
                            Avalon.Images.rocket.ImageDefaultHeight / 2
                            );


                        // hold/build!
                        //i.Opacity = 0.5;
                        n.Content.Opacity = 0.5;
                        n.Content.MoveTo(item.x, item.y);
                        #endregion

                        RocketsPending[item.touch] = n.Content;


                        //n.Content.AccelerateAndFade();
                    }
                    #endregion


                    left.buildmode_off.Hide();
                    left.buildmode_on.Show();
                }
                else
                {
                    left.buildmode_on.Hide();
                    left.buildmode_off.Show();
                }
                __left_buildmode = left_buildmode;
            }
                );

            #region SizeChanged


            Action SizeChanged =
                delegate
            {
                c1.MoveTo(
                    (Width - c1.Width) / 2, 0);

                c2.MoveTo(
                    (Width - c1.Width) / 2, Height / 2);

                left.SizeTo(

                    Width / 2,
                    Height
                    );


                right.MoveTo(
                    Width / 2, 0).SizeTo(

                    Width / 2,
                    Height
                    );

                TouchArea.SizeTo(Width, Height);
            };

            this.SizeChanged +=
                (s, e) =>
            {
                SizeChanged();
            };

            SizeChanged();
            #endregion
        }