public void bt_filebox_Click(object sender, RoutedEventArgs e) { if (main.Children.Contains(fBox) == false) { fBox = new FileBox3(); main.Children.Add(fBox); fBoxProp.ElementSupport.AddSupport(TouchAction.Tap); fBoxProp.ElementSupport.AddSupport(TouchAction.Drag); fBoxProp.ElementSupport.AddSupport(TouchAction.ScrollY); fBoxCont = new MTSmoothContainer(fBox, main, fBoxProp); fBoxCont.SetPosition(thisPosition.X, thisPosition.Y, thisAngle + thisCont.RotateFilter.Target, 1.0); framework.RegisterElement(fBoxCont); fBox.setInit(main, window, framework, fBoxCont, thisAngle, userIP); isCreated = true; } else { main.Children.Remove(fBox); framework.UnregisterElement(fBoxCont.Id); fBox = new FileBox3(); isCreated = false; } }
public override void TouchDown(PointF p) { //Console.WriteLine("touchDown"); FileBox3 s = Source as FileBox3; if (s == null) { return; } PointIn ptIn = new PointIn(); PointF pt = s.thisCont.ObjectTouches.MoveCenter; double ang = s.thisAngle + s.thisCont.RotateFilter.Target; if (ptIn.setPtinRect(s.window, s.bt_listBox, pt, ang)) { isListBox = true; index = findSelectedItem(s, new PointF(p.X, p.Y)); if (index != -1) { if (ptIn.setPtinRect(s.window, s.itemList.ElementAt(index).img_pic, pt, ang)) { IsSelecting = true; s.Item_TouchDown(p, s.itemList.ElementAt(index).objectInfo); } else { IsSelecting = false; } } } else if (ptIn.setPtinRect(s.window, s.bt_rotate, pt, ang)) { isListBox = false; IsSelecting = false; if (ptIn.setPtinRect(s.window, s.bt_inMain, pt, ang)) { } else { if (ptIn.setPtinRect(s.window, s.bt_move, pt, ang)) { s.Move_TouchDown(p); } else { s.Rotate_TouchDown(p); } } } else { isListBox = false; IsSelecting = false; } base.TouchDown(p); }
public void bt1_Click(object sender, RoutedEventArgs e) { if (main.Children.Contains(fBox) == false) { fBox = new FileBox3(); main.Children.Add(fBox); fBoxProp.ElementSupport.AddSupport(TouchAction.Tap); fBoxProp.ElementSupport.AddSupport(TouchAction.Drag); fBoxProp.ElementSupport.AddSupport(TouchAction.ScrollY); fBoxCont = new MTSmoothContainer(fBox, main, fBoxProp); fBoxCont.SetPosition(thisPosition.X, thisPosition.Y, thisAngle + thisCont.RotateFilter.Target, 1.0); framework.RegisterElement(fBoxCont); fBox.setInit(main, window, framework, fBoxCont, thisAngle, userIP); fBox.Tag = "f/" + userIP; SingleToneTrans.getInstance().addToFileBox(fBox); isCreated = true; } else { main.Children.Remove(fBox); framework.UnregisterElement(fBoxCont.Id); fBox = new FileBox3(); SingleToneTrans.getInstance().removeFileBox(fBox); isCreated = false; } }
public override void Drag(float x, float y) { //Console.WriteLine("Drag"); FileBox3 s = Source as FileBox3; if (s == null) { return; } int state = 0; PointIn ptIn = new PointIn(); PointF pt = s.thisCont.ObjectTouches.MoveCenter; double ang = s.thisAngle + s.thisCont.RotateFilter.Target; if (ptIn.setPtinRect(s.window, s.bt_trans, pt, ang)) { state = 1; } else if (ptIn.setPtinRect(s.window, s.bt_main, pt, ang)) { state = 2; } else { state = 0; } s.Item_TouchMove(pt, state); base.Drag(x, y); }
public override void Tap(PointF p) { //Console.WriteLine("Tab"); FileBox3 s = Source as FileBox3; if (s == null) { return; } RoutedEventArgs e = new RoutedEventArgs(); e.RoutedEvent = Button.ClickEvent; PointIn ptIn = new PointIn(); PointF pt = s.thisCont.ObjectTouches.MoveCenter; double ang = s.thisAngle + s.thisCont.RotateFilter.Target; if (ptIn.setPtinRect(s.window, s.mode_bt_center, pt, ang)) { s.mode_bt_center.RaiseEvent(e); } else if (ptIn.setPtinRect(s.window, s.mode_bt_up, pt, ang)) { s.mode_bt_up.RaiseEvent(e); } else if (ptIn.setPtinRect(s.window, s.mode_bt_left, pt, ang)) { s.mode_bt_left.RaiseEvent(e); } else if (ptIn.setPtinRect(s.window, s.mode_bt_right, pt, ang)) { s.mode_bt_right.RaiseEvent(e); } else if (ptIn.setPtinRect(s.window, s.mode_bt1_img, pt, ang)) { s.mode_bt1_img.RaiseEvent(e); } else if (ptIn.setPtinRect(s.window, s.mode_bt2_video, pt, ang)) { s.mode_bt2_video.RaiseEvent(e); } else if (ptIn.setPtinRect(s.window, s.mode_bt3_ppt, pt, ang)) { s.mode_bt3_ppt.RaiseEvent(e); } else if (ptIn.setPtinRect(s.window, s.mode_bt4_doc, pt, ang)) { s.mode_bt4_doc.RaiseEvent(e); } else if (ptIn.setPtinRect(s.window, s.mode_bt_close, pt, ang)) { s.mode_bt_close.RaiseEvent(e); } else if (ptIn.setPtinRect(s.window, s.bt_trans, pt, ang)) { s.bt_trans.RaiseEvent(e); } base.Tap(p); }
public override void TouchUp(PointF p) { //Console.WriteLine("touchUp"); FileBox3 s = Source as FileBox3; if (s == null) { return; } PointIn ptIn = new PointIn(); PointF pt = s.thisCont.ObjectTouches.MoveCenter; double ang = s.thisAngle + s.thisCont.RotateFilter.Target; if (ptIn.setPtinRect(s.window, s.bt_trans, pt, ang)) { s.trans_TouchUp(p); } else if (ptIn.setPtinRect(s.window, s.bt_main, pt, ang)) { s.main_TouchUp(p); } else { s.Item_TouchUp(p); } base.TouchUp(p); }
int findSelectedItem(FileBox3 s, PointF p) { PointIn ptIn = new PointIn(); PointF pt = s.thisCont.ObjectTouches.MoveCenter; double ang = s.thisAngle + s.thisCont.RotateFilter.Target; ScrollViewer scroll = s.itemListBox.FindChild <ScrollViewer>() as ScrollViewer; for (int i = 0; i < s.itemList.Count; i++) { if (ptIn.setPtinRect(s.window, s.itemList.ElementAt(i), pt, ang)) { return(i); } } return(-1); }
public void sendFile(FrameworkElement f, string state) { if (state == "FileBox") //파일 박스로 전송 { FileBox3 fb = f as FileBox3; string fpath = fboxPath + fb.userIP + "\\"; fpath += "MyBox\\" + objInfo.FileName; FileInfo fileinfo = new FileInfo(objInfo.FilePath); FileInfo fileinfo2 = new FileInfo(fpath); if (fileinfo2.Exists == false) { fileinfo.CopyTo(fpath, false); fb.updateListBox(); } } else if (state == "SmartArea") { } img_bt2_Click(thisPosition); }
int findSelectedItem(FileBox3 s, PointF p) { PointIn ptIn = new PointIn(); PointF pt = s.thisCont.ObjectTouches.MoveCenter; double ang = s.thisAngle + s.thisCont.RotateFilter.Target; ScrollViewer scroll = s.itemListBox.FindChild<ScrollViewer>() as ScrollViewer; for (int i = 0; i < s.itemList.Count; i++) { if (ptIn.setPtinRect(s.window, s.itemList.ElementAt(i), pt, ang)) { return i; } } return -1; }
/// <summary> /// Checks if the element has a scroll viewer. It it does, uses the scroll viewer /// to scroll the content by the number of pixels moved. /// X and Y are inverted so that the scroll works like the iPhone (i.e. the touched /// item sticks to your finger). Works better without scrollbars shown. /// </summary> /// <param name="x">Change in the horizontal object relative movement center in pixels</param> /// <param name="y">Change in the vertical object relative movement center in pixels</param> public virtual void Scroll(float x, float y) { if (Source is FileBox3) { FileBox3 s = Source as FileBox3; if (isListBox == true) { // This sets it so that we scroll by pixels rather than by lines if (ScrollViewer.GetCanContentScroll(s.itemListBox)) { ScrollViewer.SetCanContentScroll(s.itemListBox, false); } // Find the scrollviewer and scroll it if there is one ScrollViewer scroll = s.itemListBox.FindChild <ScrollViewer>() as ScrollViewer; if (scroll != null) { scroll.ScrollToHorizontalOffset(scroll.HorizontalOffset + (x * -1)); scroll.ScrollToVerticalOffset(scroll.VerticalOffset + (y * -1)); } s.itemListBox.RaiseEvent(new RoutedEventArgs(MTEvents.ScrollEvent, Source)); } } else if (Source is DocViewer) { DocViewer s = Source as DocViewer; if (isDocViewer == true) { // This sets it so that we scroll by pixels rather than by lines if (ScrollViewer.GetCanContentScroll(s.documentviewWord)) { ScrollViewer.SetCanContentScroll(s.documentviewWord, false); } // Find the scrollviewer and scroll it if there is one ScrollViewer scroll = s.documentviewWord.FindChild <ScrollViewer>() as ScrollViewer; if (scroll != null) { scroll.ScrollToHorizontalOffset(scroll.HorizontalOffset + (x * -1)); scroll.ScrollToVerticalOffset(scroll.VerticalOffset + (y * -1)); } s.documentviewWord.RaiseEvent(new RoutedEventArgs(MTEvents.ScrollEvent, Source)); } } else if (Source is ContactsBox) { ContactsBox s = Source as ContactsBox; if (isListBox == true) { // This sets it so that we scroll by pixels rather than by lines if (ScrollViewer.GetCanContentScroll(s.ContactslistBox)) { ScrollViewer.SetCanContentScroll(s.ContactslistBox, false); } // Find the scrollviewer and scroll it if there is one ScrollViewer scroll = s.ContactslistBox.FindChild <ScrollViewer>() as ScrollViewer; if (scroll != null) { scroll.ScrollToHorizontalOffset(scroll.HorizontalOffset + (x * -1)); scroll.ScrollToVerticalOffset(scroll.VerticalOffset + (y * -1)); } s.ContactslistBox.RaiseEvent(new RoutedEventArgs(MTEvents.ScrollEvent, Source)); } } else {// This sets it so that we scroll by pixels rather than by lines if (ScrollViewer.GetCanContentScroll(Source)) { ScrollViewer.SetCanContentScroll(Source, false); } // Find the scrollviewer and scroll it if there is one ScrollViewer scroll = Source.FindChild <ScrollViewer>() as ScrollViewer; if (scroll != null) { scroll.ScrollToHorizontalOffset(scroll.HorizontalOffset + (x * -1)); scroll.ScrollToVerticalOffset(scroll.VerticalOffset + (y * -1)); } Source.RaiseEvent(new RoutedEventArgs(MTEvents.ScrollEvent, Source)); } }