static CursorsImplementation() { using (var stream = NativeResources.GetGrabCursor()) GrabCursor = new System.Windows.Input.Cursor(stream); using (var stream = NativeResources.GetGrabbingCursor()) GrabbingCursor = new System.Windows.Input.Cursor(stream); }
/// <summary> /// Open a log folder. /// </summary> /// <param name="uri">path to a log folder.</param> private static void UseShellExecute(string path) { // Switch the wait cursor since shellexec can take a second or so. System.Windows.Input.Cursor cursor = WixBA.View.Cursor; WixBA.View.Cursor = System.Windows.Input.Cursors.Wait; Process process = null; try { process = new Process(); process.StartInfo.FileName = path; process.StartInfo.UseShellExecute = true; process.StartInfo.Verb = "open"; process.Start(); } finally { if (null != process) { process.Dispose(); } // back to the original cursor. WixBA.View.Cursor = cursor; } }
private void testButton_Click(object sender, RoutedEventArgs e) { System.Windows.Input.Cursor mycursor = this.Cursor; try { String mydriver; String msg = null; mydriver = comboBoxDriver.SelectedItem.ToString(); this.Cursor = System.Windows.Input.Cursors.Wait; Boolean success = Program.TestConnection(mydriver, ConnectionString, userTextBox.Text.Trim(), passwordBox.Password.Trim(), out msg); this.Cursor = mycursor; if (success) { MessageBox.Show(String.Format("Connection SUCCESS.\r\n\r\ndriver:\t{0}\r\nurl:\t{1}", mydriver, ConnectionString), this.Title, System.Windows.Forms.MessageBoxButtons.OK); } else { MessageBox.Show(String.Format("Connection FAILED.\r\n\r\ndriver:\t{0}\r\nurl:\t{1}\r\n\r\n{2}", mydriver, ConnectionString, msg), this.Title, System.Windows.Forms.MessageBoxButtons.OK); } } catch (Exception ex) { this.Cursor = mycursor; MessageBox.Show(String.Format("Unexpected error: {0}\r\n\r\nurl:\t{1}", ConnectionString, ex.Message), this.Title, System.Windows.Forms.MessageBoxButtons.OK); } }
private void AcquireServiceProxy(ProxyEntryInformation dataContext) { System.Threading.Thread.Sleep(10); Dispatcher.Invoke(() => { System.Windows.Input.Cursor currentCursor = Cursor; try { Cursor = System.Windows.Input.Cursors.Wait; OnProxyEntered(this, dataContext); container.IsEnabled = true; Cursor = currentCursor; this.Close(); } catch (Exception ex) { container.IsEnabled = true; Cursor = currentCursor; MessageBox.Show(ex.Message); } }); }
protected override void OnMouseEnter(System.Windows.Input.MouseEventArgs e) { if (this.Parent != null && this.Parent is System.Windows.Controls.Canvas) { default_cursor = ((System.Windows.Controls.Canvas) this.Parent).Cursor; ((System.Windows.Controls.Canvas) this.Parent).Cursor = System.Windows.Input.Cursors.Hand; } }
public void Paste() { System.Windows.Input.Cursor cursor = System.Windows.Input.Mouse.OverrideCursor; System.Windows.Input.Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; textArea.Paste(); System.Windows.Input.Mouse.OverrideCursor = cursor; }
public DatabaseAttributesViewModel() { System.Windows.Input.Cursor previousCursor = System.Windows.Input.Mouse.OverrideCursor; System.Windows.Input.Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; DatabaseAttributes = new DatabaseAttributes(((ViewModelLocator)System.Windows.Application.Current.FindResource("Locator")).ApplicationVM.Application); System.Windows.Input.Mouse.OverrideCursor = previousCursor; RunProcessCommand = new RelayCommand(RunProcess); CanRunProcess = !string.IsNullOrEmpty(NewDatabaseName); SelectedTransferTypeIndex = 0; }
public void LoadDataFromFile(string path) { System.Windows.Input.Cursor cursor = System.Windows.Input.Mouse.OverrideCursor; System.Windows.Input.Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; try { if (File.Exists(path)) { textArea.Text = File.ReadAllText(path); //string spaces = ""; //for (int i = 0; i < textArea.TabWidth; i++) spaces += " "; //textArea.Text = textArea.Text.Replace(spaces, "\t"); lexer.IsDirty = false; filepath = path; if (Properties.Settings.Default.MRU.Contains(filepath)) { Properties.Settings.Default.MRU.Remove(filepath); } Properties.Settings.Default.MRU.Insert(0, filepath); List <int> lines = new List <int>(); MainWindow.breakpoints.TryGetValue(path, out lines); if (null != lines) { foreach (int iLine in lines) { if (iLine >= 0 && iLine < textArea.Lines.Count) { textArea.Lines[iLine].MarkerAdd(BREAKPOINT_MARKER); } } } MainWindow.bookmarks.TryGetValue(path, out lines); if (null != lines) { foreach (int iLine in lines) { if (iLine >= 0 && iLine < textArea.Lines.Count) { textArea.Lines[iLine].MarkerAdd(BOOKMARK_MARKER); } } } } } catch (Exception ex) { MainWindow.Errors.Add(new Error("Load File : " + ex.Message)); } System.Windows.Input.Mouse.OverrideCursor = cursor; }
private void LoadDatabaseNames() { System.Windows.Input.Cursor previousCursor = System.Windows.Input.Mouse.OverrideCursor; System.Windows.Input.Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; Logger logger = ((ViewModelLocator)System.Windows.Application.Current.FindResource("Locator")).ApplicationVM.Application.AppLogger.Logger; List <string> databaseNames = SelectDatabase.GetLocalDatabaseNames(logger); if (databaseNames != null) { LocalDatabaseNames = new ObservableCollection <string>(databaseNames.OrderBy(name => name)); } System.Windows.Input.Mouse.OverrideCursor = previousCursor; }
public void UnCommentFile() { System.Windows.Input.Cursor cursor = System.Windows.Input.Mouse.OverrideCursor; System.Windows.Input.Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; string search = "' The following line could be harmful and has been automatically commented."; TextArea.TargetStart = 0; TextArea.TargetEnd = TextArea.TextLength; TextArea.SearchFlags = MainWindow.searchFlags; while (TextArea.SearchInTarget(search) != -1) { // Uncomment File command int iLine = textArea.LineFromPosition(textArea.TargetStart); Line line = textArea.Lines[iLine]; int iStart = line.Position; int iEnd = line.EndPosition; textArea.SetTargetRange(iStart, iEnd); textArea.ReplaceTarget(""); lexer.IsDirty = true; if (iLine < textArea.Lines.Count) { line = textArea.Lines[iLine]; iStart = line.Position; iEnd = line.EndPosition; string text = line.Text; int pos = text.TakeWhile(c => char.IsWhiteSpace(c)).Count(); if (pos < text.Length - 1 && text[pos] == '\'' && text[pos + 1] == ' ') { text = text.Remove(pos, 2); textArea.SetTargetRange(iStart, iEnd); textArea.ReplaceTarget(text); } } // Search the remainder of the document iEnd = textArea.TargetEnd; textArea.TargetStart = iEnd; if (textArea.TargetStart != iEnd) { break; //No idea why this is necessary sometimes } textArea.TargetEnd = textArea.TextLength; } System.Windows.Input.Mouse.OverrideCursor = cursor; }
public void LoadDataFromText(string program) { System.Windows.Input.Cursor cursor = System.Windows.Input.Mouse.OverrideCursor; System.Windows.Input.Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; try { textArea.Text = program; //string spaces = ""; //for (int i = 0; i < textArea.TabWidth; i++) spaces += " "; //textArea.Text = textArea.Text.Replace(spaces, "\t"); lexer.IsDirty = true; } catch (Exception ex) { MainWindow.Errors.Add(new Error("Load Text : " + ex.Message)); } System.Windows.Input.Mouse.OverrideCursor = cursor; }
public MouseCursorOverrider(System.Windows.Input.Cursor cursorToBeShown) { oldValue = System.Windows.Input.Mouse.OverrideCursor; System.Windows.Input.Mouse.OverrideCursor = cursorToBeShown; }
internal void SetFromWpf(System.Windows.Input.Cursor Cursor) { this.WpfCursor = Cursor; }
internal void SetFromForms(System.Windows.Forms.Cursor Cursor) { this.FormsCursor = Cursor; this.WpfCursor = GetWpfIcon(this.FormsCursor); }
internal void SetFromBitmap(Bitmap Bitmap, int HotX, int HotY) { this.FormsCursor = GetFormsIcon(Bitmap, HotX, HotY); this.WpfCursor = GetWpfIcon(this.FormsCursor); }
/// <summary> /// Creats a new cursor from a Windows Presentation Foundation cursor (System.Windows.Input). /// </summary> /// <param name="Cursor"></param> public SmartCursor(System.Windows.Input.Cursor Cursor) { SetFromWpf(Cursor); }
public void Format() { System.Windows.Input.Cursor cursor = System.Windows.Input.Mouse.OverrideCursor; System.Windows.Input.Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; for (int i = 0; i < textArea.Lines.Count; i++) { string text = textArea.Lines[i].Text.TrimEnd(); if (i < textArea.Lines.Count - 1) { text += "\r\n"; } if (text != textArea.Lines[i].Text) { textArea.SetTargetRange(textArea.Lines[i].Position, textArea.Lines[i].EndPosition); textArea.ReplaceTarget(text); } } for (int i = textArea.Lines.Count - 1; i > 0; i--) { if (string.IsNullOrWhiteSpace(textArea.Lines[i].Text) && string.IsNullOrWhiteSpace(textArea.Lines[i - 1].Text)) { textArea.SetTargetRange(textArea.Lines[i - 1].Position, textArea.Lines[i - 1].EndPosition); textArea.ReplaceTarget(""); } } int foldBase = textArea.Lines[0].FoldLevel; int fold = foldBase; for (int lineCur = 0; lineCur < textArea.Lines.Count; lineCur++) { textArea.Lines[lineCur].FoldLevel = fold; string text = textArea.Lines[lineCur].Text.Trim().ToUpper(); if (keyword1.Match((' ' + text + ' ').ToUpper()).Value.Length > 0) { fold++; textArea.Lines[lineCur].FoldLevelFlags = FoldLevelFlags.Header; } else if (keyword2.Match((' ' + text + ' ').ToUpper()).Value.Length > 0) { fold--; textArea.Lines[lineCur].FoldLevel--; textArea.Lines[lineCur].FoldLevelFlags = FoldLevelFlags.White; if (fold < foldBase) { fold = foldBase; } } else if (keyword3.Match((' ' + text + ' ').ToUpper()).Value.Length > 0) { textArea.Lines[lineCur].FoldLevel--; textArea.Lines[lineCur].FoldLevelFlags = FoldLevelFlags.White; if (fold < foldBase) { fold = foldBase; } } int foldCur = textArea.Lines[lineCur].FoldLevel - foldBase; string indents = ""; for (int i = 0; i < foldCur; i++) { indents += spaces; } int iStart = textArea.Lines[lineCur].Position; string lineText = textArea.Lines[lineCur].Text; int iLen = 0; while (iLen < lineText.Length && char.IsWhiteSpace(lineText[iLen]) && lineText[iLen] != '\r' && lineText[iLen] != '\n') { iLen++; } textArea.SetTargetRange(iStart, iStart + iLen); textArea.ReplaceTarget(indents); } foreach (string keyword in keywords.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries)) { int pos = 0; Match match = Regex.Match(' ' + textArea.Text.Substring(pos).ToUpper() + ' ', "[\\W](" + keyword.ToUpper() + ")[\\W]"); while (match.Success) { int start = Math.Max(0, pos + match.Index); int len = match.Length - 2; int style = sbDocument.TextArea.GetStyleAt(start); if (style == STYLE_KEYWORD) { sbDocument.TextArea.SetTargetRange(start, start + len); sbDocument.TextArea.ReplaceTarget(keyword); } pos += match.Index + len; if (pos >= textArea.Text.Length) { break; } match = Regex.Match(' ' + textArea.Text.Substring(pos).ToUpper() + ' ', "[\\W](" + keyword.ToUpper() + ")[\\W]"); } } isDirty = true; System.Windows.Input.Mouse.OverrideCursor = cursor; }
public void SetMouseCursor(System.Windows.Input.Cursor cursor) { this.renderViewControl.SetCursor(cursor); }