Open New Form. error c3767 candidate function(s) not accessible - winforms

I want to open one form from another.
I'm having no troubles doing this with blank project. Start new, make 2 forms, put button on first, use this code
Form2 ^ form = gcnew Form2;
form->ShowDialog();
Also adding the include file at the top...
I'm getting this error
error c3767 candidate function(s) not accessible
I've gone through my project and compared it to the really basic one I tried as an example...I've been searching google for hours and trying all sorts of different things, but none of the other peoples problems are related to opening another form...
If anyone could shed any light on this for me, it would be awesome
Thanks
Simon

It looks like the form's constructor is not public. This example form generates that exact same error message:
public ref class Form2 : public System::Windows::Forms::Form
{
//public: // <=== Remove this comment to fix C3767
Form2(void)
{
InitializeComponent();
}
// etc...
};

Related

NUnit: How can I set name of test depending on parametr in [TestFixture(typeof(param))]

I'm using NUnit + Webdriver + C#. Setup class has next stucture:
[TestFixture(typeof(InternetExplorerDriver))]
[TestFixture(typeof(ChromeDriver))]
public partial class SetupBase<TWebDriver> where TWebDriver : IWebDriver, new()
{
public IWebDriver _driver;
[OneTimeSetUp]
public void OneTimeSetUp()
{
Init();
}
}
How can I set name of tests to include methode name, arguments and name of browser?
I tried with capabilities but it didn't help
ChromeOptions options = new ChromeOptions();
options.AddAdditionalCapability("Name", String.Format ("{0}_Chrome", TestContext.CurrentContext.Test.Name), true);
Also tried to use next code but was not able to find way how to pass driver type to NameAttribute
public class NameAttribute : NUnitAttribute, IApplyToTest
{
public NameAttribute(string name)
{
Name = String.Format("{0} {1}", name);
}
public string Name { get; set; }
public void ApplyToTest(Test test)
{
test.Properties.Add("Name", Name);
}
}
Can you help me please. Maybe need to update base class structure somehow?
This is how I use in tests
public class _001_General<TWebDriver> : SetupBase<TWebDriver> where TWebDriver : IWebDriver, new()
{
[OneTimeSetUp]
public void OneTimeSetupTest ()
{
//somework
}
[Test]
public void Test ()
{
//somework
}
}
Also SetupBase class contains functions that are used in tests
In NUnit, test cases, test methods, test fixtures and generic test fixture classes are all "tests" even though we sometimes talk loosely about "tests" as meaning test cases.
In your example, the following names are created:
_001_General<TWebDriver> (or maybe _001_General<>)
_001_General<InternetExplorerDriver>
Test
_001_General<ChromeDriver>
Test
Tests also have "fullnames", similar to that for a type or method. For example
_001_General<ChromeDriver>.Test
(Note: the fullname would also include a namespace, which I haven't shown.)
If you are using a runner that displays fullnames, like the NUnit 3 Console Runner, then there is no problem. So, I assume you are not. :-)
Some runners, like the NUnit 3 Visual Studio Test Adapter use simple test case names. So you would end up with a bunch of tests displayed with the name "Test."
Is that your problem? If so, this is not much of an answer. :-) However, I'll leave it as partial and add to it after hearing what runner you want to use and what you would like to see displayed in it.
UPDATE:
Based on your comment, what you really want to see is the test FullName - just as it is displayed by the NUnit 3 Console runner that TC runs for you. You'd like to see them in the VS IDE using the NUnit 3 VS Adapter.
Unfortunately, you can't right now. :-) More on that below. Meanwhile, here are some workarounds:
Use the console runner on your desktop. It's not as visual but works quite well. It's how I frequently work. Steps:
Install the console runner. I recommend using Chocolatey to install it globally, allowign you to use it with all your projects.
Set up your project to run the console runner with any options you like.
Make sure you use an external console window so you get the color display options that make the console runner easier to use.
Size your windows so you can see everything (if you have enough screen space) or just let the console run pop up on top of VS.
Try to trick VS by setting the test name in a way that includes the driver parameters. That's what you are already doing and it sounds as if you have already gotten almost all you can out of this option, i.e. class name without class parameters. You could try to take it a step further by creating separate classes for each driver. This would multiply the number of classes you have, obviously, but doesn't have to duplicate the code. You could use inheritance from the generic classes to create a new class with only a header in each place where it's needed. Like...
public class TestXYZDriver : TestDriver ...
This might be a lot of work, so it really depends on how important it is to you to get visual results that include fixture parameters right now.
For the future, you could request that the NUnit 3 Adapter project give an option of listing tests by their full names. I haven't worked on that project for a few years, so I'm not sure if it's actually possible. It may not be entirely in the control of the adapter, since VS controls what is displayed.

onclick in jelly is not working, jenkins plugin

