private void showPannel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { UserControl currentView = (UserControl)this.showPannel.Children.ElementAt(0); double actualWidth = showPannel.ActualWidth; double actualHeight = showPannel.ActualHeight; if (e.GetPosition(showPannel).X <= (actualHeight * 0.3) || e.GetPosition(showPannel).X >= (actualHeight * 0.6)) { UserControl showScreen; // transition to new page. if (this.LessionManager._mKanjiManage.Count == 0) { return; } if (currentView is FrontView) { showScreen = new Backview(this.LessionManager.GetCurrentKanji()); } else { showScreen = new FrontView(this.LessionManager.GetCurrentKanji()); } if (showPannel.Children.Count > 0) { // remove current childrent of showPannel showPannel.Children.Clear(); } // Add new children. showPannel.Children.Add(showScreen); } }
private void waitingInfo(object sender, EventArgs e) { if (this.dataLoaded) { this.waitingThread.Stop(); } if (this.LessionManager._mKanjiManage.Count > 0) { this.dataLoaded = true; // Setting new kanji for display screen. this.LessionManager._mKanjiManage[0]._mLessionName = this.LessionManager._mLessionName; FrontView frontView = new FrontView(this.LessionManager._mKanjiManage[0]); this.showPannel.Children.Clear(); this.showPannel.Children.Add(frontView); } else { this.countTimer++; if (this.countTimer == 15) { this.waitingThread.Stop(); this.countTimer = 0; MessageBox.Show("Can't fetch data from database !!", "Time out", MessageBoxButton.OK); } } }
async void OnTapGestureRecognizerTapped(object sender, EventArgs args) { if (_isInFront) { _contentHolder.RaiseChild(BackView); FrontView.Opacity = 0.2f; await Task.WhenAll( FrontView.FadeTo(1, 500), FrontView.TranslateTo(0, -translationPosition, 500), BackView.TranslateTo(0, 0, 500), BackView.ScaleTo(1, 500), FrontView.ScaleTo(0.8f, 500) ); } else { _contentHolder.RaiseChild(FrontView); BackView.Opacity = 0.2f; await Task.WhenAll( BackView.FadeTo(1, 500), FrontView.TranslateTo(0, 0, 500), BackView.TranslateTo(0, -translationPosition, 500), FrontView.ScaleTo(1, 500), BackView.ScaleTo(0.8f, 500) ); } _isInFront = !_isInFront; }
private void btnForward_Click(object sender, RoutedEventArgs e) { if (this.LessionManager._mKanjiManage == null || this.LessionManager._mKanjiManage.Count == 0) { return; } if (isOrder == false) { if (this.LessionManager._mCurrentKanji < this.LessionManager._mKanjiManage.Count - 1) { this.LessionManager._mCurrentKanji += 1; } else { this.LessionManager._mCurrentKanji = this.LessionManager._mKanjiManage.Count - 1; } } else { this.LessionManager._mCurrentKanji = new Random().Next(0, this.LessionManager._mKanjiManage.Count - 1); } FrontView frontView = new FrontView(this.LessionManager.GetCurrentKanji()); if (showPannel.Children.Count > 0) { // remove current childrent of showPannel showPannel.Children.Clear(); } // Add new children. showPannel.Children.Add(frontView); }
public void AssignFinalState(Point2D _startXY, Point2D _endXY, Point2D _startYZ, Point2D _endYZ, Point2D _startXZ, Point2D _endXZ, int _indexOfLine) { FrontView.AssignFinalState_2DLine(_startXY, _endXY, Plane.XY, _indexOfLine); SideView.AssignFinalState_2DLine(_startYZ, _endYZ, Plane.ZY, _indexOfLine); TopView.AssignFinalState_2DLine(_startXZ, _endXZ, Plane.XZ, _indexOfLine); }
private void UpdateViews() { TopView.Perspective = HullControl.PerspectiveType.TOP; SideView.Perspective = HullControl.PerspectiveType.SIDE; FrontView.Perspective = HullControl.PerspectiveType.FRONT; // Need to invoke the setter to regenerate the hull. PerspectiveView.Perspective = PerspectiveView.Perspective; TopView.InvalidateVisual(); FrontView.InvalidateVisual(); SideView.InvalidateVisual(); PerspectiveView.InvalidateVisual(); }
private void UpdateViews() { EditableHull topView = new EditableHull(myHull); topView.Rotate(0, 90, 90); TopView.editableHull = topView; TopView.perspective = HullControl.PerspectiveType.TOP; EditableHull sideView = new EditableHull(myHull); sideView.Rotate(0, 90, 180); SideView.editableHull = sideView; SideView.perspective = HullControl.PerspectiveType.SIDE; EditableHull frontView = new EditableHull(myHull); frontView.Rotate(0, 0, 180); FrontView.editableHull = frontView; FrontView.perspective = HullControl.PerspectiveType.FRONT; EditableHull perspectiveView = new EditableHull(myHull); switch (PerspectiveView.perspective) { case HullControl.PerspectiveType.FRONT: perspectiveView.Rotate(0, 0, 180); break; case HullControl.PerspectiveType.TOP: perspectiveView.Rotate(0, 90, 90); break; case HullControl.PerspectiveType.SIDE: perspectiveView.Rotate(0, 90, 180); break; case HullControl.PerspectiveType.PERSPECTIVE: perspectiveView.Rotate(10, 30, 190); break; } PerspectiveView.editableHull = perspectiveView; TopView.InvalidateVisual(); FrontView.InvalidateVisual(); SideView.InvalidateVisual(); PerspectiveView.InvalidateVisual(); }
private void SetBackGroundColor() { BackgroundView.Visibility = ViewStates.Visible; switch (_holderMove) { case Moving.Left: NoteTextView.Visibility = ViewStates.Invisible; TaskTextView.Visibility = ViewStates.Visible; BackgroundView.SetBackgroundResource(Android.Resource.Color.HoloBlueDark); FrontView.SetBackgroundResource(Resource.Drawable.contact_item_gradient_left); break; case Moving.Right: NoteTextView.Visibility = ViewStates.Visible; TaskTextView.Visibility = ViewStates.Invisible; BackgroundView.SetBackgroundResource(Android.Resource.Color.HoloRedDark); FrontView.SetBackgroundResource(Resource.Drawable.contact_item_gradient_right); break; } }
static void Main(string[] args) { FrontView frontView = new FrontView(); Console.ReadKey(true); }
public void Flip(FlipDirection direction, NSAction completion) { if (flippingInProgress || FrontView == null || BackView == null) { return; } flippingInProgress = true; projectionLayer = CALayer.Create(); // this is to make the perspective and 2.5D effect projectionLayer.Frame = this.Layer.Bounds; var perspective = CATransform3D.Identity; float zDistanse = 350f; // change this to the actual perspective and distance of the projection plane perspective.m34 = 1f / -zDistanse; projectionLayer.SublayerTransform = perspective; this.Layer.AddSublayer(projectionLayer); frontImage = FrontView.GetImage(); backImage = BackView.GetImage(); topFaceLayer = new GradientLayer(GradientLayerType.Face, GradientLayerAreaType.Top); topFaceLayer.Frame = new RectangleF(0f, 0f, projectionLayer.Frame.Size.Width, (float)Math.Floor(projectionLayer.Frame.Size.Height / 2f)); bottomFaceLayer = new GradientLayer(GradientLayerType.Face, GradientLayerAreaType.Bottom); bottomFaceLayer.Frame = new RectangleF(0f, (float)Math.Floor(projectionLayer.Frame.Size.Height / 2f), projectionLayer.Frame.Size.Width, (float)Math.Floor(projectionLayer.Frame.Size.Height / 2f)); mainFlipLayer = new DoubleSidedLayer(); mainFlipLayer.AnchorPoint = new PointF(1f, 1f); mainFlipLayer.Frame = new RectangleF(0f, 0f, projectionLayer.Frame.Size.Width, (float)Math.Floor(projectionLayer.Frame.Size.Height / 2f)); mainFlipLayer.ZPosition = 1f; mainFlipLayer.FrontLayer = new GradientLayer(GradientLayerType.Flip, GradientLayerAreaType.Top); mainFlipLayer.BackLayer = new GradientLayer(GradientLayerType.Flip, GradientLayerAreaType.Bottom); // offscreen rendering optimization to reuse the offscreen buffer topFaceLayer.ShouldRasterize = true; bottomFaceLayer.ShouldRasterize = true; if (direction == FlipDirection.Down) { topFaceLayer.Contents = backImage.CGImage; bottomFaceLayer.Contents = frontImage.CGImage; mainFlipLayer.FrontLayer.Contents = frontImage.CGImage; mainFlipLayer.BackLayer.Contents = backImage.CGImage; topFaceLayer.GradientOpacity = 1f; mainFlipLayer.Transform = CATransform3D.Identity; } else { topFaceLayer.Contents = frontImage.CGImage; bottomFaceLayer.Contents = backImage.CGImage; mainFlipLayer.FrontLayer.Contents = backImage.CGImage; mainFlipLayer.BackLayer.Contents = frontImage.CGImage; bottomFaceLayer.GradientOpacity = 1f; mainFlipLayer.Transform = CATransform3D.MakeRotation((float)-Math.PI, 1f, 0f, 0f); } // Add layers to the projection layer, so we apply the projections to it projectionLayer.AddSublayer(topFaceLayer); projectionLayer.AddSublayer(bottomFaceLayer); projectionLayer.AddSublayer(mainFlipLayer); NSTimer.CreateScheduledTimer(0.01, delegate { CATransaction.Begin(); CATransaction.AnimationDuration = Duration; CATransaction.AnimationTimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseOut); CATransaction.CompletionBlock = delegate { fv = this.FrontView; FrontView = BackView; BackView = fv; flippingInProgress = false; if (completion != null) { completion.Invoke(); } }; // this is the whole trick, change the angle in timing function float angle = (float)Math.PI * (1f - (float)direction); mainFlipLayer.Transform = CATransform3D.MakeRotation(angle, 1f, 0f, 0f); topFaceLayer.GradientOpacity = (float)direction; bottomFaceLayer.GradientOpacity = 1f - (float)direction; mainFlipLayer.FrontLayer.GradientOpacity = 1f - (float)direction; mainFlipLayer.BackLayer.GradientOpacity = (float)direction; CATransaction.Commit(); }); }
public static void HttpsendgotoHttpsimple(FrontView.Classes.FrontViewConfig _config, string url) { if (url == "") { return; } try { if (_config.HttpUseDigest == false) { Logger.Instance().LogDump("HttpSimpleSend", "Using Basic: Url: " + url, true); var logon = _config.HttpUser; var password = _config.HttpPassword; var Auth = "Basic"; Logger.Instance().LogDump("HttpSimpleSend", "Using " + Auth + " Authorisation: URL " + url, true); WebRequest request = WebRequest.Create(url); request.Method = WebRequestMethods.Http.Get; NetworkCredential networkCredential = new NetworkCredential(logon, password); // logon in format "domain\username" CredentialCache myCredentialCache = new CredentialCache { { new Uri(url), Auth, networkCredential } }; request.PreAuthenticate = true; request.Credentials = myCredentialCache; using (WebResponse response = request.GetResponse()) { //Console.WriteLine(((HttpWebResponse)response).StatusDescription); Logger.Instance().LogDump("HttpSimpleSend", "Response: " + url + " Response: " + (((HttpWebResponse)response).StatusDescription), true); //using (Stream dataStream = response.GetResponseStream()) // { // using (StreamReader reader = new StreamReader(dataStream)) // { // string responseFromServer = reader.ReadToEnd(); // Logger.Instance().LogDump("HttpSend", "url: " + url + " Response: " + responseFromServer, true); //Console.WriteLine(responseFromServer); // } // } } } if (_config.HttpUseDigest == true) { Uri myurl = new Uri(url); string baseurl = myurl.GetComponents(UriComponents.SchemeAndServer | UriComponents.UserInfo, UriFormat.Unescaped); //var baseurl = myurl.Host; var dir = myurl.PathAndQuery; Logger.Instance().LogDump("HttpSimpleSend", "Using Digest: Url: " + url + " BaseURL: " + baseurl + " Dir: " + dir, true); DigestAuthFixer digest = new DigestAuthFixer(baseurl, _config.HttpUser, _config.HttpPassword); string strReturn = digest.GrabResponse(dir); } } catch (Exception ex) { Logger.Instance().Log("HttpSimpleSend", "ERROR: For URL: " + url + " Exception: " + ex, true); } }