|
Member 12077780 wrote: I need a project about ...
Then I suggest you start by designing the user interface and working out exactly what you need to do with it.
We aren't here to do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.
Try it yourself, you may find it is not as difficult as you think!
If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
What have you done ? What is your problem , Where ?
Show your code.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
Member 12077780 wrote: Modify the calculator by method project to convector of Binary to Decimal and vice versa. Are you sure it's decimal that you want to convert to, or is it convert between binary and integer (decimal means something different in .NET)? The solution you develop will be quite different depending on the answer to that question. Also, what is the underlying technology? Constraining input on a TextBox in a WPF application would be a lot different to doing the same in an ASP MVC application.
This space for rent
|
|
|
|
|
You will need to write the project yourself however there is a lot of code out there to help you. Here are a couple of things I wrote 8 years ago that may assist...
This article[^] deals with binary/int and other conversions too.
This article[^] deals with a numeric text box - you can modify to only allow 0 and 1 if in binary mode.
|
|
|
|
|
Consider:
using System;
using System.Drawing;
using System.Windows.Forms;
public interface IViewModel
{
string VName { get; }
Action<Control> VMouseDown { set; get; }
}
public interface IControl : IViewModel
{
new Action<Control, Point> VMouseDown { set; get; }
}
public class MyStupidControl : IControl
{
public string VName { get; private set; }
public Action<Control, Point> VMouseDown { set; get; }
Action<Control> IViewModel.VMouseDown { set; get; }
} Where my brain is failing is ... I keep thinking there's a way to avoid having to do the explicit definition of the 'VMouseDown defined in the 'IViewControl interface ... in the Control that inherits from 'IControl
Perhaps what I am "missing" here is the need to create an abstract class that functions as man-in-the-middle semantic structure between 'IViewModel and 'IControl ?
Or, maybe I've just discovered (yet) another thing I never understood properly about Interfaces in .NET ?
thanks, Bill
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|
|
Hi Bill!
If you have a base-class implementing IViewModel then you can use the new -keyword in a sub-class that is implementing IControl to avoid the explicit interface implementation:
public interface IViewModel
{
string VName { get; }
Action<Control> VMouseDown { get; set; }
}
public interface IControl : IViewModel
{
new Action<Control, Point> VMouseDown { get; set; }
}
public class ViewModel : IViewModel
{
public string VName { get; }
public Action<Control> VMouseDown { get; set; }
}
public class MyStupidControl : ViewModel, IControl
{
public new Action<Control, Point> VMouseDown { get; set; }
}
In practice I would be rather hestitant to do something like this and rather look for alternatives (to hiding interface-members).
cheers, Sascha
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Hi Sascha, I appreciate your reply, but remain intellectually unsatisfied I think it's clear that the fact I am re-defining the 'VMouseDown Action so it has an extra parameter in IControl is what's determining the requirement that anything that inherits from IControl also implement the 'VMouseDown in 'IViewModel that uses only one parameter.
I suppose there's an outside chance that what I may be observing here has something to do with the "nature" of the 'Action and 'Func delegates, and I'll try and test this using a Delegate defined in the "usual" way to exclude that hypothesis.
But, then, what is the use of over-riding in an Interface for ? Why allow it ?
It's easy to work-around this by just redefining the Interfaces, but I am really curious about what I observe.
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|
|
BillWoodruff wrote: I suppose there's an outside chance that what I may be observing here has something to do with the "nature" of the 'Action and 'Func delegates No, it's unrelated.
BillWoodruff wrote: But, then, what is the use of over-riding hiding in an Interface for ? Why allow it ? Basically to allow exactly what you want:
Consider implementing interface members explicitly to simulate variance (that is, change parameters or return type in overridden members).
This is often done to offer strongly-typed versions of the interface members. The VMouseDown -member from IViewModel is only hidden in IControl , not overridden or re-defined. The wording in the above quote is actually misleading in this regard.
The reason the hidden member from IViewModel has still to be implemented by a class implementing IControl (I understand that this is the point of your 'confusion') is polymorphism: IControl is IViewModel because it inherits from it, so it's required to be possible to pass an object of a class that implements IControl to a method that takes an IViewModel -parameter (which could make use of the VMouseDown -member as declared in IViewModel ).
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
modified 4-May-16 11:16am.
|
|
|
|
|
Sascha, many thanks ! I think the light has started to turn on in my head now, and I see the point you are making about polymorphism. I think I am trying to use Interfaces here in a non-standard way, and my guess is that I can use abstract class inheritance, and virtual and non-virtual declaration, to do what I want to do here.
I do find it interesting that I can "get away with" defining the 'IModel declaration of 'VMouseDown as public/implicit and making the IViewModel declaration non-public/explicit. ReSharper, if given the chance to auto-generate the Interface members, reverses that configuration. Of course, I want the "version" of the member available outside the class to be the last one "down" in the hierarchy.
cheers, Bill
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|
|
I am new to C# programming, and i have been tasked with making a system that get all hardware and software information from remote network computers.
Issue? I do not know how to go about doing this.
Can you please give me a heads start on how to start ?
Thank you
|
|
|
|
|
I'd start with something like How To: Connect to a Remote Computer[^] and see if you can get all the required info via WMI
[edit]
once you can get the information you require from a machine who's tcp/ip address you do know, you'll need to extend that to all machines on your network ... here's something to get you started with identifying other machines Get List of Network Computer Names in C#[^]
[/edit]
modified 2-May-16 22:33pm.
|
|
|
|
|
The biggest question is how new to programming in general are you? This task is a relatively complicated one and it's not something you would want to tackle if you were a new developer. If you have plenty of experience in Windows programming then this should be slightly more straightforward for you.
This space for rent
|
|
|
|
|
I would suggest buying a 3rd party product that already does it.
Or, if you really want to build it all I suggest you start by looking here, WMI Tasks: Computer Hardware (Windows)[^].
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I want to configure all access point in the building to send the received 802.11 management frames to my server.
and then I am able to save them on my server in order to use them for my location application to track the moving object.
Note:Syslog doesn't include all the received frames
I am asking:
Is it possible to synchronise the access point with a server to get all the received frames?
Is it possible to read this information periodically by SNMP or Telnet?
Can you tell me which MIP OID should I requests & get to retrieve a list of management frames(such as probe request) from Access points?
modified 3-May-16 6:20am.
|
|
|
|
|
Do you need frames or packets? I'm not sure what the use case for just frames would be, but a capture utility for that would most likely need to be bound to a custom NIC driver, since frames are outside of the scope of the OS and generally you won't be able to really track on anything lower than layer 3 with a COTS application.
If packets are fine, you'll need either a separate machine or a separate promiscuous NIC on the same subnet as the WAPs (you could VLANthe management network to ease the hardware burden for this) and run a packet sniffer. From there you could either dump all to syslog or use a utility like Snort in order to define rules for log-able behavior.
That would be my approach, anyway.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Thank you very much for your reply. I need only frames because I want to build position system which means I want to know RSSI for all wifi-clients(mobiles and laptops which are associated or unassociated). and this information. it is only can be in 802.11 frames. I cannot figure out how to access all Access points and get frames(such as probe request).
|
|
|
|
|
That makes much more sense, okay.
The WAP manufacturer likely exposes this information either across SNMP or via an API. I doubt that you'll be able to track it by individual frames (although a specific firmware may provide that functionality). It's worth a deep dive into their documentation to check.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Thank you again Nathan Minier
|
|
|
|
|
I want to create a c# program to make windows forms not full-screen. When you click maximize button it won't full-screen, program should specify the maximum size.
|
|
|
|
|
AFAIK, there is a setting for the default size, but not for the maximum. It doesn't need a setting, as it is defined as the size of the screen (depending on settings, minus the taskbar).
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
What is stopping you from editing the 'MaximumSize Property of your Form in the Property Browser at design-time ? Or, setting that Property at run-time ?
The one side-effect you may not expect ... if you have set the Form 'StartPosition to 'CenterScreen ... is that when you then 'Maximize, the Form may appear with its upper-left corner at screen upper-left.
You can deal with that by writing a Form 'ReSize event handler that does the "right thing" to center the Form in the screen area
private void Form1_Resize(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Maximized)
{
this.WindowState = FormWindowState.Normal;
this.Size = MaximumSize;
Rectangle scrn = Screen.PrimaryScreen.WorkingArea;
this.Left = scrn.Width / 2 - this.Width / 2;
this.Top = scrn.Height / 2 - this.Height / 2;
this.Refresh();
}
} And, of course, you could modify this to do something when the WindowState was 'Minimized. You can also do weird stuff like setting a Form Size larger than Screen Size.
However, I suggest you think long and hard about modifying the behavior of the Maximize, or Minimize, buttons on a WinForm. People often expect those to behave in a "standard" way. I have yet to see an actual case where having a WinForm sized larger than screen size was "good design."
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|
|
I'm opening Windows Photo Viewer like this:
var process = new Process();
process.StartInfo.FileName = "rundll32.exe";
process.StartInfo.Arguments = @"C:\WINDOWS\System32\shimgvw.dll, ImageView_Fullscreen " + filename;
process.Start();
If it's already running, I want to close it.
1) How can I check if it's running. Task Manager shows multiple instances of RunDll32.Exe, but no info on what app their hosting.
2) Assuming I can tell if it's running, how can I close it?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
You could use its window title?
Process[] processes = Process.GetProcesses();
foreach (Process p in processes)
{
if (!String.IsNullOrEmpty(p.MainWindowTitle))
{
Console.WriteLine("Process: {0}\n ID: {1}\n Window title: {2}", p.ProcessName, p.Id, p.MainWindowTitle);
}
}
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I forgot - you want to kill it as well.
If the Title works, you can just kill the process:
if (p.MainWindowTitle == "Untitled - Paint")
{
p.Kill();
}
(Windows Photo Viewer is hidden on WIn10, and I don't want to faff with the registry to re-enable it, So I used Paint as an example)
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Ok, that did it. Thanks
Any way to determine if my app opened that instance of Windows Photo Viewer?
If it's not broken, fix it until it is
|
|
|
|
|