Beispiel #1
0
        private void PerformSearch(string[] keywords)
        {
            try
            {
                CursorHelper.ShowWaitCursor(this, true);

                lbMatchingItems.Items.Clear();

                List <object> itemsToShow = new List <object>();
                foreach (PlaylistItem plItem in _playlist.AllItems)
                {
                    if (TestForMatch(plItem, keywords))
                    {
                        itemsToShow.Add(plItem);
                    }
                }

                if (itemsToShow.Count > 0)
                {
                    lbMatchingItems.Items.AddRange(itemsToShow.ToArray());
                    if (lbMatchingItems.Items.Count > 0)
                    {
                        lbMatchingItems.SelectedIndex = 0;
                    }
                }
            }
            finally
            {
                CursorHelper.ShowWaitCursor(this, false);
            }
        }
        private void btnAddFolder_Click(object sender, EventArgs e)
        {
            CursorHelper.ShowWaitCursor(this, true);

            OPMFolderBrowserDialog dlg = new OPMFolderBrowserDialog();

            dlg.Description         = Translator.Translate("TXT_SELECTTAGGEDFILESFOLDER");
            dlg.SelectedPath        = ProTONEConfig.LastOpenedFolder;
            dlg.ShowNewFolderButton = false;

            dlg.InheritAppIcon = false;
            dlg.Icon           = Resources.Tagging16.ToIcon();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                IEnumerable <string> files = PathUtils.EnumFiles(dlg.SelectedPath, "*.mp?", SearchOption.AllDirectories);
                if (files != null)
                {
                    foreach (string file in files)
                    {
                        AddFile(file);
                    }
                }

                ProTONEConfig.LastOpenedFolder = dlg.SelectedPath;
            }

            CursorHelper.ShowWaitCursor(this, false);
            Wizard.CanMoveNext = lvFiles.Items.Count > 0;
        }
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);

            isMouseDown = false;

            if (interactionState == InteractionState.Selection)
            {
                selectedElements = GetElementsByRectangle(SelectionRectangle);
                interactionState = InteractionState.None;
                Cursor           = Cursors.Default;
            }
            else if (interactionState == InteractionState.Pan)
            {
                if (panSource == PanSource.Mouse)
                {
                    interactionState = InteractionState.None;
                    panSource        = PanSource.None;
                    Cursor           = Cursors.Default;
                }
                else if (panSource == PanSource.Keyboard)
                {
                    Cursor = CursorHelper.LoadFromResource(Properties.Resources.grab);
                }
            }
            else
            {
                interactionState = InteractionState.None;
                Cursor           = Cursors.Default;
            }

            Refresh();
        }
Beispiel #4
0
        private void OnSelectedAttachmentChanged()
        {
            Attachments.ForEach((x) =>
            {
                x.IsSelected = false;
            });

            if (SelectedAttachment != null)
            {
                SelectedAttachment.IsSelected = true;

                if (!IsImageAttachement(SelectedAttachment))
                {
                    CursorHelper.ExecuteWithWaitCursor(() =>
                    {
                        try
                        {
                            Process.Start(SelectedAttachment.ImageSource);
                        }
                        catch
                        {
                            _windowManager.ShowError("Open Attachment", "Windows cannot open this document.");
                        }
                    });
                }
            }
        }
Beispiel #5
0
        private void createDragCursor(Card card)
        {
            var cardIconSize = new Size(69, 96).ByDpi();
            int overlapY     = 28.ByDpiHeight();
            var handImage    = Resources.play_card_48.ResizeDpi();

            var cursorImage = new Bitmap(cardIconSize.Width, cardIconSize.Height + handImage.Height - overlapY);

            using (var g = Graphics.FromImage(cursorImage))
            {
                var bitmap = card?.Image(Ui);

                if (bitmap == null)
                {
                    using Pen pen = new Pen(SystemColors.WindowText, width: 2);
                    g.DrawRectangle(pen, new Rectangle(Point.Empty, cardIconSize));
                }
                else
                {
                    g.DrawImage(bitmap, new Rectangle(Point.Empty, cardIconSize));
                }

                g.DrawImage(handImage,
                            new Rectangle(
                                new Point((cardIconSize.Width - handImage.Width) / 2, cardIconSize.Height - overlapY - 1),
                                handImage.Size));
            }

            cursorImage = cursorImage.SetOpacity(0.65f);
            var hotSpot = new Point(cursorImage.Width / 2, cardIconSize.Height);

            _dragCursor = CursorHelper.CreateCursor(cursorImage, hotSpot);
        }
