Well I don't know it is bad or good, but look www.facelimo.com and compare it. :-D
AghaKhan
Posts
-
What do you think? -
Multiple HttpPost method in MVC4Hello experts: In my web application I have a form where user can send SMS to any phone. Because it is a form and have a submit button the function is declared something like this. [HttpPost] public ActionResult Index(Massages massages) { return View(massages); } There is web service which sends the SMS message to participant client (phone). In this web service call we also have to provide PostBackUrl, so we could see the response which client has provided. This response is coming in form of JSON and HttpPost. I am puzzled how declare such function. //It is wrong but It might be something like this. HttpPost] public ActionResult ReplyBack(JSON reply) { return View(reply); } Any help will be very much appreciated. Best regards Agha Khan :-O
-
C# syntexWhat is ?? in C#
-
Authentication with database MVC4I have a local database to check authentication. You may create same database by C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe. Create any MVC4 application and look _LoginPartial.cshtml file. You will see line* @Html.ActionLink"Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })
1. Set your break point at method “Login” in Account controller. 2. Click in login and you will get exception at Unhandled exception at line 115, column 5 in http://localhost:61841/Scripts/jquery.unobtrusive-ajax.js. But why it is so? How can I use my local database for authentication? Why the exception is in javaScript? Do you an idea how to implement Authentication with local database? Any help will be appreciated. Agha Khan -
Posting a message from diffrent domainI have this simple script function displayMessage(evt) { alert(evt.source.toString()); } if (window.addEventListener) { window.addEventListener("message", displayMessage, false); }else { window.attachEvent("onmessage", displayMessage); } I am using curl to send this message by curl -X POST -d "payload" http://localhost:50334 But I never received the message. I am using IE9. What I am doing wrong? Your help will be very much appreciated.
-
MVC PostBackURLWell I send a SMS (message) through a service provider, where server provider is asking me the web address where to inform back for the result as a success or fail.
You may look complete example at (Working example and you play it to understand it)
http://www.w3schools.com/aspnet/showasp.asp?filename=demo\_prop\_webcontrol\_button\_postbackurl
<!DOCTYPE html>
<html>
<body>
<form runat="server">
Name:<asp:textbox id="TextBox1" runat=Server />
<asp:button id="Button1" Text="Submit"
PostBackUrl="demo_postbackurl.aspx" runat="Server" />
</form>
</body>
</html>As you see asp:button has property PostBackUrl, but as far as I know there is no button implementation under MVC3. The service provider only take web address as a PostBackUrl to return the status of the MSM call.
I hope I explained well. Thank you very much for the reply.
-
MVC PostBackURLI like to submit a request to a web service and wait for the response. I have to give web service a page name where I should the response. but I am unable to find any reference to PostBackUrl in MVC. In other word how are we going to deal with PostBackUrl or how we can provide return CallBack page?
-
Well this Lambda expression worksOtherClass.Subscribe(_ => KeepWorking = !KeepWorking); KeepWorking is a bool This works fine, but what is Lambda expression _ => :( Best regards Agha Khan
-
What this mean ??. This code works fineThanks :laugh:
-
What this mean ??. This code works fineThanks. :laugh:
-
What this mean ??. This code works finepublic class Item { public double X { get; set; } public double Y { get; set; } public string Name { get; set; } public string Color { get; set; } } public class ItemsFactory { private List items; public IEnumerable Items { get { return items ?? (items = new List<Item>() { new Item { Name = "One", X = 33, Y = 25, Color = "Red" }, new new Item { Name = "Two", X = 44, Y = 99, Color"Blue" } }); } } } :doh:
-
Xna object Transformation.I have protected List vertices = new List(); Now I added 8 VertexPositionColor for a cube and I can see that cube. I like to rotate it around x-axis or any axis. How this can be done? Please note we are not changing the camera location. All opration must be done on cube not the camera. Your answer will be very much appreciated. Best regards Agha Khan
-
Strange Container problemThank you for your email again. I was not aware that "(Canvas.RenderTransform).(ScaleTransform.ScaleX)" is also right for the code behind. Thank you. And it worked. :laugh: I did exectely what you are asking for. myCanvas.RenderTransform = new ScaleTransform(1, 1, 330, 0); It worked. I see your name with (U with 2 dots) which implies you are from North Europe. In USA we use JohnDow for Unknown. :laugh: Thanks Best regards Agha Khan
-
Strange Container problemThanks for reply. Well your suggestions are appreciated and binding with background make sense, but my question was diffrent why it does not animate? After playing 4 days I came to a solution, which I believe is not elegant, but it works. Basically we have to look closely PropertyPath which was set to ScaleTransform.ScaleXProperty and it should be "(Canvas.RenderTransform).(ScaleTransform.ScaleX)" but equal in code behind? I was unable to find any help. To bring complicated PropertyPath I have a create StoryBoard in xaml with a factious TargetName. <Storyboard x:Key="EmbaddedCanvas"> <DoubleAnimation Storyboard.TargetName="JohnDow" Storyboard.TargetProperty="(Canvas.RenderTransform).(ScaleTransform.ScaleX)" Duration="0:0:5" From="1" To="0"/> </Storyboard> and Register my Canvas with that name. At the end call that story board. RegisterName("JohnDow", myCanvas); Storyboard sbAnimate = (Storyboard)Resources["EmbaddedCanvas"]; growAnimation.SetValue(Storyboard.TargetNameProperty, "JohnDow"); sbAnimate.Begin(); It works. At the end everything we have done to bring TargetPropert from xaml, but what is equal in code behind of Storyboard.TargetProperty="(Canvas.RenderTransform).(ScaleTransform.ScaleX)"? You might know, but I am unable to find the answer. My solution works but it is not elegant. Best regards Agha Khan
-
SetTargetProperty for a CanvasIf I am not using StoryBoard I cam use my canvas to animate with a simple function DoubleAnimation growAnimation = new DoubleAnimation(600, 0, TimeSpan.FromSeconds(1)); myCanvas.RenderTransform.BeginAnimation(ScaleTransform.ScaleXProperty, growAnimation); // Line 1 It works fine. Now I would like to add to the StoryBoard. Storyboard.SetTarget(growAnimation, myCanvas); Storyboard.SetTargetProperty(growAnimation, new PropertyPath(Canvas.WidthProperty)); It works up to seme extend, but I am not changing the width. I am looking the to set the property like Line 1 Obviously it works if I declare in xaml file like Storyboard.TargetProperty="(Canvas.RenderTransform).(ScaleTransform.ScaleX)" In other words what is equal of above lint in code behind? Storyboard.SetTargetProperty(growAnimation, new PropertyPath(What should be here)); Any help will be very much appreciated. best regards Agha Khan
-
Strange Container problemI have a container (Grid or any other Container) which holds another Canvas which has a background image. My xaml file looks something like this. <Window x:Class="Billboard.WinMain" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="WinMain" Height="507" Width="676"> <Window.Resources> <Storyboard x:Key="EmbaddedCanvas"> <DoubleAnimation Storyboard.TargetName="myCanvas" Storyboard.TargetProperty="(Canvas.RenderTransform).(ScaleTransform.ScaleX)" Duration="0:0:5" From="1" To="0"/> </Storyboard> <ImageBrush x:Key="IBKey" ImageSource="Images/Crystal.jpg" /> </Window.Resources> <Grid x:Name=" ParentGrid " Height="475" Width="660"> <Canvas x:Name="myCanvas" Height="475" Width="660" Background="{StaticResource IBKey}" > <Canvas.RenderTransform> <ScaleTransform CenterX="330" CenterY="0" ScaleX="1" ScaleY="1" /> </Canvas.RenderTransform> </Canvas> </Grid> </Window> In my code I just call Storyboard sbAnimate = (Storyboard)Resources["EmbaddedCanvas"]; sbAnimate.Begin(); It works fine. No problem. This was an experiment. But in real application the image is dynamic and I had to create Canvas on the fly. So my xmal code looks something like this and I will add ParentGrid <Grid x:Name="ParentGrid" Height="475" Width="660"> </Grid> Now my code behind likes like this and I can see the image but no animation. Image finalImage = new Image(); BitmapImage logo = new BitmapImage(); logo.BeginInit(); logo.UriSource = new Uri("pack://application:,,,/Billboard;component/Images/Crystal.jpg"); logo.EndInit(); finalImage.Source = logo; Canvas myCanvas = new Canvas(); myCanvas.Width = 660; myCanvas.Height = 475; myCanvas.Background = new ImageBrush(finalImage.Source); this.ParentGrid.Children.Add(myCanvas); myCanvas.Children.Add(finalImage); Storyboard sb = new Storyboard(); ScaleTransform scaleTransform = new ScaleTransform(1.0, 1.0, 330, 0); myCanvas.RenderTransformOrigin = new Point(0, 0); myCanvas.RenderTransform = scaleTransform; DoubleAnimation growAnimation = new Doub
-
StoryBoard is not workingIf I add scale.BeginAnimation(ScaleTransform.ScaleXProperty, growAnimation); then animation works fine, but I need to add timeline, so StortBoard should work. Now I added almost same code Now it is not working. Am I am setting the wrong Property, but I shouldn't because it is same property. Storyboard.SetTarget(growAnimation, myCanvas); Storyboard.SetTargetProperty(growAnimation, new PropertyPath(ScaleTransform.ScaleXProperty)); sb.Children.Add(growAnimation); sb.Begin(); Any help will be very much appriciated. Agha Khan private void Animate() { Image finalImage = new Image(); BitmapImage logo = new BitmapImage(); logo.BeginInit(); logo.UriSource = new Uri("pack://application:,,,/Billboard;component/Images/Crystal.jpg"); logo.EndInit(); finalImage.Source = logo; Canvas myCanvas = new Canvas(); myCanvas.Width = 660; myCanvas.Height = 475; myCanvas.Background = new ImageBrush(finalImage.Source); this.ImageGrid.Children.Add(myCanvas); Storyboard sb = new Storyboard(); ScaleTransform scale = new ScaleTransform(1.0, 1.0, 33, 0); myCanvas.RenderTransformOrigin = new Point(0, 0); myCanvas.RenderTransform = scale; DoubleAnimation growAnimation = new DoubleAnimation(1, 0, TimeSpan.FromSeconds(2)); growAnimation.BeginTime = TimeSpan.FromSeconds(0); // Apply the animation to the Canvas's Width property. // myCanvas.BeginAnimation(Canvas.WidthProperty, growAnimation); // scale.BeginAnimation(ScaleTransform.ScaleXProperty, growAnimation); Storyboard.SetTarget(growAnimation, myCanvas); Storyboard.SetTargetProperty(growAnimation, new PropertyPath(ScaleTransform.ScaleXProperty)); // Looks like bug is in above line, but unable to find it. sb.Children.Add(growAnimation); sb.Begin(); }
-
How user-interface thread knows the animation thread has finished?I have a control which does some animation. The animation (as far as I know) is on different thread. An event occurs and the control starts to animate, no problem. While it is animation it gets another request which I do not want and second request has to wait until it finished its first. I thought I place static bool and check it is previously animating and change vale when animation is comleated. This does not work because when context switch changes static bool has meaningless value. Now I have to protect static bool so context switch should not effect. It is long way to do so and it might not work. I haven’t tried either. Do you any better idea? Your help will be very much appreciated. Best regards Agha Khan
-
Throw Errors while run a wpf animated applicationThere are so many types of animations and without more information it looks no one able to help you. Best regards Agha
-
Translate transform in codeI have a class which builds cubes.One of its properties is to translate to diffrent part of the screen. testCube is object of that class. testCube.Translate = new TranslateTransform3D(0, -1, 1); I would like to set binding for Translation, but I am having hard time. Looking the book WPF in Action I found this code for Rotation. AxisAngleRotation3D angleRot = new AxisAngleRotation3D(new Vector3D(0, 1, 0), 0); RotateTransform3D rot = new RotateTransform3D(angleRot,new Point3D(-spaceToUseX + (spaceToUseX / 2), 0, -(barWidth / 2))); Binding rotBind = new Binding("Value"); rotBind.Source = rotateSlider; BindingOperations.SetBinding(angleRot, AxisAngleRotation3D.AngleProperty, rotBind); model.Transform = rot; I wrote this code, but nothing happends.It runs, with no errors Binding TransformBindingX = new Binding("CubeUnit"); TransformBindingX.Path = new PropertyPath("Translate.OffsetX"); Binding TransformBindingY = new Binding("CubeUnit"); TransformBindingY.Path = new PropertyPath("Translate.OffsetY"); Binding TransformBindingZ = new Binding("CubeUnit"); TransformBindingZ.Path = new PropertyPath("Translate.OffsetZ"); TranslateTransform3D translateTransform3D = new TranslateTransform3D(); BindingOperations.SetBinding(translateTransform3D, TranslateTransform3D.OffsetXProperty, TransformBindingX); BindingOperations.SetBinding(translateTransform3D, TranslateTransform3D.OffsetYProperty, TransformBindingY); BindingOperations.SetBinding(translateTransform3D, TranslateTransform3D.OffsetZProperty, TransformBindingZ); Any Idea? Best regards Agha