public void AddItem(QueryWindow child) { items.Add(child); string[] lines = new string[items.Count]; string line; QueryWindow item; for (int i = 0; i < items.Count; i++) { item = (QueryWindow)items[i]; if (item.Filename == null) { line = item.Text; if (line[line.Length - 1] == '*') { line = line.Substring(0, line.Length - 2); } lines[i] = line; } else { lines[i] = item.Filename; } } itemBox.Lines = lines; itemBox.SelectionLength = 0; }
public void ShowModalControl() { QueryWindow.SetDbName(rblCompany.SelectedItem.Value); QueryWindow.ClearInput(); this.ShowControl(ModalPanel.ClientID, rblCompany.SelectedItem.Text + "查詢"); //如何控制使用者控制介面的格式 //久威國際查詢這個字串事傳到哪裡去呢 }
public static void QueryWindowVisible(bool?show = null, bool supressAnalysis = false) { if (QueryWindow == null) { QueryWindow = new QueryWindow(); Icon queryWindowIcon; using (var newBmp = new Bitmap(16, 16)) { var g = Graphics.FromImage(newBmp); ColorMap[] colorMap = { new ColorMap { OldColor = Color.Fuchsia, NewColor = Color.FromKnownColor(KnownColor.ButtonFace) } }; var attr = new ImageAttributes(); attr.SetRemapTable(colorMap); g.DrawImage(Properties.Resources.cq, new Rectangle(0, 0, 16, 16), 0, 0, 16, 16, GraphicsUnit.Pixel, attr); queryWindowIcon = Icon.FromHandle(newBmp.GetHicon()); } var queryWindowData = new NppTbData { hClient = QueryWindow.Handle, pszName = "CSV Query", dlgID = PluginBase.GetMenuItemId("Toggle query window"), uMask = NppTbMsg.DWS_DF_CONT_BOTTOM | NppTbMsg.DWS_ICONTAB | NppTbMsg.DWS_ICONBAR, hIconTab = (uint)queryWindowIcon.Handle, pszModuleName = PluginName }; var queryWindowPointer = Marshal.AllocHGlobal(Marshal.SizeOf(queryWindowData)); Marshal.StructureToPtr(queryWindowData, queryWindowPointer, false); Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_DMMREGASDCKDLG, 0, queryWindowPointer); // Analyze current file if (!supressAnalysis) { QueryWindow.StartAnalysis(true); } } else { if (show ?? !QueryWindow.Visible) { Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_DMMSHOW, 0, QueryWindow.Handle); Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_SETMENUITEMCHECK, PluginBase.GetMenuItemId("Toggle query window"), 1); } else { Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_DMMHIDE, 0, QueryWindow.Handle); Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_SETMENUITEMCHECK, PluginBase.GetMenuItemId("Toggle query window"), 0); } } }
void OnShowQueryWindow(object sender, DatabaseConnectionInfoEventArgs e) { var model = GetQueryModel(e.ConnectionInfo); var viewModel = new QueryVM(model); viewModel.ConnectionInfo = e.ConnectionInfo; var window = new QueryWindow(viewModel); window.Show(); }
private void TextBlock_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { Int32 queryId = (Int32)((TextBlock)sender).Tag; String command = this.lastQueries.Where(obj => obj.Id == queryId).First().Command; QueryWindow window = new QueryWindow(command); window.ShowDialog(); }