本文整理汇总了C#中Window.Activate方法的典型用法代码示例。如果您正苦于以下问题:C# Window.Activate方法的具体用法?C# Window.Activate怎么用?C# Window.Activate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Window
的用法示例。
在下文中一共展示了Window.Activate方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDesignerHost
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
}
示例2: OpenItem
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);
}
示例3: GenWebClientModule
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);
}
}
示例4: GenWebClientModule
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);
}
}
示例5: WriteWebDataSourceHTML
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();
}
示例6: OpenDjangoProjectItem
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;
}
示例7: WriteWebDataSourceHTML
//.........这里部分代码省略.........
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();
}
示例8: GetDesignerHost
//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
}
示例9: WriteWebDataSourceHTML
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();
}
示例10: IntelligentFocusOffViewportWindow
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;
});
}
示例11: WriteWebFormTitle
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();
}
示例12: SetupGui
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();
}
示例13: GenReportViewProperty
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();
}
示例14: windowEvents_WindowCreated
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);
}
}