Beispiel #6
0
        /// <summary>
        ///   Initializes a new instance of the <see cref = "DockableContentConductor" /> class.
        /// </summary>
        /// <param name = "viewModel">The view model.</param>
        /// <param name = "view">The view.</param>
        public DockableContentConductor(object viewModel, BaseDockableContent view)
        {
            m_ViewModel = viewModel;
            m_View      = view;

            view.IsActiveContentChanged += (sender, args) =>
            {
                var baseDockableContent = sender as BaseDockableContent;
                if (baseDockableContent != null && baseDockableContent.IsActiveContent)
                {
                    var activatable = baseDockableContent.ViewModel as IActivate;
                    if (activatable != null && !activatable.IsActive)
                    {
                        CursorHelper.ExecuteWithWaitCursor(activatable.Activate);
                    }
                }
            };

            var deactivatable = viewModel as IDeactivate;

            if (deactivatable != null)
            {
                view.Closed += OnClosed;
                deactivatable.Deactivated += OnDeactivated;
            }

            var guard = viewModel as IGuardClose;

            if (guard != null)
            {
                view.Closing += OnClosing;
            }
        }
        public void FillGrid()
        {
            if (m_BrDoc.LineCount < 1)
            {
                return;
            }

            int cnt = 0;

            //StatusText = "正在準備顯示資料...";
            //StatusProgress = 0;
            brGrid.SuspendLayout();
            CursorHelper.ShowWaitCursor();
            try
            {
                int row = FixedRows;
                foreach (BrailleLine brLine in m_BrDoc.Lines)
                {
                    FillRow(brLine, row, false);                        // 填一列,先不要調整列高。

                    row += 3;

                    cnt++;
                    //StatusProgress = cnt * 100 / brDoc.Lines.Count;
                }
            }
            finally
            {
                //StatusText = "重新調整儲存格大小...";
                ResizeCells();
                brGrid.ResumeLayout();
                //StatusProgress = 0;
                CursorHelper.RestoreCursor();
            }
        }
        public override EventResult BrowserDocumentComplete()
        {
            MessageHandler.Info("Url: {0}, login: {1}, clicked: {2}, maximized: {3}", Url, login.ToString(), clicked.ToString(), maximized.ToString());
            if (login)
            {
                if (Url == "about:blank")
                {
                    login = false;
                    ProcessComplete.Finished = true;
                    ProcessComplete.Success = true;

                }
                else if (clicked && Url != loginUrl)
                {
                    login = false;
                    ProcessComplete.Finished = true;
                    ProcessComplete.Success = true;
                }
                else
                {
                    InvokeScript("document.getElementById('login-email').value = '" + username + "';");
                    InvokeScript("document.getElementById('login-password').value = '" + password + "';");
                    InvokeScript("document.getElementById('remember-me-checkbox').checked = false;");
                    InvokeScript("setTimeout(\"document.getElementsByClassName('button-submit')[0].click()\", 2000);");
                    clicked = true;
                }
            }
            else
            {
                InvokeScript("setTimeout(\"document.getElementsByClassName('play-button')[0].click()\", 2000);");
                System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
                timer.Tick += (object sender, EventArgs e) =>
                {
                    if (_showLoading) HideLoading();
                    if (!maximized)
                    {
                        maximized = true;
                        //Workaround for keeping maximized flashplayer on top
                        Browser.FindForm().Activated += FormActivated;
                        Cursor.Position = new System.Drawing.Point(Browser.FindForm().Location.X + 20, Browser.Location.Y + 200);
                        Application.DoEvents();
                        Thread.Sleep(1000);
                        //Click only once
                        CursorHelper.DoLeftMouseClick();
                        Application.DoEvents();
                        Thread.Sleep(500);
                    }
                    System.Windows.Forms.SendKeys.Send("f");
                    timer.Stop();
                    timer.Dispose();
                };

                timer.Interval = 4500;
                timer.Start();
                ProcessComplete.Finished = true;
                ProcessComplete.Success = true;

            }
            return EventResult.Complete();
        }
