Hi
I'm trying to add a new tab and my controls programatically to visual studio 2010.
Its creating tab but its not adding the controls to tab.
//Getting design time environment
DTE DesignTimeEnvironment = (DTE)Activator.CreateInstance(Type.GetTypeFromProgID("VisualStudio.DTE.10.0"), true);
//Getting tool box object
ToolBox VSToolBox = (ToolBox)DesignTimeEnvironment.Windows.Item("{B1E99781-AB81-11D0-B683-00AA00A3EE26}").Object;
ToolBoxTab MyTab = null;
string TabName = "MyComponents";
//checkin if Tab already exists
foreach (ToolBoxTab VSTab in VSToolBox.ToolBoxTabs)
{
if (VSTab.Name == TabName)
{
MyTab = VSTab;
break;
}
}
//If tab doesn't exist, creating new one
if (null == MyTab)
MyTab = VSToolBox.ToolBoxTabs.Add(TabName);
MyTab.Activate();
ToolBoxItem tbi = MyTab.ToolBoxItems.Add("FileBrowser",
#"MyComponents.FileBrowser, MyTestComps, Version=1.0.0.1, Culture=neutral, PublicKeyToken=2283de3658476795",
vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent);
DesignTimeEnvironment.Quit();
If i run as administrator its working fine, adding Controls to control library,
but when I try to add the library which is not in GAC its not working. It doesn't through any exception.
Ex:
ToolBoxItem tbi = MyTab.ToolBoxItems.Add("FileBrowser",
#"C:\MyComponents\MyTestComps.dll",
vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent);
It is working fine with the above code.
The only problem was I have to run the application as administrator rights.
Even this way also it is working.
ToolBoxItem tbi = MyTab.ToolBoxItems.Add("FileBrowser",
#"C:\MyComponents\MyTestComps.dll",
vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent);
or
http://blogs.msdn.com/b/quanto/archive/2009/06/12/how-do-i-deploy-a-toolbox-control-as-a-vsix.aspx
Related
I am trying to make a fully-featured web browser in C# using the chromium embedded framework also known as CefSharp. For the tab control, I am using EasyTabs.
I want to have a custom context menu strip that has a "Open link in new tab" menu item.
This is what I have tried, but nothing happens when you run the application and click Open link in new tab.
I'd appreciate any help I can get.
if (commandId == (CefMenuCommand)OpenLinkInNewTab )
{
ResistBrowser.frmMain form;
ResistBrowser.AppContainer appcontainer1;
appcontainer1 = new ResistBrowser.AppContainer();
form = new ResistBrowser.frmMain();
browserControl.Load(parameters.SelectionText);
appcontainer1.Tabs.Add(
// Our First Tab created by default in the Application will have as content the Form1
new TitleBarTab(appcontainer1)
{
Content = new ResistBrowser.frmMain
{
Text = form.Text
}
}
);
}
I downloaded an outlook add-in, which after install create the new tab on the ribbon, and create buttons on new tab. I would like to press these buttons without ui interaction.
I tried query installed add-ins, but can not be controlled:
static void Main( string[] args )
{
Microsoft.Office.Interop.Outlook.ApplicationClass app = new Microsoft.Office.Interop.Outlook.ApplicationClass();
for ( int c = 1; c < app.COMAddIns.Count; c++ )
{
Console.WriteLine( app.COMAddIns.Item( c ).Description );
if ( app.COMAddIns.Item( c ).Description.StartsWith( "XXX" ) )
{
string guid = app.COMAddIns.Item( c ).Guid; // Okay
object obj = app.COMAddIns.Item( c ).Object; // null
object parent = app.COMAddIns.Item( c ).Parent; // ApplicaionClass
string progId = app.COMAddIns.Item( c ).ProgId; // Okay
}
}
}
But it is possible, wrong way. Possible query the ribbon control's buttons?
You can't.
The actions of buttons in ribbons are not publicly available. You can't even programmatically call a click event on the button itself when you are inside the same add-in. (you can call the event handler, but that is just all .NET side without interfering with VSTO / Outlook.
No Office ribbon controls are exposed for the programmatic access.
You can use either UI Automation API or you can use Redemption (I am its author) and its SafeRibbon object (exposed by the SafeExplorer.Ribbon property) - it allows to enumerate and execute Outlook ribbon controls:
set sInspector = CreateObject("Redemption.SafeInspector")
sInspector.Item = Application.ActiveInspector
set Ribbon = sInspector.Ribbon
oldActiveTab = Ribbon.ActiveTab 'remember the currently selected tab
Ribbon.ActiveTab = "Task"
set Control = Ribbon.Controls("Assign Task")
Control.Execute
Ribbon.ActiveTab = oldActiveTab 'restore the active tab
I'm trying to create a DevEx drop down button. Unfortunately, I'm running into two problems I can't figure out:
1) I can't get the popup menu to skin correctly, i.e. it doesn't skin as "Office 2010 Blue". The code I'm using is shown below:
private void InitializeSendToPricingSheetButton()
{
var barManager = new BarManager();
if (barManager.Controller == null) barManager.Controller = new BarAndDockingController();
barManager.Controller.PaintStyleName = "Skin";
barManager.Controller.LookAndFeel.UseDefaultLookAndFeel = false;
barManager.Controller.LookAndFeel.SkinName = "Office 2010 Blue";
barManager.ItemClick += HandleSendToPricingSheetClick;
barManager.Items.AddRange(new[] { new BarButtonItem(barManager, "Foo"), new BarButtonItem(barManager, "Bar"), new BarButtonItem(barManager, "Baz") });
var popupMenu = new PopupMenu { Manager = barManager };
foreach (var barItem in barManager.Items) popupMenu.ItemLinks.Add((BarItem)barItem);
popupMenu.ItemLinks[1].BeginGroup = true;
dropDownButtonSendToPricingSheet.DropDownControl = popupMenu;
}
2) This button is on a form. If the form loses focus (e.g. I click on Firefox), the pop-up menu still remains on-top. It won't go away until clicked.
Any suggestions would be much appreciated. Thanks for helping me deal with DevEx insanity.
I have solution to your second question.
You should add drop down button event handler as below:
dropDownButton1.LostFocus += new EventHandler(HidePopUp);
Handler method should be as below:
private void HidePopUp(object sender,object e)
{
dropDownButton1.HideDropDown();
}
For your second question, you should assign value to the bar manager property as:
BarManager manager = new BarManager();
manager.Form = this; // refers to current form
Find below link for reference
https://www.devexpress.com/Support/Center/Question/Details/Q274641
It is probably simpler to use DefaultLookAndFeel
Add this comp to your form and set the theme you'd like to use.
There is no need to set the theme for individual components.
defaultLookAndFeel1.LookAndFeel.SetSkinStyle("Office 2010 Blue");
I am developing an payroll add-on for SAP business one 8.81. I can be able to add menus below the last menu item that comes with the SAP application i.e. Reports. I am trying to add a setup submenu for my payroll add-on under the Administration/Setup menu of SAP.
Does anyone know how to do this?
The code below just shows how to add menu's below the Reports menu of SAP.
It is in c# and the file name is GUI.cs
oCreationPackage = ((SAPbouiCOM.MenuCreationParams)(app.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)));
oMenuItem = this.app.Menus.Item("43520");
string sPath = Application.StartupPath;
//parent menu
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_POPUP;
oCreationPackage.UniqueID = "eim_payroll";
oCreationPackage.String = "EIM Payroll";
oCreationPackage.Enabled= true;
oCreationPackage.Position = 15;
oCreationPackage.Image = sPath + #"\EIM_Payroll_icon.bmp";
oMenus = oMenuItem.SubMenus;
//If the menu already exists this code will fail
oMenus.AddEx(oCreationPackage);
//Get the menu collection of the newly added pop-up item
oMenuItem = this.app.Menus.Item("eim_payroll");
oMenus = oMenuItem.SubMenus;
//create the setup menu item for master data
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_POPUP;
oCreationPackage.UniqueID = "setup";
oCreationPackage.String = "Setup";
oMenus.AddEx(oCreationPackage);
oMenuItem = this.app.Menus.Item("setup");
oMenus = oMenuItem.SubMenus;
//Get the menu collection of the newly added pop-up item
oMenuItem = this.app.Menus.Item("setup");
oMenus = oMenuItem.SubMenus;
//create the payroll menu item for master data
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_POPUP;
oCreationPackage.UniqueID = "payroll1";
oCreationPackage.String = "Payroll";
oMenus.AddEx(oCreationPackage);
How do I add subfolders within the menu items already created within SAP business 1?
Just changed oMenuItem = this.app.Menus.Item("43530"); to oMenuItem = this.app.Menus.Item("43525"); and it worked
I'm trying to use the ReportViewer Control in Visual Studio 2008 but I'm having problems with viewing the "Smart Tag Panel". The little triangle which should be in the top right corner is not shown. I think the problem is that I can't select the ReportViewer in the Designer in Visual Studio. How do I fix this?
Otherwise i tried to sholved the problem by filling the ReportViewer with data programatically but i also have some problems here. I get an message, which is shown inside the ReportViewer at rumtime:
A datasouce instance have not been supplied for the data source ...
I'm using this code:
private void LoadEmployeeTimeregistrations(string employeeNumber)
{
_employeeTimeregistrations = new List<TimeregistrationData>();
EntityCollection<TimeregistrationsEntity> employeeTimeregList =
_client.TimeRegistrations().GetTimeregistrations(
KRWindPcClassesLibrary.Properties.Settings.Default.ProjectNumber,
employeeNumber, false, null);
if (employeeTimeregList != null)
{
foreach (var timereg in employeeTimeregList)
{
_employeeTimeregistrations.Add(new TimeregistrationData
{
Day = timereg.Time.ToShortDateString(),
TotalHoursPresentation = 8.ToString()
});
}
}
ReportDataSource reportDataSource = new ReportDataSource("Data", _employeeTimeregistrations);
reportViewer2.LocalReport.DataSources.Clear();
reportViewer2.LocalReport.DataSources.Add(reportDataSource);
reportViewer2.LocalReport.Refresh();
reportViewer2.RefreshReport();
}
See this website:
http://www.gotreportviewer.com/
It should have all of the information that you require regarding setting a datasource (amongst many, many other things) for the ReportViewer for VS 2008.