I'm trying to make use of the #onclick when developing a jenkins plugin but nothing happens when the checkbox which has this attribute is clicked (same with #onchange).
I have a checkbox for each job implemented as a ListViewColumn with the corresponding column.jelly file
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<td>
<f:checkbox name="selected" onclick="${it.itClicked()}" onchange="${it.itClicked()}" />
</td>
</j:jelly>
and the method itClicked() resides in the corresponding java class of this jelly file:
class CheckboxTemplate extends ListViewColumn {
...
public void itClicked() {
System.out.println("it clicked!");
}
...
#Extension
public static class DescriptorImpl extends ListViewColumnDescriptor {
...
}
But this apparently is not working...
I've made another plugin before which called a method in the java class from the predefined object "it" from the jelly file and it worked fine, so having the method defined in the working place is not the problem (I assume).
Anyone who has any idea of why itClicked() is not executed when the checkbox is checked/changed?
If there is information that I missted posting, tell me, and I'll come back with it asap!
I managed to solve this by adding
<st:bind var="myItem" value="${it}"/>
in my jelly file and changing #clicked to
onclick="myItem.mark('${job.fullName}')"
where mark() was defined in the backend with the particular annotation
#JavaScriptMethod
public void mark(String job) {
// do what you need to do
}
job if of course a predefined variable in the column.jelly file which is not required for this to work, I only passed it to map the checkbox with the corresponding job name.
Hope this is useful for others who struggle with the documentation (and with the nonexisting complete examples) on these topics.

ListDataModel not serializable==won´t run on GAE

Ok so I am really stuck now. I have a h:datatable and the only way to get the row details seems to be DataModel#getRowData(). Unfortunately ListDataModel which is needed to wrap the necessary data is NOT serializable so will not work on GAE, and I really need it to work! Does anyone have any idea about any workaround or some way to make it function.
Help much appreciated!
Mark the property transient (so that it will be skipped during serialization) and introduce lazy loading in the getter.
E.g.
private List<Item> itemList;
private transient DataModel<Item> itemModel;
public DataModel<Item> getItemModel() {
if (itemModel == null) {
itemModel = new ListDataModel<Item>(itemList);
}
return itemModel;
}
There are by the way alternate ways to retrieve the current row. See also How can I pass selected row to commandLink inside dataTable?

How to use parameterless constructor with ninject di and winforms

I'm working on a WinForm application using ninject for dependency injection. My first problem was that the form being instantiated had a parameter (for DI). I added a parameterless constructor thinking this would help. The problem now is that the code inside the constructor with the parameter gets skipped. Here what it looks like:
On my main form:
private void mnuSettings_Click(object sender, System.EventArgs e)
{
frmSettings objForm = new frmSettings();
objForm.Owner=this;
objForm.Show();
}
In the frmSettings form:
private readonly IApplicationPropertiesInterface _applicationProperties;
public frmSettings()
{
InitializeComponent();
}
public frmSettings(IApplicationPropertiesInterface applicationProperties) : this()
{
_applicationProperties = applicationProperties;
}
When I call _applicationProperties.GetExtractFileSaveLocationDirectory() it blows up because the code to set _applicationProperties was never called.
Im wondering if I have structured this incorrectly, and what the best way to achieve this is. My goal is to call the parameterless constructor, but also set _applicationProperties.
Any assistance would be most grateful.
I'm guessing you might be expecting that having Ninject in the building will mena that new will work differently to normal. It doesn't - you need to be doing a kernel.Resolve<Something> for the DI to kick in. Note that most of these pitfalls are covered in detail on the wiki
Can you edit your answer to include details of what you're doing outside of this form please?
In the meantime, here are some previous questions that overlap significantly:-
What is the best practice for WinForms dialogs with ninject?
How to use Ninject in a Windows Forms application?

Making Silverlight 2 programs work in Silverlight 4

I am trying to make Jeff's testing program, written in Silverlight 2 (http://www.jeff.wilcox.name/2008/03/silverlight2-unit-testing/), work using Silverlight 4 and VS2010 and I get a NullReferenceException at this line:
chatSession.ConnectWithRemoteUser("ScottGu");
Any ideas why? Here's code:
public Page()
{
// commented out because it doesn't exist in the current context
// according to the compiler
// InitializeComponent();
// Retrieve ChatSession instance from XAML resource declaration
chatSession = new ChatSession();
chatSession = (ChatSession)Resources["ChatSessionDS"];
// Connect with Chat Server to chat with "ScottGu"
chatSession.ConnectWithRemoteUser("ScottGu");
}
First, if you had to comment out InitializeComponent(), I Feel bad about your application: InitializeComponent is generated by the VS tools when the XAML file of your page is parsed.
If it doesn't exist, it probably means that the class declared in the xaml file is different from the one in your c# file (different name or different namespace) Otherwise, maybe the XAML file action type in the VS property tab isn't set to "page".
second:
chatSession = new ChatSession();
chatSession = (ChatSession)Resources["ChatSessionDS"];
this looks strange.you create a new ChatSession, then replace it by an object saved in the page resources. Why do you create it firstplace if you put the instance out of scope at the next line?

Resources