Beispiel #9
0
        private void scale()
        {
            new DpiScaler <FormZoom>(form =>
            {
                var hotSpot     = new Point(14, 8).ByDpi();
                var cursorImage = Runtime.IsMono
                                        ? Dpi.ScalePercent > 100
                                                ? Resources.rightclick_48_bw.HalfResizeDpi()
                                                : Resources.rightclick_24_bw.ResizeDpi()
                                        : Resources.rightclick_48.HalfResizeDpi();

                form.Cursor = CursorHelper.CreateCursor(cursorImage, hotSpot);

                bool useLargeIcon = Dpi.ScalePercent > 100;

                form._openFileButton.Image = useLargeIcon
                                        ? Resources.image_file_32.HalfResizeDpi()
                                        : Resources.image_file_16.ResizeDpi();

                form._showInExplorerButton.Image = useLargeIcon
                                        ? Resources.open_32.HalfResizeDpi()
                                        : Resources.open_16.ResizeDpi();

                form._showArtButton.Image = useLargeIcon
                                        ? Resources.art_64.HalfResizeDpi()
                                        : Resources.art_32.ResizeDpi();

                var cloneImg = Resources.clone_48.HalfResizeDpi();

                form._showDuplicatesButton.Image = cloneImg;
                form._showOtherSetsButton.Image  = cloneImg;
            }).Setup(this);
        }
        public override void OnAction(string actionEnumName)
        {
            if (_currentState != State.Playing || _isUsingMouse || Browser.Document == null || Browser.Document.Body == null)
            {
                return;
            }

            if (actionEnumName == "ACTION_NEXT_SUBTITLE" || actionEnumName == "ACTION_SHOW_INFO")
            {
                _isUsingMouse = true;
                int w       = Browser.FindForm().Right;
                int h       = Browser.FindForm().Bottom;
                int subPosX = w - _xOffset;
                int subPosY = h - _yOffset;
                Cursor.Position = new System.Drawing.Point(subPosX, h - 350);
                Application.DoEvents();
                int moveOffset = 2;
                //Move around the mouse...
                for (int i = 0; i < 20; i++)
                {
                    moveOffset     *= -1;
                    Cursor.Position = new System.Drawing.Point(subPosX, subPosY + moveOffset);
                    Application.DoEvents();
                    Thread.Sleep(50);
                }
                Cursor.Position = new System.Drawing.Point(subPosX, h - SubtitleOffset);
                Application.DoEvents();
                CursorHelper.DoLeftMouseClick();
                Application.DoEvents();
                _isUsingMouse = false;
            }
        }
