/// <summary> /// Handles the Activated event of the MainWindow control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> private void MainWindow_Activated(object sender, EventArgs e) { List <Window> windows = Application.Current.Windows.OfType <Window>( ).ToList( ); Window window = windows.FirstOrDefault(p => !p.Equals(this) && !p.IsActive); window?.Activate( ); }
private void KneeboardCommand_OnExecuted(object sender, ExecutedRoutedEventArgs e) { if (Application.Current.Windows.OfType <KneeboardEditorWindow>().Any()) { Window window = Application.Current.Windows.OfType <KneeboardEditorWindow>().FirstOrDefault(); window?.Activate(); } else { KneeboardEditorWindow window = new KneeboardEditorWindow(); window.Show(); } }
public ErrorCodes Execute(UnicontaBaseEntity master, UnicontaBaseEntity currentRow, IEnumerable <UnicontaBaseEntity> source, string command, string args) { if (!IsWindowOpen <Window>("ToftImport")) { MainWindow form = new MainWindow(); form.Name = "ToftImport"; form.ShowDialog(); return(ErrorCodes.Succes); } else { Window wnd = Application.Current.Windows.OfType <Window>().FirstOrDefault(w => w.Name.Equals("ToftImport")); wnd?.Activate(); return(ErrorCodes.Succes); } }
/// <summary> /// Replaces the text. /// </summary> /// <param name="instance">The instance.</param> /// <param name="text">The text.</param> /// <param name="replacementText">The replacement text.</param> /// <param name="findOptions">The find options.</param> public static void ReplaceText( this ProjectItem instance, string text, string replacementText, int findOptions = (int)vsFindOptions.vsFindOptionsMatchCase) { TraceService.WriteLine("ProjectItemExtensions::ReplaceText in file " + instance.Name + " from '" + text + "' to '" + replacementText + "'"); if (instance.Kind == VSConstants.VsProjectItemKindPhysicalFolder) { foreach (ProjectItem projectItem in instance.ProjectItems.Cast <ProjectItem>()) { projectItem.ReplaceText(text, replacementText); } return; } try { Window window = instance.Open(VSConstants.VsViewKindCode); if (window != null) { window.Activate(); TextSelection textSelection = instance.DTE.ActiveDocument.Selection; textSelection.SelectAll(); bool replaced = textSelection.ReplacePattern(text, replacementText, findOptions); TraceService.WriteLine(replaced ? "Replaced" : "NOT replaced"); instance.Save(); } else { TraceService.WriteLine("Could not open window to do replacement for " + instance.Name); } } catch (Exception exception) { TraceService.WriteError("Replacing Text failed for " + instance.Name + " exception=" + exception); } }
public static void ShowwithAnimation(this Window window) { window.Visibility = Visibility.Visible; window.Topmost = false; window.Activate(); var showAnimation = new DoubleAnimation { Duration = new Duration(TimeSpan.FromSeconds(0.3)), FillBehavior = FillBehavior.Stop, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut } }; var taskbarPosition = TaskbarService.TaskbarPosition; switch (taskbarPosition) { case TaskbarPosition.Left: case TaskbarPosition.Right: showAnimation.To = window.Left; break; default: showAnimation.To = window.Top; break; } showAnimation.From = (taskbarPosition == TaskbarPosition.Top || taskbarPosition == TaskbarPosition.Left) ? showAnimation.To - 25 : showAnimation.To + 25; showAnimation.Completed += (s, e) => { window.Topmost = true; window.Focus(); }; switch (taskbarPosition) { case TaskbarPosition.Left: case TaskbarPosition.Right: window.ApplyAnimationClock(Window.LeftProperty, showAnimation.CreateClock()); break; default: window.ApplyAnimationClock(Window.TopProperty, showAnimation.CreateClock()); break; } _windowVisible = true; }
public void FeelLucky() { isBusy = true; var crawTargets = new List <XPathAnalyzer.CrawTarget>(); var task = TemporaryTask.AddTempTask("网页结构计算中", HtmlDoc.SearchPropertiesSmart(CrawlItems, RootXPath, IsAttribute), crawTarget => { crawTargets.Add(crawTarget); var datas = HtmlDoc.GetDataFromXPath(crawTarget.CrawItems, IsMultiData, crawTarget.RootXPath); crawTarget.Datas = datas; }, d => { isBusy = false; if (crawTargets.Count == 0) { CrawTarget = null; XLogSys.Print.Warn("没有检查到任何可选的列表页面"); return; } var luckModel = new FeelLuckyModel(crawTargets, HtmlDoc); var view = PluginProvider.GetObjectInstance <ICustomView>("手气不错面板") as UserControl; view.DataContext = luckModel; var name = "手气不错"; var window = new Window { Title = name }; window.WindowState = WindowState.Maximized; window.Content = view; luckModel.SetView(view, window); window.Activate(); window.ShowDialog(); if (window.DialogResult == true) { var crawTarget = luckModel.CurrentTarget; RootXPath = crawTarget.RootXPath; CrawlItems.Clear(); CrawlItems.AddRange(crawTarget.CrawItems.Where(r => r.IsEnabled)); } }); SysProcessManager.CurrentProcessTasks.Add(task); }
public Msgbox(Window window, string text, bool waiting = false) { InitializeComponent(); Text = text; TextBlock.Text = text; this.Owner = window; if (window.Height == System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height || window.Width == System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width) { this.Left = window.Left; this.Top = window.Top; this.Height = window.Height; this.Width = window.Width; } else if (window.WindowState == WindowState.Maximized) { this.Left = 0; this.Top = 0; this.Height = SystemParameters.PrimaryScreenHeight; this.Width = SystemParameters.PrimaryScreenWidth; } else { this.Left = window.Left + 15; this.Top = window.Top + 15; this.Height = window.Height - 30; this.Width = window.Width - 30; } if (window.WindowState == WindowState.Minimized) { window.WindowState = WindowState.Normal; } window.Activate(); window.Focus(); if (waiting) { YesButton.Visibility = Visibility.Collapsed; CancelButton.Content = "强制停止"; CancelButton.Width = 125; WaitingImageAwesome.Visibility = Visibility.Visible; } }
private void ExecDSV(ProjectItem pi) { try { //close all project windows foreach (ProjectItem piTemp in pi.ContainingProject.ProjectItems) { bool bIsOpen = piTemp.get_IsOpen(BIDSViewKinds.Designer); if (bIsOpen) { Window win = piTemp.Open(BIDSViewKinds.Designer); win.Close(vsSaveChanges.vsSaveChangesYes); } } DataSourceView dsv = pi.Object as DataSourceView; Microsoft.DataWarehouse.Design.DataSourceConnection openedDataSourceConnection = GetOpenedDataSourceConnection(dsv.DataSource); Program.SQLFlattener = new frmSQLFlattener(); Program.SQLFlattener.txtServer.Text = openedDataSourceConnection.DataSource; Program.SQLFlattener.cmbDatabase.Items[0] = openedDataSourceConnection.Database; Program.SQLFlattener.Conn = (System.Data.OleDb.OleDbConnection)openedDataSourceConnection.ConnectionObject; Program.SQLFlattener.cmbTable.Items[0] = string.Empty; Program.SQLFlattener.cmbID.Items[0] = string.Empty; Program.SQLFlattener.cmbPID.Items[0] = string.Empty; Program.SQLFlattener.dsv = dsv; Program.SQLFlattener.DataSourceConnection = openedDataSourceConnection; Program.ASFlattener = null; if (Program.SQLFlattener.ShowDialog() == DialogResult.OK) { Window winDesigner = pi.Open(BIDSViewKinds.Designer); winDesigner.Activate(); System.ComponentModel.Design.IDesignerHost host = (System.ComponentModel.Design.IDesignerHost)(winDesigner.Object); Microsoft.AnalysisServices.Design.DataSourceDesigner designer = (Microsoft.AnalysisServices.Design.DataSourceDesigner)host.GetDesigner(dsv); designer.MakeDesignerDirty(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
/// <summary> /// Open the Log Window /// </summary> public void OpenLogWindow() { Window window = Application.Current.Windows.Cast <Window>().FirstOrDefault(x => x.GetType() == typeof(LogView)); if (window != null) { var logvm = (ILogViewModel)window.DataContext; logvm.SelectedTab = this.IsEncoding ? 0 : 1; window.Activate(); } else { var logvm = IoC.Get <ILogViewModel>(); logvm.SelectedTab = this.IsEncoding ? 0 : 1; this.WindowManager.ShowWindow(logvm); } }
private void BringToFront(Guid appGuid) { if (appGuid == _appGuid) { _window.Dispatcher.BeginInvoke((ThreadStart) delegate { _window.Show(); if (_window.WindowState == WindowState.Minimized) { _window.WindowState = WindowState.Normal; } _window.Activate(); _window.Focus(); }); } }
void Dispatcher_UnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { Window er = new Window(); er.Height = 350; er.Width = 550; er.ResizeMode = ResizeMode.NoResize; er.WindowStartupLocation = WindowStartupLocation.CenterOwner; er.Title = "Fatal Error: Please help us improve DeCharger"; er.Activate(); //er.Owner = MainWindow; //TODO: log this error... //er.Content = new ErrorReport("Error Message :" + e.Exception.Message.ToString(), App.Laststacktrace); er.Show(); e.Handled = true; }
private void SettingItem_Click(object sender, RoutedEventArgs e) { HelpWindow window = new HelpWindow(); if (help == null) { help = window; help.Show(); help.Activate(); } else { help.Close(); help = window; help.Show(); help.Activate(); } }
private void ConstFormItem_Click(object sender, RoutedEventArgs e) { ConstFormWindow window = new ConstFormWindow(); if (ConstWindow == null) { ConstWindow = window; ConstWindow.Show(); ConstWindow.Activate(); } else { ConstWindow.Close(); ConstWindow = window; ConstWindow.Show(); ConstWindow.Activate(); } }
//Tools menu item methods private void ConvItem_Click(object sender, RoutedEventArgs e) { ConverterWindow window = new ConverterWindow(); if (converter == null) { converter = window; converter.Show(); converter.Activate(); } else { converter.Close(); converter = window; converter.Show(); converter.Activate(); } }
/// <summary> /// Set show in taskbar to <see langword="true"/>, show, normalize state of the window, activate, set top most and focus. /// </summary> /// <param name="window">Target window.</param> public static void BringToFrontAndActivate(this Window window) { if (window is null) { return; } window.ShowInTaskbar = true; window.Show(); if (window.WindowState == WindowState.Minimized) { window.WindowState = WindowState.Normal; } window.Activate(); window.Topmost = true; window.Topmost = false; window.Focus(); }
private void ShowWindow() { if (win == null) { return; } // ウィンドウ表示&最前面に持ってくる if (win.WindowState == System.Windows.WindowState.Minimized) { win.WindowState = System.Windows.WindowState.Normal; } win.Show(); win.Activate(); // タスクバーでの表示をする win.ShowInTaskbar = true; }
public Msgbox(Window window, string text) { InitializeComponent(); Text = text; TextBlock.Text = text; if (window.WindowState == WindowState.Minimized) { window.WindowState = WindowState.Normal; } window.Activate(); window.Focus(); this.Left = window.Left; this.Top = window.Top; this.Height = window.Height; this.Width = window.Width; }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs args) { // Right before we show the main window, // we migrate the database. This will ensure // that if the database is not created, it will // be created. Afterwards, all migrations will // be ran so the schema is up to date. using (var db = new AirContext()) { db.Database.Migrate(); } // We then construct our main window // and activate it which shows it to // the user. m_window = new MainWindow(); m_window.Activate(); }
public override void ActivateForm(Window form, Window window, IntPtr hwnd) { var fHandle = (PresentationSource.FromVisual(form) as HwndSource).Handle; var wHandle = (PresentationSource.FromVisual(window) as HwndSource).Handle; if (window == null || wHandle != fHandle) { // bring to top form.Topmost = true; form.Topmost = false; // set as active form in task bar form.Activate(); // stop flashing...happens occassionally when switching quickly when activate manuver is fails Shell32.FlashWindow(fHandle, 0); } }
/// <inheritdoc /> public bool Activate(INotifyPropertyChanged viewModel) { if (viewModel == null) { throw new ArgumentNullException(nameof(viewModel)); } Window?windowToActivate = ( from Window? window in Application.Current.Windows where window != null where viewModel.Equals(window.DataContext) select window ) .FirstOrDefault(); return(windowToActivate?.Activate() ?? false); }
/// <summary> /// Opens a window to show the update's information. /// </summary> /// <param name="releaseObject">The update release object.</param> private void AskToUpdate(JToken releaseObject) { if (versionUpdatePromptWindow == null) { versionUpdatePromptWindow = new Window() { Title = LocalizationProvider.GetLocalizedValue <string>("VersionUpdate"), Height = 480, Width = 640, MinHeight = 480, MinWidth = 640, Content = new VersionUpdatePromptView(releaseObject) }; versionUpdatePromptWindow.Closed += VersionUpdatePromptWindow_Closed; versionUpdatePromptWindow.Show(); } versionUpdatePromptWindow.Activate(); }
protected override UIElement CreateShell() { var shell = Container.Resolve <Shell>(); #if NET5_0 && WINDOWS _window = new Window(); #endif #if HAS_UNO_WINUI || NETCOREAPP shell.Loaded += (s, e) => { MainXamlRoot = shell.XamlRoot; }; #endif _window.Activate(); _window.Content = shell; return(shell); }
private void TsfPopup_PreviewMouseDown(object sender, MouseButtonEventArgs mouseButtonEventArgs) { DependencyObject parent = VisualTreeHelper.GetParent(this); Window window = parent as Window; // Find the parent window of this popup while ((object)parent != null && (object)window == null) { parent = VisualTreeHelper.GetParent(parent); window = parent as Window; } // Make sure the window is active if ((object)window != null) { window.Activate(); } }
/// <summary> /// The method that creates a new item from the intput string. /// </summary> public override void Execute() { DTE vs = (DTE)GetService(typeof(DTE)); string tempfile = Path.GetTempFileName(); try { using (StreamWriter sw = new StreamWriter(tempfile, false, new UTF8Encoding(true, true))) { sw.WriteLine(content); } // Check it the targetFileName already exists and delete it so it can be added. ProjectItem targetItem = DteHelperEx.FindItemByName(Project.ProjectItems, targetFileName, true); if (targetItem != null) { targetItem.Delete(); } if (!String.IsNullOrEmpty(itemName)) { ProjectItem item = DteHelperEx.FindItemByName(Project.ProjectItems, itemName, true); if (item != null) { projectItem = item.ProjectItems.AddFromTemplate(tempfile, targetFileName); } } else { projectItem = project.ProjectItems.AddFromTemplate(tempfile, targetFileName); } if (open && projectItem != null) { Window wnd = projectItem.Open(Constants.vsViewKindPrimary); wnd.Visible = true; wnd.Activate(); } } finally { File.Delete(tempfile); } }
/// <summary> /// Test2: retrieve all files /// </summary> /// <returns></returns> public void Test2(Action <string> sink) { Action <ProjectItems> dig = items => { }; dig = items => { foreach (ProjectItem i in items) { if (i.ProjectItems != null) { dig(i.ProjectItems); } if (i.SubProject != null && i.SubProject.ProjectItems != null) { dig(i.SubProject.ProjectItems); } if (i.Name.EndsWith(".aspx") || i.Name.EndsWith(".ascx") || i.Name.EndsWith(".cs")) { Window w = i.Open(Constants.vsViewKindCode); w.Activate(); TextSelection ts = _App.ActiveDocument.Selection as TextSelection; ts.SelectAll(); _App.ExecuteCommand("Edit.FormatDocument"); w.Close(vsSaveChanges.vsSaveChangesYes); sink(i.Name); } } }; Array projects = (Array)_App.ActiveSolutionProjects; if (projects.Length > 0) { foreach (Project p in projects) { if (p.ProjectItems != null) { dig(p.ProjectItems); } } } }
public void SpaceKeySpeechControlReceive(string eventName, Window gskin) { skin = gskin; if (eventName == "KeyDown") { SpaceKeySpeechControl.textDisplay.Close(); // 关闭当前textDisplay, 如果存在的话 locationX = gskin.Left; locationY = gskin.Top; overSpeekingTimer = new System.Timers.Timer(); overSpeekingTimer.AutoReset = false; overSpeekingTimer.Interval = 10000; overSpeekingTimer.Enabled = true; overSpeekingTimer.Elapsed += OverSpeekingTimer_Elapsed; // 调用方法-显示遮罩层 mask = common.CommonControlFunc.MakeTansparentScreen(); skin.Left = .0; skin.Top = .0; // 将主界面激活到前台, 确保使其能够接收到键盘按键 skin.Activate(); skin.Focus(); Cursor.Hide(); RecordOnceSpeech(); // 开始录下用户的麦克风 overSpeekingTimer.Start(); } else if (eventName == "KeyUp") { Cursor.Show(); skin.Focus(); if (SpaceKeySpeechControl._isOverSpeech) { // 如果标志True, 此块之外的代码在OverSpeekingTimer_Elapsed中已执行 SpaceKeySpeechControl._isOverSpeech = false; return; } // 当用户释放了Space Key, 释放用于遮罩的窗体对象。处理录音数据。 mask.Close(); skin.Left = locationX; skin.Top = locationY; overSpeekingTimer.Enabled = false; overSpeekingTimer.Stop(); overSpeekingTimer.Close(); RecordOnceSpeechDone(); } }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { #if NET5_0 && WINDOWS var window = new Window(); window.Activate(); #else var window = Windows.UI.Xaml.Window.Current; #endif Frame rootFrame = window.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window window.Content = rootFrame; } #if !(NET5_0 && WINDOWS) if (e.PrelaunchActivated == false) #endif { if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active window.Activate(); } }
/// <summary> /// Обработчик хука /// </summary> /// <param name="sender">Отправитель</param> /// <param name="e">Параметры</param> private void HotkeyHandler(object sender, HotKeyEventArgs e) { IntPtr hWnd = NativeMethods.GetForegroundWindow(); // Check window titles if (!WindowTitles.Contains(NativeMethods.GetWindowTitle(hWnd))) { return; } if ((IsControl == true && e.IsControlHotkey) || (IsControl == false && e.IsAltHotkey)) { // Если 8ка, то меняем раскладку костылём с окном, если ниже, то PostMessage нужному окну с WM_INPUTLANGCHANGEREQUEST if (Utils.IsWindows8OrNewer()) { // посылаем ивент смены раскладки в активное окно NativeMethods.ActivateKeyboardLayout(NativeMethods.HKL_NEXT, 0); // скрываем таскбар NativeMethods.ShowWindow(NativeMethods.TaskBarHandle, NativeMethods.SW_HIDE); System.Threading.Thread.Sleep(50); // отображаем окно хука HookWindow.Show(); HookWindow.Activate(); System.Threading.Thread.Sleep(50); // посылаем ивент смены раскладки NativeMethods.ActivateKeyboardLayout(NativeMethods.HKL_NEXT, 0); //скрываем окно хука и отображаем обратно таскбар HookWindow.Hide(); System.Threading.Thread.Sleep(50); NativeMethods.ShowWindow(NativeMethods.TaskBarHandle, NativeMethods.SW_SHOW); // Возвращаем фокус окну NativeMethods.SetForegroundWindow(hWnd); } else { NativeMethods.PostMessage(hWnd, NativeMethods.WM_INPUTLANGCHANGEREQUEST, IntPtr.Zero, NativeMethods.ActivateKeyboardLayout(NativeMethods.HKL_NEXT, 0)); } } }
/// <summary> /// Runs the style tasks populated within the tasks field. /// </summary> /// <param name="styleTasks">The set of tasks to run on the project item.</param> /// <param name="projectItem">The project item to run the tasks on.</param> public void RunProjectItemStyleTasks(List <IProjectItemStyleTask> styleTasks, ProjectItem projectItem) { if (projectItem.Name.EndsWith(".cs") && !projectItem.Name.EndsWith("Designer.cs")) { bool isItemOpen = projectItem.get_IsOpen(Constants.vsViewKindCode); Window theWindow = projectItem.Open(Constants.vsViewKindCode); theWindow.Activate(); WriteLineToOutputWindow("\r\n-- Working on File: " + projectItem.Name + "--"); try { for (int i = 0; i < styleTasks.Count; i++) { if (styleTasks[i].IsEnabled) { WriteLineToOutputWindow("Running: " + styleTasks[i].TaskName); styleTasks[i].PerformStyleTask(projectItem, theWindow); } else { WriteLineToOutputWindow("Not Running: " + styleTasks[i].TaskName + " -- Disabled"); } } } catch (Exception e) { System.Diagnostics.Trace.WriteLine(e.Message.ToString()); } if (!isItemOpen && projectItem.Saved) { theWindow.Close(vsSaveChanges.vsSaveChangesPrompt); } } if (projectItem.ProjectItems != null) { foreach (ProjectItem p in projectItem.ProjectItems) { RunProjectItemStyleTasks(styleTasks, p); } } }
/// <summary> /// See <see cref="M:Microsoft.Practices.RecipeFramework.IAction.Execute"/>. /// </summary> public override void Execute() { if (this.copy) { if (!string.IsNullOrEmpty(relativePath)) { string destinationPath = string.Concat( Path.GetDirectoryName(Solution.Properties.Item("Path").Value.ToString()), relativePath, Path.GetFileName(sourceFilePath)); File.Copy(sourceFilePath, destinationPath, true); outputProjectItem = solutionFolder.Parent.ProjectItems.AddFromFile(destinationPath); } else { outputProjectItem = solutionFolder.Parent.ProjectItems.AddFromFileCopy(sourceFilePath); } } else { if (!string.IsNullOrEmpty(relativePath)) { string destinationPath = string.Concat( Path.GetDirectoryName(Solution.Properties.Item("Path").Value.ToString()), relativePath, Path.GetFileName(sourceFilePath)); outputProjectItem = solutionFolder.Parent.ProjectItems.AddFromFile(destinationPath); } else { outputProjectItem = solutionFolder.Parent.ProjectItems.AddFromFile(sourceFilePath); } } if (open && outputProjectItem != null) { Window wnd = outputProjectItem.Open(Constants.vsViewKindPrimary); wnd.Visible = true; wnd.Activate(); } }
private void GetDesignerHost() { #if VS90 //FDesignWindow = FPI.Open("{00000000-0000-0000-0000-000000000000}"); //FDesignWindow.Activate(); FDesignWindow = FPI.Open("{7651A702-06E5-11D1-8EBD-00A0C90F26EA}"); FDesignWindow.Activate(); HTMLWindow W = (HTMLWindow)FDesignWindow.Object; //W.CurrentTab = vsHTMLTabs.vsHTMLTabsSource; //if (W.CurrentTabObject is TextWindow) // FTextWindow = W.CurrentTabObject as TextWindow; W.CurrentTab = vsHTMLTabs.vsHTMLTabsDesign; if (W.CurrentTabObject is WebDevPage.DesignerDocument) { FDesignerDocument = W.CurrentTabObject as WebDevPage.DesignerDocument; } #else FDesignWindow = FPI.Open("{00000000-0000-0000-0000-000000000000}"); FDesignWindow.Activate(); FDesignWindow = FPI.Open("{7651A702-06E5-11D1-8EBD-00A0C90F26EA}"); FDesignWindow.Activate(); HTMLWindow W = (HTMLWindow)FDesignWindow.Object; object o = W.CurrentTabObject; IntPtr pObject; Microsoft.VisualStudio.OLE.Interop.IServiceProvider oleSP = (Microsoft.VisualStudio.OLE.Interop.IServiceProvider)o; Guid sid = typeof(IVSMDDesigner).GUID; Guid iid = typeof(IVSMDDesigner).GUID; int hr = oleSP.QueryService(ref sid, ref iid, out pObject); System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(hr); if (pObject != IntPtr.Zero) { try { Object TempObj = Marshal.GetObjectForIUnknown(pObject); if (TempObj is IDesignerHost) { FDesignerHost = (IDesignerHost)TempObj; } else { Object ObjContainer = TempObj.GetType().InvokeMember("ComponentContainer", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.GetProperty, null, TempObj, null); if (ObjContainer is IDesignerHost) { FDesignerHost = (IDesignerHost)ObjContainer; } } FPage = (System.Web.UI.Page)FDesignerHost.RootComponent; NotifyRefresh(200); Application.DoEvents(); //FPage.Form.ID = FClientData.FormName; } finally { Marshal.Release(pObject); } } #endif }
public void GenWebClientModule() { GenFolder(); if (GetForm()) { GetDesignerHost(); #if VS90 #else DesignerTransaction transaction1 = FDesignerHost.CreateTransaction(); #endif try { MyFunction(); WriteWebDataSourceHTML(); } catch (Exception exception2) { MessageBox.Show(exception2.Message); return; } finally { FPI.Name = FClientData.FormName + ".aspx"; FDesignWindow = FPI.Open("{7651A702-06E5-11D1-8EBD-00A0C90F26EA}"); FDesignWindow.Activate(); } FProject.Save(FProject.FullName); } }
private static EditorWindow OpenItem(VisualStudioApp app, string startItem, Project project, out Window window) { EnvDTE.ProjectItem item = null; if (startItem.IndexOf('\\') != -1) { var items = project.ProjectItems; foreach (var itemName in startItem.Split('\\')) { Console.WriteLine(itemName); item = items.Item(itemName); items = item.ProjectItems; } } else { item = project.ProjectItems.Item(startItem); } Assert.IsNotNull(item); window = item.Open(); window.Activate(); return app.GetDocument(item.Document.FullName); }
void windowEvents_WindowCreated(Window activeWindow) { try { if (activeWindow.ProjectItem.Document.Path.ToLower().EndsWith(".dtsconfig")) { activeWindow.Activate(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void WriteWebDataSourceHTML(ref Window FDesignWindow, ClientParam cParam, ProjectItem projItem) { String FileName = FDesignWindow.Document.FullName; FDesignWindow.Close(vsSaveChanges.vsSaveChangesYes); String UpdateHTML = ""; UpdateHTML = String.Format("<rsweb:reportviewer id=\"ReportViewer1\" runat=\"server\" width=\"100%\" Font-Names=\"Verdana\"" + " Font-Size=\"8pt\" Height=\"400px\">" + "<LocalReport ReportPath=\"\">" + "<DataSources>" + "<rsweb:ReportDataSource DataSourceId=\"Master\" Name={0} />" + "</DataSources>" + "</LocalReport>" + "</rsweb:reportviewer>", "\"NewDataSet_" + cParam.ProviderName.Substring(cParam.ProviderName.IndexOf('.') + 1) + "\""); //Start Update Process System.IO.StreamReader SR = new System.IO.StreamReader(FileName, Encoding.Default); String Context = SR.ReadToEnd(); SR.Close(); //Update HTML int x, y; string temp = ""; x = Context.IndexOf("<rsweb"); y = Context.IndexOf("</rsweb"); temp = Context.Substring(x, (y - x) + 21); Context = Context.Replace(temp, UpdateHTML); //Page Title Context = Context.Replace("<title>Untitled Page</title>", "<title>" + cParam.FormTitle + "</title>"); System.IO.FileStream Filefs = new System.IO.FileStream(FileName, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite); System.IO.StreamWriter SW = new System.IO.StreamWriter(Filefs, Encoding.UTF8); SW.Write(Context); SW.Close(); Filefs.Close(); FDesignWindow = projItem.Open("{7651A702-06E5-11D1-8EBD-00A0C90F26EA}"); FDesignWindow.Activate(); }
private void WriteWebDataSourceHTML() { //if (FWebDataSourceList.Count == 0) // return; String FileName = FDesignWindow.Document.FullName; FDesignWindow.Close(vsSaveChanges.vsSaveChangesYes); #if VS90 #endif //FDesignWindow = FPI.Open("{00000000-0000-0000-0000-000000000000}"); //FDesignWindow.Activate(); FDesignWindow = FPI.Open("{7651A702-06E5-11D1-8EBD-00A0C90F26EA}"); FDesignWindow.Activate(); }
private void WriteWebDataSourceHTML() { //if (FWebDataSourceList.Count == 0) // return; String FileName = FDesignWindow.Document.FullName; FDesignWindow.Close(vsSaveChanges.vsSaveChangesYes); #if VS90 #else String UpdateHTML = ""; //WebNavigator.QueryFields WebNavigator navigator1 = FPage.FindControl("WebNavigator1") as WebNavigator; TBlockItem aBlockItem = null; TBlockItem bBlockItem = null; if (navigator1 != null) { if (FClientData.IsMasterDetailBaseForm()) { aBlockItem = FClientData.Blocks.FindItem("Master"); foreach (MWizard.TBlockItem var in FClientData.Blocks) { if (var.ParentItemName == aBlockItem.Name) bBlockItem = var; } } else aBlockItem = FClientData.Blocks.FindItem("Main"); foreach (WebQueryField QF in navigator1.QueryFields) { if (QF.RefVal != null && QF.RefVal != "") { TBlockFieldItem aFieldItem = aBlockItem.BlockFieldItems.FindItem(QF.FieldName); if (QF.Mode == "RefVal") { String DataSourceID = GenWebDataSource(aFieldItem, aBlockItem.TableName, "RefVal", "QF"); InfoCommand aInfoCommand = new InfoCommand(FClientData.DatabaseType); aInfoCommand.Connection = WzdUtils.AllocateConnection(FClientData.DatabaseName, FClientData.DatabaseType, true); //aInfoCommand.Connection = FClientData.Owner.GlobalConnection; IDbDataAdapter DA = DBUtils.CreateDbDataAdapter(aInfoCommand); DataSet aDataSet = new DataSet(); aInfoCommand.CommandText = String.Format("Select * from SYS_REFVAL where REFVAL_NO = '{0}'", aFieldItem.RefValNo); WzdUtils.FillDataAdapter(FClientData.DatabaseType, DA, aDataSet, aFieldItem.RefValNo); String S1 = String.Format("<InfoLight:WebRefVal ID=\"{0}\" runat=\"server\" BindingValue='<%# Bind(\"{1}\") %>' " + "ButtonImageUrl=\"../Image/refval/RefVal.gif\" DataBindingField=\"{1}\" DataSourceID=\"{2}\" " + "DataTextField=\"{3}\" DataValueField=\"{4}\" ReadOnly=\"False\" ResxDataSet=\"\" " + "ResxFilePath=\"\" UseButtonImage=\"True\" Visible=\"False\">" + "</InfoLight:WebRefVal>", "wrv" + aBlockItem.TableName + aFieldItem.DataField + "QF", aFieldItem.DataField, DataSourceID, aDataSet.Tables[0].Rows[0]["DISPLAY_MEMBER"].ToString(), aDataSet.Tables[0].Rows[0]["VALUE_MEMBER"].ToString()); UpdateHTML = UpdateHTML + S1; } if (QF.Mode == "ComboBox") { String DataSourceID = GenWebDataSource(aFieldItem, aBlockItem.TableName, "ComboBox", "QF"); String S2 = String.Format("<InfoLight:WebRefVal ID=\"{0}\" runat=\"server\" BindingValue='<%# Bind(\"{1}\") %>' " + "ButtonImageUrl=\"../Image/refval/RefVal.gif\" DataBindingField=\"{1}\" DataSourceID=\"{2}\" " + "DataTextField=\"{3}\" DataValueField=\"{4}\" ReadOnly=\"False\" ResxDataSet=\"\" " + "ResxFilePath=\"\" UseButtonImage=\"True\" Visible=\"False\"> " + "</InfoLight:WebRefVal>", "wrv" + aBlockItem.TableName + aFieldItem.DataField + "QF", aFieldItem.DataField, DataSourceID, aFieldItem.ComboTextField, aFieldItem.ComboValueField); UpdateHTML = UpdateHTML + S2; } } } } //WebDataSource foreach (WebDataSource aWebDataSource in FWebDataSourceList) { UpdateHTML = UpdateHTML + String.Format( "<InfoLight:WebDataSource ID=\"{0}\" runat=\"server\" SelectAlias=\"{1}\" SelectCommand=\"{2}\" cachedataset=\"{3}\">\n", aWebDataSource.ID, aWebDataSource.SelectAlias, aWebDataSource.SelectCommand, aWebDataSource.CacheDataSet); UpdateHTML = UpdateHTML + "</InfoLight:WebDataSource>\n"; } //WebDefault if (!FClientData.BaseFormName.Contains("WQuery")) { foreach (WebDefault aDefault in FWebDefaultList) { if (aDefault.Fields.Count > 0) { UpdateHTML = UpdateHTML + String.Format( "<InfoLight:WebDefault ID=\"{0}\" runat=\"server\" DataMember=\"{1}\" DataSourceID=\"{2}\">\n", aDefault.ID, aDefault.DataMember, aDefault.DataSourceID); UpdateHTML = UpdateHTML + " <Fields>\n"; } foreach (DefaultFieldItem DFI in aDefault.Fields) { UpdateHTML = UpdateHTML + String.Format( " <InfoLight:DefaultFieldItem FieldName=\"{0}\" DefaultValue=\"{1}\" />\n", DFI.FieldName, DFI.DefaultValue); } if (aDefault.Fields.Count > 0) { UpdateHTML = UpdateHTML + " </Fields>\n"; UpdateHTML = UpdateHTML + "</InfoLight:WebDefault>\n"; } } } //WebRefVal foreach (WebRefVal aWebRefVal in FWebRefValListPage) { UpdateHTML = UpdateHTML + String.Format( "<InfoLight:WebRefVal ID=\"{0}\" runat=\"server\" Visible=\"{1}\" DataSourceID=\"{2}\" DataTextField=\"{3}\" DataValueField=\"{4}\" Width=\"{5}\" >\n", aWebRefVal.ID, aWebRefVal.Visible, aWebRefVal.DataSourceID, aWebRefVal.DataTextField, aWebRefVal.DataValueField, aWebRefVal.Width); UpdateHTML = UpdateHTML + "</InfoLight:WebRefVal>\n"; } //ExtComboBox foreach (ExtComboBox aExtComboBox in FExtComboBoxList) { UpdateHTML = UpdateHTML + String.Format( "<ajaxtools:extcombobox ID=\"{0}\" runat=\"server\" Visible=\"{1}\" DataSourceID=\"{2}\" DisplayField=\"{3}\" ValueField=\"{4}\" AutoRender=\"False\">\n", aExtComboBox.ID, aExtComboBox.Visible, aExtComboBox.DataSourceID, aExtComboBox.DisplayField, aExtComboBox.ValueField); UpdateHTML = UpdateHTML + "</ajaxtools:extcombobox>\n"; } //Start Update Process System.IO.StreamReader SR = new System.IO.StreamReader(FileName, Encoding.Default); String Context = SR.ReadToEnd(); SR.Close(); String ReplaceTag = "<InfoLight:WebNavigator ID="; if (FClientData.BaseFormName.CompareTo("WSingle1") == 0 || FClientData.BaseFormName.CompareTo("WQuery") == 0 || FClientData.BaseFormName.CompareTo("WSingle0") == 0) ReplaceTag = "<InfoLight:WebDataSource ID=\"Master\""; if (Context.Contains("<flTools:FLWebNavigator ID=")) ReplaceTag = "<flTools:FLWebNavigator ID="; if (FClientData.BaseFormName.CompareTo("WSingle3") == 0) ReplaceTag = "<asp:Button ID=\"ButtonOK\""; if (FClientData.BaseFormName.CompareTo("WSingle4") == 0) ReplaceTag = "<InfoLight:WebFormView ID=\"WebFormView1\""; if (FClientData.BaseFormName.CompareTo("WSingle5") == 0 || FClientData.BaseFormName.CompareTo("WMasterDetail8") == 0) ReplaceTag = "<InfoLight:WebStatusStrip ID=\"WebStatusStrip1\""; UpdateHTML = UpdateHTML + ReplaceTag; Context = Context.Replace(ReplaceTag, UpdateHTML); UpdateHTML = String.Empty; //WebValidate if (!FClientData.BaseFormName.Contains("WQuery")) { foreach (WebValidate aValidate in FWebValidateList) { if (aValidate.Fields.Count > 0) { UpdateHTML = UpdateHTML + String.Format( "<InfoLight:WebValidate ID=\"{0}\" runat=\"server\" DataMember=\"{1}\" DataSourceID=\"{2}\" " + "DuplicateCheck=\"False\" DuplicateCheckMode=\"ByLocal\" ForeColor=\"Red\" ValidateChar=\"*\" " + "ValidateColor=\"Red\" ValidateStyle=\"ShowLable\">\n", aValidate.ID, aValidate.DataMember, aValidate.DataSourceID); UpdateHTML = UpdateHTML + " <Fields>\n"; } foreach (ValidateFieldItem VFI in aValidate.Fields) { String ValidateLabelLink = ""; if (FClientData.BaseFormName == "WSingle0" || FClientData.BaseFormName == "WSingle1" || FClientData.BaseFormName == "WSingle2" || FClientData.BaseFormName == "WSingle3" || FClientData.BaseFormName == "WSingle4" || FClientData.BaseFormName == "WSingle5" || FClientData.BaseFormName == "WMasterDetail1" || FClientData.BaseFormName == "WMasterDetail3" || FClientData.BaseFormName == "WMasterDetail4" || FClientData.BaseFormName == "VBWebSingle5" || FClientData.BaseFormName == "WMasterDetail6" || FClientData.BaseFormName == "VBWebCMasterDetail_FG" || FClientData.BaseFormName == "VBWebCMasterDetail4" || FClientData.BaseFormName == "WMasterDetail7" || FClientData.BaseFormName == "WMasterDetail8" || FClientData.BaseFormName == "VBWebCMasterDetail8") { ValidateLabelLink = " ValidateLabelLink=\"Caption" + VFI.FieldName + "\""; } UpdateHTML = UpdateHTML + String.Format( "<InfoLight:ValidateFieldItem FieldName=\"{0}\" CheckNull=\"{1}\"{2}></InfoLight:ValidateFieldItem>\n", VFI.FieldName, VFI.CheckNull.ToString(), ValidateLabelLink); } if (aValidate.Fields.Count > 0) { UpdateHTML = UpdateHTML + " </Fields>\n"; UpdateHTML = UpdateHTML + "</InfoLight:WebValidate>\n<br />"; } } } ReplaceTag = "<InfoLight:WebNavigator ID="; if (FClientData.BaseFormName.CompareTo("WSingle1") == 0 || FClientData.BaseFormName.CompareTo("WQuery") == 0 || FClientData.BaseFormName.CompareTo("WSingle0") == 0) ReplaceTag = "<InfoLight:WebDataSource ID=\"Master\""; if (Context.Contains("<flTools:FLWebNavigator ID=")) ReplaceTag = "<flTools:FLWebNavigator ID="; if (FClientData.BaseFormName.CompareTo("WSingle3") == 0) ReplaceTag = "<asp:Button ID=\"ButtonOK\""; if (FClientData.BaseFormName.CompareTo("WSingle4") == 0) ReplaceTag = "<InfoLight:WebFormView ID=\"WebFormView1\""; UpdateHTML = UpdateHTML + ReplaceTag; Context = Context.Replace(ReplaceTag, UpdateHTML); //WebRefVal ////Start Update Process //String ReplaceTag = "<InfoLight:WebNavigator ID="; //if (FClientData.BaseFormName.CompareTo("WSingle1") == 0 || FClientData.BaseFormName.CompareTo("WQuery") == 0) // ReplaceTag = "<InfoLight:WebDataSource ID="; ////String ReplaceTag = "<InfoLight:WebNavigator"; ////if (FClientData.BaseFormName == "WSingle1") //// ReplaceTag = "<InfoLight:WebDataSource"; //UpdateHTML = UpdateHTML + ReplaceTag; //System.IO.StreamReader SR = new System.IO.StreamReader(FileName, Encoding.Default); //String Context = SR.ReadToEnd(); //SR.Close(); //Context = Context.Replace(ReplaceTag, UpdateHTML); ////WebRefVal foreach (WebRefVal aWebRefVal in FWebRefValList) { String EditMask = String.Empty; if (aBlockItem != null && aBlockItem.BlockFieldItems.FindItem(aWebRefVal.DataBindingField) != null) EditMask = FormatEditMask(aBlockItem.BlockFieldItems.FindItem(aWebRefVal.DataBindingField).EditMask); if (bBlockItem != null && bBlockItem.BlockFieldItems.FindItem(aWebRefVal.DataBindingField) != null) EditMask = FormatEditMask(bBlockItem.BlockFieldItems.FindItem(aWebRefVal.DataBindingField).EditMask); String newWebRefValID = aWebRefVal.ID.Remove(aWebRefVal.ID.LastIndexOf("GridView")); Context = Context.Replace(" ID=\"" + aWebRefVal.ID + "\"", String.Format("{0}\" BindingValue='<%# Bind(\"{1}\"{2}) %>'", " ID=\"" + newWebRefValID, aWebRefVal.DataBindingField, EditMask)); } ////AjaxRefVal foreach (AjaxTools.AjaxRefVal aAjaxRefVal in FAjaxRefValList) { String EditMask = String.Empty; if (aBlockItem != null && aBlockItem.BlockFieldItems.FindItem(aAjaxRefVal.BindingValue) != null) EditMask = FormatEditMask(aBlockItem.BlockFieldItems.FindItem(aAjaxRefVal.BindingValue).EditMask); if (bBlockItem != null && bBlockItem.BlockFieldItems.FindItem(aAjaxRefVal.BindingValue) != null) EditMask = FormatEditMask(bBlockItem.BlockFieldItems.FindItem(aAjaxRefVal.BindingValue).EditMask); String newWebRefValID = aAjaxRefVal.ID.Remove(aAjaxRefVal.ID.LastIndexOf("GridView")); Context = Context.Replace(" ID=\"" + aAjaxRefVal.ID + "\"", String.Format("{0}\" BindingValue='<%# Bind(\"{1}\"{2}) %>'", " ID=\"" + newWebRefValID, aAjaxRefVal.BindingValue, EditMask)); } //WebDropDownList foreach (MyWebDropDownList aWebDropDownList in FMyWebDropDownList) { String EditMask = String.Empty; if (aBlockItem != null && aBlockItem.BlockFieldItems.FindItem(aWebDropDownList.BindingField) != null) EditMask = FormatEditMask(aBlockItem.BlockFieldItems.FindItem(aWebDropDownList.BindingField).EditMask); if (bBlockItem != null && bBlockItem.BlockFieldItems.FindItem(aWebDropDownList.BindingField) != null) EditMask = FormatEditMask(bBlockItem.BlockFieldItems.FindItem(aWebDropDownList.BindingField).EditMask); String newWebDropDownListID = aWebDropDownList.WebDropDownList.ID.Remove(aWebDropDownList.WebDropDownList.ID.LastIndexOf("GridView")); Context = Context.Replace(aWebDropDownList.WebDropDownList.ID + "\"", String.Format("{0}\" SelectedValue='<%# Bind(\"{1}\"{2}) %>'", newWebDropDownListID, aWebDropDownList.BindingField, EditMask)); } //WebDateTimePicker foreach (WebDateTimePicker aDateTimePicker in FWebDateTimePickerList) { String SS = ""; String EditMask = String.Empty; if (aBlockItem != null && aBlockItem.BlockFieldItems.FindItem(aDateTimePicker.ToolTip) != null) EditMask = FormatEditMask(aBlockItem.BlockFieldItems.FindItem(aDateTimePicker.ToolTip).EditMask); if (bBlockItem != null && bBlockItem.BlockFieldItems.FindItem(aDateTimePicker.ToolTip) != null) EditMask = FormatEditMask(bBlockItem.BlockFieldItems.FindItem(aDateTimePicker.ToolTip).EditMask); String newDateTimePickerID = aDateTimePicker.ID.Remove(aDateTimePicker.ID.LastIndexOf("GridView")); if (aDateTimePicker.DateTimeType == dateTimeType.DateTime) SS = String.Format(" ID=\"{0}\" Text='<%# Bind(\"{1}\"{2}) %>'", newDateTimePickerID, aDateTimePicker.ToolTip, EditMask); else if (aDateTimePicker.DateTimeType == dateTimeType.VarChar) SS = String.Format(" ID=\"{0}\" DateString='<%# Bind(\"{1}\"{2}) %>'", newDateTimePickerID, aDateTimePicker.ToolTip, EditMask); Context = Context.Replace(" ID=\"" + aDateTimePicker.ID + "\"", SS); } //WebAjaxDateTimePicker foreach (AjaxTools.AjaxDateTimePicker aDateTimePicker in FAjaxDateTimePickerList) { String SS = ""; String EditMask = String.Empty; if (aBlockItem != null && aBlockItem.BlockFieldItems.FindItem(aDateTimePicker.ToolTip) != null) EditMask = FormatEditMask(aBlockItem.BlockFieldItems.FindItem(aDateTimePicker.ToolTip).EditMask); if (bBlockItem != null && bBlockItem.BlockFieldItems.FindItem(aDateTimePicker.ToolTip) != null) EditMask = FormatEditMask(bBlockItem.BlockFieldItems.FindItem(aDateTimePicker.ToolTip).EditMask); String newDateTimePickerID = aDateTimePicker.ID.Remove(aDateTimePicker.ID.LastIndexOf("GridView")); if (aDateTimePicker.DateTimeType == dateTimeType.DateTime) SS = String.Format(" ID=\"{0}\" Text='<%# Bind(\"{1}\"{2}) %>'", newDateTimePickerID, aDateTimePicker.ToolTip, EditMask); else if (aDateTimePicker.DateTimeType == dateTimeType.VarChar) SS = String.Format(" ID=\"{0}\" DateString='<%# Bind(\"{1}\"{2}) %>'", newDateTimePickerID, aDateTimePicker.ToolTip, EditMask); Context = Context.Replace("Text=\"\" Localize=\"False\" LocalizeForROC=\"False\" ToolTip=\"" + aDateTimePicker.ToolTip + "\" ID=\"" + aDateTimePicker.ID + "\"" , "Localize=\"False\" LocalizeForROC=\"False\" ToolTip=\"" + aDateTimePicker.ToolTip + "\" ID=\"" + aDateTimePicker.ID + "\""); Context = Context.Replace(" ID=\"" + aDateTimePicker.ID + "\"", SS); } //WebValidateBox foreach (WebValidateBox aValidateBox in FWebValidateBoxList) { String EditMask = String.Empty; if (aBlockItem != null && aBlockItem.BlockFieldItems.FindItem(aValidateBox.ValidateField) != null) EditMask = FormatEditMask(aBlockItem.BlockFieldItems.FindItem(aValidateBox.ValidateField).EditMask); if (bBlockItem != null && bBlockItem.BlockFieldItems.FindItem(aValidateBox.ValidateField) != null) EditMask = FormatEditMask(bBlockItem.BlockFieldItems.FindItem(aValidateBox.ValidateField).EditMask); String newValidateBoxID = aValidateBox.ID.Remove(aValidateBox.ID.LastIndexOf("GridView")); String SSS = String.Format(" ID=\"{0}\" Text='<%# Bind(\"{1}\"{2}) %>'", newValidateBoxID, aValidateBox.ValidateField, EditMask); Context = Context.Replace(" ID=\"" + aValidateBox.ID + "\"", SSS); } //Label foreach (System.Web.UI.WebControls.Label aLabel in FLabelList) { String EditMask = String.Empty; if (aBlockItem != null && aBlockItem.BlockFieldItems.FindItem(aLabel.ToolTip) != null) EditMask = FormatEditMask(aBlockItem.BlockFieldItems.FindItem(aLabel.ToolTip).EditMask); if (bBlockItem != null && bBlockItem.BlockFieldItems.FindItem(aLabel.ToolTip) != null) EditMask = FormatEditMask(bBlockItem.BlockFieldItems.FindItem(aLabel.ToolTip).EditMask); String newLabelID = aLabel.ID.Remove(aLabel.ID.LastIndexOf("GridView")); String S4 = String.Format("{0}\" Text='<%# Bind(\"{1}\"{2}) %>'", newLabelID, aLabel.ToolTip, EditMask); Context = Context.Replace(aLabel.ID + "\"", S4); } //CheckBox foreach (System.Web.UI.WebControls.CheckBox aCheckBox in FWebCheckBoxList) { String newCheckBoxID = aCheckBox.ID.Remove(aCheckBox.ID.LastIndexOf("GridView")); String SSS = String.Format(" ID=\"{0}\" Text='<%# Bind(\"{1}\") %>'", newCheckBoxID, aCheckBox.ToolTip); Context = Context.Replace(" ID=\"" + aCheckBox.ID + "\"", SSS); } //TextBox foreach (System.Web.UI.WebControls.TextBox aTextBox in FWebTextBoxList) { String EditMask = String.Empty; if (aBlockItem != null && aBlockItem.BlockFieldItems.FindItem(aTextBox.ToolTip) != null) EditMask = FormatEditMask(aBlockItem.BlockFieldItems.FindItem(aTextBox.ToolTip).EditMask); if (bBlockItem != null && bBlockItem.BlockFieldItems.FindItem(aTextBox.ToolTip) != null) EditMask = FormatEditMask(bBlockItem.BlockFieldItems.FindItem(aTextBox.ToolTip).EditMask); String newTextBoxID = aTextBox.ID.Remove(aTextBox.ID.LastIndexOf("GridView")); String SSS = String.Format(" ID=\"{0}\" Text='<%# Bind(\"{1}\"{2}) %>'", newTextBoxID, aTextBox.ToolTip, EditMask); Context = Context.Replace(" ID=\"" + aTextBox.ID + "\"", SSS); } //Page Title Context = Context.Replace("<title>Untitled Page</title>", "<title>" + FClientData.FormTitle + "</title>"); System.IO.FileStream Filefs = new System.IO.FileStream(FileName, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite); System.IO.StreamWriter SW = new System.IO.StreamWriter(Filefs, Encoding.Default); SW.Write(Context); SW.Close(); Filefs.Close(); #endif System.IO.StreamReader SR = new System.IO.StreamReader(FileName, Encoding.UTF8); String Context = SR.ReadToEnd(); SR.Close(); Context = Context.Replace("<title>Untitled Page</title>", "<title>" + FClientData.FormTitle + "</title>"); System.IO.FileStream Filefs = new System.IO.FileStream(FileName, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite); System.IO.StreamWriter SW = new System.IO.StreamWriter(Filefs, Encoding.UTF8); SW.Write(Context); SW.Close(); Filefs.Close(); //FDesignWindow = FPI.Open("{00000000-0000-0000-0000-000000000000}"); //FDesignWindow.Activate(); FPI.Name = FClientData.FormName + ".aspx"; FDesignWindow = FPI.Open("{7651A702-06E5-11D1-8EBD-00A0C90F26EA}"); FDesignWindow.Activate(); }
private static EditorWindow OpenDjangoProjectItem(VisualStudioApp app, string startItem, out Window window, string projectName = @"TestData\DjangoEditProject.sln", bool wait = false) { var project = app.OpenProject(projectName, startItem); var pyProj = project.GetPythonProject(); EnvDTE.ProjectItem item = null; if (startItem.IndexOf('\\') != -1) { var items = project.ProjectItems; foreach (var itemName in startItem.Split('\\')) { Console.WriteLine(itemName); item = items.Item(itemName); items = item.ProjectItems; } } else { item = project.ProjectItems.Item(startItem); } Assert.IsNotNull(item); window = item.Open(); window.Activate(); var doc = app.GetDocument(item.Document.FullName); if (wait) { pyProj.GetAnalyzer().WaitForCompleteAnalysis(_ => true); } return doc; }
internal static void GenReportViewProperty(Window FDesignWindow, ProjectItem reportDir, bool isMasterDetails, string RootName, string RptName) { String FileName = FDesignWindow.Document.FullName; string FormName = FileName.Substring(FileName.LastIndexOf("\\") + 1, FileName.Length - FileName.LastIndexOf("\\") - 1); FDesignWindow.Close(vsSaveChanges.vsSaveChangesYes); //Start Update Process System.IO.StreamReader SR = new System.IO.StreamReader(FileName, Encoding.Default); String Context = SR.ReadToEnd(); SR.Close(); //Gen Report Property if (isMasterDetails) { Context = Context.Replace("<LocalReport ReportPath=\"\">", "<LocalReport ReportPath=\"" + RootName + "\\" + RptName + ".rdlc\" OnSubreportProcessing=\"SubreportProcessing\">"); } else { Context = Context.Replace("<LocalReport ReportPath=\"\">", "<LocalReport ReportPath=\"" + RootName + "\\" + RptName + ".rdlc\">"); } System.IO.FileStream Filefs = new System.IO.FileStream(FileName, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite); System.IO.StreamWriter SW = new System.IO.StreamWriter(Filefs, Encoding.UTF8); SW.Write(Context); SW.Close(); Filefs.Close(); reportDir = ReportCreator.FindProjectItem(reportDir, FormName); FDesignWindow = reportDir.Open("{7651A702-06E5-11D1-8EBD-00A0C90F26EA}"); FDesignWindow.Activate(); }
public void WriteWebFormTitle(Window FDesignWindow, ClientParam cParam, ProjectItem projItem) { String FileName = FDesignWindow.Document.FullName; FDesignWindow.Close(vsSaveChanges.vsSaveChangesYes); //Start Update Process System.IO.StreamReader SR = new System.IO.StreamReader(FileName, Encoding.Default); String Context = SR.ReadToEnd(); SR.Close(); //Page Title Context = Context.Replace("<title>Untitled Page</title>", "<title>" + cParam.FormTitle + "</title>"); System.IO.FileStream Filefs = new System.IO.FileStream(FileName, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite); System.IO.StreamWriter SW = new System.IO.StreamWriter(Filefs, Encoding.UTF8); SW.Write(Context); SW.Close(); Filefs.Close(); FDesignWindow = projItem.Open("{7651A702-06E5-11D1-8EBD-00A0C90F26EA}"); FDesignWindow.Activate(); }
public static void IntelligentFocusOffViewportWindow (Window targetWindow, IEnumerable<Window> additionalWindows) { foreach (Window window in additionalWindows.Reverse ()) { if (!window.IsMinimized && WindowsShareViewport (targetWindow, window)) { window.CenterAndFocusWindow (); System.Threading.Thread.Sleep (SleepTime); } } targetWindow.CenterAndFocusWindow (); if (additionalWindows.Count () <= 1) return; // we do this to make sure our active window is also at the front... Its a tricky thing to do. // sometimes compiz plays badly. This hacks around it uint time = Gtk.Global.CurrentEventTime + FocusDelay; GLib.Timeout.Add (FocusDelay, delegate { targetWindow.Activate (time); return false; }); }
public void GenWebClientModule() { GenFolder(); if (GetForm()) { GetDesignerHost(); #if VS90 #else DesignerTransaction transaction1 = FDesignerHost.CreateTransaction(); #endif try { TBlockItem BlockItem; GenDataSet(); //??? if (FClientData.IsMasterDetailBaseForm()) { BlockItem = FClientData.Blocks.FindItem("View"); if (BlockItem != null) { GenBlock(BlockItem, "View", false); } BlockItem = FClientData.Blocks.FindItem("Master"); if (BlockItem != null) { GenBlock(BlockItem, "Master", false); } GenDetailBlock(FClientData.BaseFormName); } else { BlockItem = FClientData.Blocks.FindItem("View"); if (BlockItem != null) { GenBlock(BlockItem, "Main", false); } TBlockItem MainBlockItem = FClientData.Blocks.FindItem("Main"); if (MainBlockItem != null) { GenBlock(MainBlockItem, "Main", false); //UpdateDataSource(MainBlockItem, BlockItem); } } WriteWebDataSourceHTML(); } catch (Exception exception2) { MessageBox.Show(exception2.Message); return; } finally { #if VS90 FPI.Name = FClientData.FormName + ".aspx"; FDesignWindow = FPI.Open("{7651A702-06E5-11D1-8EBD-00A0C90F26EA}"); FDesignWindow.Activate(); //bool b = FDesignerDocument.execCommand("Refresh", true, ""); #else transaction1.Commit(); #endif } //RenameForm(); //FPI.Save(FPI.get_FileNames(0)); //GlobalWindow.Close(vsSaveChanges.vsSaveChangesYes); FProject.Save(FProject.FullName); //FDTE2.Solution.SolutionBuild.BuildProject(FDTE2.Solution.SolutionBuild.ActiveConfiguration.Name, // FProject.FullName, true); } }
protected void SetupGui() { guiRenderer = new Renderer(window, RenderQueueGroupID.Overlay, false); // set the scene manager guiRenderer.SetSceneManager(scene); // init the subsystem singleton new GuiSystem(guiRenderer); // configure the default mouse cursor GuiSystem.Instance.DefaultCursor = null; GuiSystem.Instance.CurrentCursor = null; // max window size, based on the size of the Axiom window SizeF maxSize = new SizeF(window.Width, window.Height); rootWindow = new Window("Window/RootWindow"); // rootWindow.MetricsMode = MetricsMode.Absolute; rootWindow.MaximumSize = maxSize; rootWindow.Size = maxSize; rootWindow.Visible = true; // set the main window as the primary GUI sheet GuiSystem.Instance.SetRootWindow(rootWindow); // Load the default imageset try { AtlasManager.Instance.CreateAtlas(MultiverseImagesetFile); } catch (AxiomException e) { throw new PrettyClientException("bad_media.htm", "Invalid media repository", e); } xmlUiWindow = new Window("XmlUiWindow"); // xmlUiWindow.MetricsMode = MetricsMode.Absolute; xmlUiWindow.MaximumSize = rootWindow.MaximumSize; xmlUiWindow.Size = rootWindow.Size; xmlUiWindow.Visible = false; rootWindow.AddChild(xmlUiWindow); // Set up the gui elements SetupGuiElements(); FontManager.SetupFonts(); rootWindow.Activate(); xmlUiWindow.Activate(); }
//private void OpenTemp(string templatePath) //{ // ProjectItem TempPI = FPI; // FPI = FPI.ProjectItems.AddFromFileCopy(templatePath + "\\Temp.aspx"); // Window w = FPI.Open("{7651A702-06E5-11D1-8EBD-00A0C90F26EA}"); // w.Close(vsSaveChanges.vsSaveChangesNo); // string p = FPI.get_FileNames(0); // FPI.Delete(); // File.Delete(p); // FPI = TempPI; //} private void GetDesignerHost() { #if VS90 //FDesignWindow = FPI.Open("{00000000-0000-0000-0000-000000000000}"); //FDesignWindow.Activate(); FDesignWindow = FPI.Open("{7651A702-06E5-11D1-8EBD-00A0C90F26EA}"); FDesignWindow.Activate(); HTMLWindow W = (HTMLWindow)FDesignWindow.Object; //W.CurrentTab = vsHTMLTabs.vsHTMLTabsSource; //if (W.CurrentTabObject is TextWindow) // FTextWindow = W.CurrentTabObject as TextWindow; W.CurrentTab = vsHTMLTabs.vsHTMLTabsDesign; if (W.CurrentTabObject is WebDevPage.DesignerDocument) { FDesignerDocument = W.CurrentTabObject as WebDevPage.DesignerDocument; } #endif }