/// <summary> /// Render out the correct markup for the tree /// </summary> /// <remarks> /// Since we're inheriting from a UserControl, we need to render out the markup manually /// </remarks> /// <param name="writer"></param> protected override void Render(System.Web.UI.HtmlTextWriter writer) { //You'll notice that we're replacing the 'serviceUrl' parameter with our own custom web service! writer.Write(@" <script type=""text/javascript""> jQuery(document).ready(function() { var ctxMenu = " + GetJSONContextMenu() + @"; var app = """ + App + @"""; var showContext = " + ShowContextMenu.ToString().ToLower() + @"; var isDialog = " + IsDialog.ToString().ToLower() + @"; var dialogMode = """ + DialogMode.ToString() + @"""; var treeType = """ + TreeType + @"""; var functionToCall = """ + FunctionToCall + @"""; var nodeKey = """ + NodeKey + @"""; //create the javascript tree jQuery(""#" + ClientID + @""").UmbracoTree({ doNotInit: " + ManualInitialization.ToString().ToLower() + @", jsonFullMenu: ctxMenu, appActions: UmbClientMgr.appActions(), deletingText: '" + umbraco.ui.GetText("deleting") + @"', app: app, showContext: showContext, isDialog: isDialog, dialogMode: dialogMode, treeType: treeType, functionToCall : functionToCall, nodeKey : nodeKey, treeMode: """ + Mode.ToString().ToLower() + @""", dataUrl: """ + IOHelper.ResolveUrl(SystemDirectories.Umbraco) + @"/webservices/TreeDataService.ashx"", serviceUrl: """ + IOHelper.ResolveUrl(SystemDirectories.Umbraco) + @"/controls/Tree/CustomTreeService.asmx/GetInitAppTreeData""}); //add event handler for ajax errors, this will refresh the whole application var mainTree = UmbClientMgr.mainTree(); if (mainTree != null) { mainTree.addEventHandler(""ajaxError"", function(e) { if (e.msg == ""rebuildTree"") { UmbClientMgr.mainWindow(""umbraco.aspx""); } }); } }); </script>"); //render the controls TreeContainer.RenderControl(writer); }
protected override void OnMouseClick(MouseEventArgs e) { if (e.Button == MouseButtons.Right) { var hit = HitTest(e.X, e.Y); if (hit != null && hit.Type == DataGridViewHitTestType.Cell) { ClearSelection(); Rows[hit.RowIndex].Cells[hit.ColumnIndex].Selected = true; base.OnMouseClick(e); ShowContextMenu?.Invoke(this, new ContextMenuEventArgs(e.X, e.Y)); return; } } base.OnMouseClick(e); }
protected override void WndProc(ref Message m) { if (m.Msg == 0x007B) { if (ShowContextMenu != null) { Point location = m.LParam.ToPoint(); if (location.X == -1 && location.Y == -1) { var pos = Caret.ScreenPosition; ShowContextMenu?.Invoke(this, new MouseEventArgs(MouseButtons.None, clicks: 0, pos.X, pos.Y + TextArea.TextView.FontHeight, delta: 0)); } else { var pos = PointToClient(location); ShowContextMenu?.Invoke(this, new MouseEventArgs(MouseButtons.Right, clicks: 1, pos.X, pos.Y, delta: 0)); } } } base.WndProc(ref m); }
public MainViewModel(Repository repository, IParser parser, KeywordExtractor keywordExtractor, State state) { _repository = repository; _parser = parser; _keywordExtractor = keywordExtractor; _state = state; SaveCommand = new RelayCommand(_ => Save()); SyncCommand = new RelayCommand(_ => Sync()); NextDayCommand = new RelayCommand(_ => NextDay()); PreviousDayCommand = new RelayCommand(_ => PreviousDay()); InsertCommand = new RelayCommand(_ => Insert()); _timer = new Timer(1000) { Enabled = false }; _timer.Elapsed += Timer_Elapsed; _text = _repository.Load(); _todo = _repository.LoadToDo(); Find = new Find(state); FindNext = new FindNext(state); FindPrevious = new FindPrevious(state); Goto = new Goto(state); ShowContextMenu = new ShowContextMenu(state); FormatSelectionBase64Decode = new FormatSelectionBase64Decode(state); FormatSelectionBase64Encode = new FormatSelectionBase64Encode(state); FormatSelectionDecodeUrl = new FormatSelectionDecodeUrl(state); FormatSelectionEncodeUrl = new FormatSelectionEncodeUrl(state); FormatSelectionToLower = new FormatSelectionToLower(state); FormatSelectionToUpper = new FormatSelectionToUpper(state); SpellCheck = new SpellCheck(state); EnsureDateLine(); }
/// <summary> /// Return a serialized string of values for the pre value editor model /// </summary> /// <returns></returns> public override string GetSerializedValue() { var xml = new XElement("preValues", new XElement("preValue", new XAttribute("name", "ShowLabel"), new XCData(ShowLabel.ToString())), new XElement("preValue", new XAttribute("name", "ShowContextMenu"), new XCData(ShowContextMenu.ToString())), new XElement("preValue", new XAttribute("name", "Size"), new XCData(Size.Width + "x" + Size.Height)), new XElement("preValue", new XAttribute("name", "Features"), new XCData( string.Join(",", Features .Where(x => x.Selected) .Select(x => x.Value).ToArray()))), new XElement("preValue", new XAttribute("name", "Stylesheets"), new XCData( string.Join(",", Stylesheets .Where(x => x.Selected) .Select(x => x.Value).ToArray()))), new XElement("preValue", new XAttribute("name", "IsRequired"), new XCData(IsRequired.ToString()))); if (!ValidElements.IsNullOrWhiteSpace()) { xml.Add(new XElement("preValue", new XAttribute("name", "validElements"), new XCData(ValidElements.Trim()))); } return(xml.ToString()); }