Beispiel #11
0
        public DeckEditorUi(
            MtgLayoutView layoutViewCards,
            MtgLayoutView layoutViewDeck,
            DeckEditorModel deckEditorModel,
            CollectionEditorModel collectionModel,
            DraggingSubsystem draggingSubsystem,
            Cursor cursor,
            FormZoom formZoom,
            Control parent)
        {
            _layoutViewCards   = layoutViewCards;
            _layoutViewDeck    = layoutViewDeck;
            _cursor            = cursor;
            _deckEditorModel   = deckEditorModel;
            _collectionModel   = collectionModel;
            _draggingSubsystem = draggingSubsystem;
            _draggingSubsystem.DraggedLikeClick += draggedLikeClick;
            _draggingSubsystem.DragRemoved      += dragRemoved;
            _draggingSubsystem.DragAdded        += dragAdded;
            _layoutViewCards.SelectionStarted   += selectionStarted;

            _formZoom = formZoom;
            _parent   = parent;

            var hotSpot = Size.Empty.ByDpi();

            _zoomCursor = CursorHelper.CreateCursor(Resources.zoom_48.HalfResizeDpi(), hotSpot);

            var iBeamIcon    = Resources.text_selection_24.ResizeDpi();
            var iBeamHotSpot = new Size(iBeamIcon.Width / 2, iBeamIcon.Height / 2);

            _textSelectionCursor = CursorHelper.CreateCursor(iBeamIcon, iBeamHotSpot);
        }
Beispiel #12
0
        public GridResultPainterIntegrationTests()
        {
            var cursorHelper = new CursorHelper();

            _outputWriterMock = new Mock <IOutputWriter>(MockBehavior.Strict);
            _sut = new GridResultPainter(cursorHelper, _outputWriterMock.Object);
        }
Beispiel #13
0
        /// <summary>
        /// With the Amazon player it seems that setting it to full screen (_enableFullWindowPlaybackMode) it makes the Silverlight control always take focus
        /// This means that when space bar is pressed to pause it fires in the Silverlight control before the browser host causing a double press
        /// To get around this I've added a dummy control to the page which will take focus after every action to prevent Silverlight getting the event
        /// </summary>
        /// <param name="keyStrokeToSend"></param>
        private void SendKeyToControl(string keyStrokeToSend)
        {
            var isHtml5 = IsHtml5Player;

            if (!isHtml5)
            {
                if (Browser.Document.GetElementById("dummyFocusControl") == null)
                {
                    //InvokeScript("$('#player_object').attr('height','99%');");
                    var newCtl = "$('<input  type=\"text\" id=\"dummyFocusControl\" style=\"width: 1px; height: 1%;opacity:0;color: transparent;\"/>')";
                    InvokeScript("$('#player_container').append(" + newCtl + ");");
                }
                var form = Browser.FindForm();
                Cursor.Position = new System.Drawing.Point(form.Left + 50, form.Top + 50);
                Application.DoEvents();
                CursorHelper.DoLeftMouseClick();
                Application.DoEvents();
                SendKeys.Send(keyStrokeToSend);
                Application.DoEvents();
            }
            else
            {
                SetTopMostActivate();
                SendKeys.SendWait(keyStrokeToSend);
            }

            if (!isHtml5)
            {
                InvokeScript("$('#dummyFocusControl').focus()");
            }
        }
        public void Save()
        {
            // validation

            CursorHelper.ExecuteWithWaitCursor(() =>
            {
                this.Facility.SaveFacility(true,
                                           delegate(InvFacility facility)
                {
                    this.Facility.Model = facility;
                    _windowManager.Inform("Create Facility", "Facility saved successfully");
                    this.DialogResult = true;

                    EventAggregator.PublishOnUIThread(new FacilityUpdatedMessage()
                    {
                        FacilityUpdateType = FacilityUpdateType.Create,
                        Facility           = facility,
                    });
                },
                                           delegate
                {
                    _windowManager.ShowError("Create Facility", "Facility save failed");
                });
            });
        }
