|
Oscar Andersson wrote: It will be a product that people install at their computers Block a webbrowser (without knowing what is reading from the socket at port 80) on a clients computer?
You do realize people can also simply uninstall it?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
We will have a list of webpages they cant visit. A blacklist of webpages. The customer can add and remove webpages to this blacklist.
If they want to uninstall producten is up to them. They pay for this Product
|
|
|
|
|
It doesn't change the fact that you'll still be writing a proxy server. The server wiil just be installed on the clients machine and everything that goes through TCP/IP will have to go through the proxy.
And in order to do this and prevent everything from bypassing your proxy simply by not specifying the proxy server to use, you'll have to write an NDIS driver to stick into the network stack to prevent this -- which you're not going to do in C#.
|
|
|
|
|
Your problem has nothing to do with WPF. What you need is some type of web proxy configuration. Either you set up a proxy server, or you create proxy.pac scripts for your users which will forward the request to be blocked to 127.0.0.1 (ie.e localhost, which will not respond with the expected web site). Any browser can use proxy.pac scripts.
|
|
|
|
|
Hey guys,
im pretty new to C# coding and im trying to pair my Dell Laptop (64Bit) and my Asus Win8 Tablet(32Bit) via Bluetooth.
I already found the 32feet.net library and startet coding.
My code worked just 1 time. I didnt get any answer from Tablet since then..
Here is my code, i hope someone can help me. (Its just a small one for testing)
public partial class Form1 : Form
{
private static string BTMacAddress = "00:00:00:00:00:00";
private static string Pin = "123testpin321";
private BluetoothClient Device = new BluetoothClient();
private static BluetoothAddress BTAddress = BluetoothAddress.Parse(BTMacAddress);
private BluetoothEndPoint BTEndpoint = new BluetoothEndPoint(BTAddress, BluetoothService.DialupNetworking);
public Form1()
{
InitializeComponent();
}
private void BTConnect_Click(object sender, EventArgs e)
{
if(!BluetoothSecurity.PairRequest(BTAddress,Pin))
MessageBox.Show("Failed");
else
MessageBox.Show("Done");
}
}
|
|
|
|
|
Hi, all.
First, sorry for my poor english.
Problem need a collection with elements, one of the properties must be unique.
Like this
public class Pet
{
public string Name {get; set;}
public int Age {get; set;}
}
public class Pets: Collection<Pet>
{ ...
public Pet this[string name]
{
get { return LookupPetByName(name); }
set
{
if (HavePetWithName(name))
throw new DublicateNameException(name);
SetPet(name, value);
}
}
...}
This work fine when I use indexer. But I need throw exeption, when I got object by index and change his name.
Pets.Add(new Pet("Ares", 3);
Pets.Add(new Pet("Mike", 6);
var myPet = Pets["Ares"];
myPet.Age = 3;
myPet.Name = "Mike";
Can you suggest me where to dig?
Thanks.
|
|
|
|
|
If your collection has only two Properties in it, and you wish to make sure that one of those Properties is never a duplicate: you have an easy solution.
Create a Dictionary where the Property you don't want to allow duplicates of is the Key, and the other Property is the Value:
private Dictionary<string, int> Pets = new Dictionary<string, int>(); To use this, somewhere in your code do something like this:
Pets.Add("Ares", 3);
Pets.Add("Mike", 6);
string keyToGet = "Ares";
var testKVP = Pets.FirstOrDefault(kvp => kvp.Key == keyToGet);
if (testKVP.Key == null) return;
~
“This isn't right; this isn't even wrong." Wolfgang Pauli, commenting on a physics paper submitted for a journal
|
|
|
|
|
I think that a different collection type won't help. Rather, I'd implement INotifyPropertyChanged in the objects to be collected, and subscribe that event in the Add function of the collection (and unsubscribe in the Remove function). In the event handler, check your constraint, and throw an exception when required.
|
|
|
|
|
How To Add Buttons In Textbox?
|
|
|
|
|
You cannot drag-and-drop a Button into a TextBox Control at design-time, but, yes, you could, in code, add one to the Controls Collection of a TextBox.
private void Form1_Load(object sender, EventArgs e)
{
this.Controls.Remove(button1);
textBox1.Controls.Add(button1);
button1.Location = new Point(2, 2);
button1.Click += button1_Click;
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("Monster speaking: 'in the TextBox: A Button'");
} But, what you end up with is a mess:
The Button will obscure what you are typing that is in the Button's DisplayRectangle ... unless you do some real weird stuff ... not even sure it could be done ... to make sure that when you typed, what you typed would never be covered over by the Button.
Believe me: you do not want to do the above !
The simple way to achieve a combination of Button(s) and TextBox, in one nice package, is to create a UserControl, and put the Button(s) where you like, and the TextBox where you like.
~
“This isn't right; this isn't even wrong." Wolfgang Pauli, commenting on a physics paper submitted for a journal
modified 21-Aug-13 3:03am.
|
|
|
|
|
|
BillWoodruff wrote: The simple way to achieve a combination of Button(s) and TextBox, in one nice package, is to create a UserControl, Or just put them both in a Panel ?
/ravi
|
|
|
|
|
Good point, Ravi. I tend to make UserControls, perhaps because it's become "natural" for me to do so, and, if I create something with multiple controls wired together, interacting, etc., that's often something that I will want to re-use in the future, in other applications, which is so easy if it's a UserControl.
yours, Bill
~
“This isn't right; this isn't even wrong." Wolfgang Pauli, commenting on a physics paper submitted for a journal
|
|
|
|
|
Agree 100% for reuse.
/ravi
|
|
|
|
|
I started to answer that one, stating it could not be done, then decided that someone may actually be able to do it. I'm glad to have that clarified. The usercontrol seemed a natural solution but not what the OP was asking for.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I'm trying to add folder images to my treeview component. I have looked at some examples but cannot quite understand the process.
I think I have to start with setting my images resources in an ImageList object right? I'm not sure how to do that.
Then as I build my treeview, how do I detect a folder from a file and if a folder, set an image to it to display a folder?
Thanks for any help.
|
|
|
|
|
I suggest you move this question to the QA forum, and tag it so we know exactly what you are working with: C#, WinForm, or whatever. Also, please indicate if you are using the standard Microsoft TreeView, that's part of Visual Studio, or, if not, what control You are using.
There are many resources already here on CodeProject demonstrate enumerating a drive/directory structure recursively, and setting TreeNode images: did you search ?
yours, Bill
~
“This isn't right; this isn't even wrong." Wolfgang Pauli, commenting on a physics paper submitted for a journal
|
|
|
|
|
(1) I searched outside of this forum but I will search inside and see what I can find.
(2) I don't see a way to move a topic? I don't see a Move button or link. I'd be glad to move this to QA if I can see how to do that.
Thanks...
|
|
|
|
|
Hi,
The simplest way is to just copy your OP, paste it in a text-editor so you don't accidentally lose it, delete the question here, and then post a new question on QA, paste in the previous question, and then select the appropriate tags.
If you do search CP, I think you'll find existing articles, and answers to other questions, will give you what you need quickly. If you get "stuck," I, and I am sure others, will respond on QA.
yours, Bill
~
“This isn't right; this isn't even wrong." Wolfgang Pauli, commenting on a physics paper submitted for a journal
|
|
|
|
|
The Delete link is disabled so I can't delete it to move it.
I did a search and 'figured out' that I could populate the imagelist property in my treeview with my needed images. I have a brown folder for directories and a green folder for files but in my code below, the folders don't get the brown folder icon and the one file does not get the green folder!
I thought after I understand finally that the index into the images could be used to set the folder icon. Below in directory loop I'm setting 0 index which has the brown folder and the loop below that one is for files and I set index 1 which is the second green folder image.
foreach (var directory in directoryInfo.GetDirectories())
{
var childDirectoryNode = new TreeNode(directory.Name) { Tag = directory };
currentNode.Nodes.Add(childDirectoryNode);
currentNode.ImageIndex = 0;
stack.Push(childDirectoryNode);
}
foreach (var file in directoryInfo.GetFiles())
{
currentNode.Nodes.Add(new TreeNode(file.Name));
currentNode.ImageIndex = 1;
}
|
|
|
|
|
Re: can't delete message: I guess that once responses have been made to a post it can't be deleted on this type of forum. That's something I've never thought about before, and I apologize if I misled you.
Looking at your code, I can't quite follow what you're doing: your pushing Directories on a Stack, in the first loop, but in your second loop, traversing the files, I can't see where the Stack is being used. Neither loop shows where 'currentNode is being set. And, 'childDirectoryNode is, of course, contained in the scope of the loop that traverses the Directories.
My guess is: the two loops you show are separate pieces of code, and that they are connected in some way not shown, perhaps in a recursive outer method ?
Are you using WinForms, and the MS standard TreeView ?
Do keep in mind that for the WinForms TreeView you can set the default Node image at design-time by either the 'ImageIndex or 'ImageKey property of the TreeView (assuming you've set the 'ImageList property of the TreeView to a valid ImageList). Those two properties are "mutually exclusive:" you set one, and it "disables" the other.
I'd suggest you start by finding an example that uses just recursion, and doesn't use a Stack (although using a Stack to reduce the "overhead" of recursion is a very good thing).
good luck, Bill
~
“This isn't right; this isn't even wrong." Wolfgang Pauli, commenting on a physics paper submitted for a journal
|
|
|
|
|
See this[^] article.
/ravi
|
|
|
|
|
You should create an ImageList and then assign images from the list to the nodes like
node.ImageIndex = 0;
this will assign the image at index =0 to the node. Better assign the images to the nodes while creating that node; either that node is the folder node or a list node.
|
|
|
|
|
I created a chart showing a data serie including X value year and Y value MarketValue of my cars' collection. Suppose I have a dictionary containing car model and car year. Using the mouse on the chart I need to visualize X and Y value and the name of car model. To show X and Y I use the following code:
chart1.Series["CAR"].ToolTip = "Year: #VALX MarketValue: #VALY"
If I want to show also the model name, any idea?
Dictionary<int,string> D = new Dictionary<int,string>();
D.Add(1982,"Cinquecento");
D.Add(2000,"Espace");
chart1.Series["CAR"].ToolTip = "Year: #VALX MarketValue: #VALY Model: "
Any idea?
Thanks for your time
|
|
|
|
|
Moved to asp.net forums.
=)
modified 21-Aug-13 7:04am.
|
|
|
|
|