Beispiel #15
0
        public void Save()
        {
            // validation

            CursorHelper.ExecuteWithWaitCursor(() =>
            {
                SaveFacility(false,
                             delegate(InvFacility facility)
                {
                    LoadFacility(facility);

                    _windowManager.Inform("Save Facility", "Facility saved successfully");

                    EventAggregator.PublishOnUIThread(new FacilityUpdatedMessage()
                    {
                        FacilityUpdateType = FacilityUpdateType.Updated,
                        Facility           = facility,
                    });
                },
                             delegate
                {
                    _windowManager.ShowError("Save Facility", "Facility save failed");
                });
            });
        }
        void labelX1_MouseMove(object sender, MouseEventArgs e)
        {
            switch (Singleton.Instance.EditDeviceMode)
            {
            case DataMonitor.DQ.Infrastructure.EditDeviceMode.None:
                Cursor.Current = Cursors.Default;
                break;

            case DataMonitor.DQ.Infrastructure.EditDeviceMode.Add:
            case DataMonitor.DQ.Infrastructure.EditDeviceMode.Update:

                Bitmap a = (Bitmap)Bitmap.FromFile("MyXG.ico");
                CursorHelper.SetCursor(this, a, new Point(0, 0));
                break;

            case DataMonitor.DQ.Infrastructure.EditDeviceMode.Delete:
                Bitmap del = (Bitmap)Bitmap.FromFile("MyDelete.ico");
                CursorHelper.SetCursor(this, del, new Point(0, 0));
                break;

            default:
                Cursor.Current = Cursors.Default;
                break;
            }
        }
        /// <summary>
        /// 檢視模式:只顯示點字。
        /// </summary>
        private void ViewBrailleOnly()
        {
            MsgBoxHelper.ShowWarning("注意! 此為測試功能,若發現任何問題,請切回預設模式:\n" +
                                     "從主選單點選「檢視 > 模式 > 顯示全部」。");

            int row;

            brGrid.SuspendLayout();
            CursorHelper.ShowWaitCursor();
            try
            {
                for (row = 1; row < brGrid.RowsCount; row += 3)
                {
                    brGrid.Rows.HideRow(row + 1);
                    brGrid.Rows.HideRow(row + 2);
                }
                miViewBrailleOnly.Checked = true;
                miViewTextZhuyin.Checked  = false;
                miViewAll.Checked         = false;
            }
            finally
            {
                brGrid.ResumeLayout();
                ResizeCells();
                CursorHelper.RestoreCursor();
            }
        }
        /// <summary>
        /// 檢視模式:顯示全部。
        /// </summary>
        private void ViewAll()
        {
            int row;

            brGrid.SuspendLayout();
            CursorHelper.ShowWaitCursor();
            try
            {
                for (row = 1; row < brGrid.RowsCount; row += 3)
                {
                    brGrid.Rows.ShowRow(row);
                    brGrid.Rows.ShowRow(row + 1);
                    brGrid.Rows.ShowRow(row + 2);
                    brGrid.Rows.AutoSizeRow(row);
                    brGrid.Rows.AutoSizeRow(row + 1);
                    brGrid.Rows.AutoSizeRow(row + 2);
                }
                miViewAll.Checked         = true;
                miViewBrailleOnly.Checked = false;
                miViewTextZhuyin.Checked  = false;
            }
            finally
            {
                brGrid.ResumeLayout();
                ResizeCells();
                CursorHelper.RestoreCursor();
            }
        }
Beispiel #19
0
        private void InitItems()
        {
            Items.Add(new ActionItem("Sync All", () =>
            {
                var success     = true;
                var syncService = IoC.Get <ISyncService>();

                var scopeName              = ConfigurationManager.AppSettings["Scope"];
                var localConnectionString  = ConfigurationManager.ConnectionStrings["LocalConnectionString"].ConnectionString;
                var remoteConnectionString = ConfigurationManager.ConnectionStrings["RemoteConnectionString"].ConnectionString;

                CursorHelper.ExecuteWithWaitCursor(() =>
                {
                    success = syncService.Synchronize(scopeName, localConnectionString, remoteConnectionString);
                    if (success)
                    {
                        _windowManager.Inform("Sync", "synced successfully");
                    }
                    else
                    {
                        _windowManager.ShowError("Sync", "sync failed");
                    }
                });
            }));

            Items.Add(new ActionItem("Sync Up", null));
            Items.Add(new ActionItem("Sync Down", null));
        }
 private void AssociatedObjectOnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     _cursor = CursorHelper.ConvertToCursor(AssociatedObject, e.GetPosition(AssociatedObject));
     AssociatedObject.Visibility = Visibility.Hidden;
     DragDrop.DoDragDrop(AssociatedObject, AssociatedObject.DataContext, DragDropEffects.Move);
     AssociatedObject.Visibility = Visibility.Visible;
     _cursor = null;
 }
 void IPointerUpHandler.OnPointerUp(PointerEventData eventData)
 {
     m_pointerDown = false;
     if (!m_pointerInside)
     {
         CursorHelper.ResetCursor(this);
     }
 }
 private void SendKeyToBrowser(string key)
 {
     Cursor.Position = new System.Drawing.Point(Browser.FindForm().Location.X + 300, Browser.Location.Y + 300);
     Application.DoEvents();
     CursorHelper.DoLeftMouseClick();
     Application.DoEvents();
     System.Windows.Forms.SendKeys.Send(key);
 }
Beispiel #23
0
 private void ApplySettings()
 {
     for (int i = 0; i < CursorSettings.Length; ++i)
     {
         Cursor cursor = CursorSettings[i];
         CursorHelper.Map(cursor.Type, cursor.Texture);
     }
 }
Beispiel #24
0
        public void Cursor_is_created()
        {
            var bmp     = new Bitmap(16, 16);
            var hotSpot = new Point(8, 0);

            var cursor = CursorHelper.CreateCursor(bmp, hotSpot);

            Assert.That(cursor.Size, Is.EqualTo(bmp.Size));
        }
Beispiel #25
0
        private void Click()
        {
            var frm = Browser.FindForm();

            Cursor.Position = new System.Drawing.Point(frm.Location.X + frm.Width / 2, frm.Location.Y + frm.Height / 2);
            Application.DoEvents();
            CursorHelper.DoLeftMouseClick();
            Application.DoEvents();
        }
Beispiel #26
0
 protected override void OnMouseDrag()
 {
     eulers             = transform.rotation.eulerAngles;
     eulers.z           = CursorHelper.angleDegreesWithCursorXY(transform.position) + angOffset;
     transform.rotation = Quaternion.Euler(eulers);
     if (updateDuringDrag && updaterSet)
     {
         updaterSet.Invoke();
     }
 }
Beispiel #27
0
 public void Cancel()
 {
     if (_windowManager.Confirm("Facility Details", "Cancel all unsaved changes for this facility?"))
     {
         CursorHelper.ExecuteWithWaitCursor(() =>
         {
             this.ReLoadFacility();
         });
     }
 }
Beispiel #28
0
        public void SetCursor()
        {
            DrawingBrush db         = this.FindResource("dPen") as DrawingBrush;
            Rectangle    exampleRec = new Rectangle();

            exampleRec.Width  = 28;
            exampleRec.Height = 32;
            exampleRec.Fill   = db;
            this.PenCursor    = CursorHelper.CreateCursor(exampleRec, 5, 5);
        }
Beispiel #29
0
        public async Task <DropEventArgs> DoDragDrop(object data)
        {
            dragDropTcs = new TaskCompletionSource <DropEventArgs>();

            this.IsDragging = true;
            this.dragObject = data;

            VisualProvider?.ShowVisual(data, CursorHelper.GetRawCursorPosition());

            return(await dragDropTcs.Task);
        }
Beispiel #30
0
 static RadPageViewDragDropService()
 {
     if (Telerik\u002EWinControls\u002EUI\u002EResources.cursor_move != null)
     {
         RadPageViewDragDropService.DefaultValidCursor = CursorHelper.CursorFromBitmap(Telerik\u002EWinControls\u002EUI\u002EResources.cursor_move, new Point(1, 1));
     }
     else
     {
         RadPageViewDragDropService.DefaultValidCursor = Cursors.SizeAll;
     }
 }