|
Try some sniffer (like Fiddler) to see what the actual HTTP request is, that may give you a hint why it is 400!
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Well, on the surface of it looks ok. What do you mean 'try it in wcf'?
One observation is you are storing the web request and response as class members - this seems unusual to me, and means that if you call Send() in a multithreaded manner things are likely to go very wrong.
Other things it could be - proxy connections perhaps although I'd expect a different error and its usual to apply some credentials to the request. Check the account the WCF host is running under..?
Regards,
Rob Philpott.
|
|
|
|
|
I've been struggling with this one for half-a-day and I'm still not figuring out how to do this correctly.
What I am trying to do is set up a popup control that will reactive the owning window in the event that the window looses focus but the user then clicks the popup. The trouble is that, normally, the popup looses focus with the window and the user cannot interact with it until the window is reactivated. Since the popup is always 'On Top', it is always shown even if the parent window gets covered up. This makes it the natural choice for users to return to the application.
This code works only half way.
public partial class App : Application
{
private bool _active;
public bool Active { get { return _active; } }
private void Application_Activated(object sender, EventArgs e)
{
_active = true;
}
private void Application_Deactivated(object sender, EventArgs e)
{
_active = false;
}
}
public void PopupBase_MouseDown(object sender, EventArgs e)
{
App currentApp = Application.Current as App;
if (currentApp != null)
{
if (!currentApp.Active)
{
_owner.Activate();
}
}
}
This only works when the parent object is clicked but I'm having trouble wiring the child controls to trigger the event. If the user clicks anywhere in the popup except directly on a child element it works.
I tried this but it didn't work. The Popup's Child in all cases is a Border class.
public void PopupChild_Loaded(object sender, EventArgs e)
{
AddActivationHandler(this.Child.Child);
}
private void AddActivationHandler(UIElement element)
{
if (element is Panel)
{
Panel pElement = element as Panel;
foreach (UIElement child in pElement.Children)
{
AddActivationHandler(child);
}
}
element.MouseDown += PopupBase_MouseDown;
{
I stepped through and the event handlers do get added but they were never called. Is there another way to have all of a parent's children pass their events back up to a specific control?
After some further reading, is this something that could be handled with Routed Events?
modified 24-Nov-15 17:17pm.
|
|
|
|
|
Well i want to make my progressbar updating dynamicly.
So i know the distance and speed but in my while loop should i work with steps for updating my progress bar?
Well each step should be 10% because i have to update another progress in steps between 0 and 1.
double totalDistance = 7.3
double speed = 1;
double progress = (speed / totalDistance);
double step = progress / 10;
while (progress <= totalDistance)
{
progress += step;
Dispatcher.Invoke(new Action(() => {
SetProgress(0.1);
}));
}
modified 24-Nov-15 13:48pm.
|
|
|
|
|
You have great dreams - but follow the path[^] that leads you toward the light...
|
|
|
|
|
Kris Saelen wrote: So i know the distance and speed but in my while loop should i work with steps
for updating my progress bar? I prefer to use time-intervals; that way the actual process does not need to report each N times. Works best with long distances and small steps.
Would be done by checking in the loop if 250 or 500ms passed, and if true, update the progress.
--edit
Ignore that answer; this is the Lounge, and *all the other forums* are for code. Not this one.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
Yes.
Wait.... No.
Hmm... Maybe?
|
|
|
|
|
Your "work" should be done on a different (worker) thread. After you compute each step, you update the value of "progress".
The main thread should have a timer (like, 50ms or so). It should query the value of "progress", and update the progress bar.
Easy peasy
Best,
John
-- LogWizard Meet the Log Viewer that makes monitoring log files a joy!
|
|
|
|
|
thanks that did the trick !
|
|
|
|
|
Case:
1. While running loop to browse handle each record in Form1 and assign into cell with string: "processing" it is not assign "processing" when it runs through, when loop end new assignment string "xxx.." into cell, are you know why ? , While tracking Debug.Print command ("Processing... "); ran pass
[CODE]
...
bool bCalculator = false;
while (i < gridView1.RowCount)
{
...
gridView1.SetRowCellValue(i, "Status", "Processing...");
gridView1.RefreshRow(i); // Not working
//gridView1.RefreshData(); // Not working
Debug.Print("Processing... ");
Thread.Sleep(100);
bCalculator = objclsProcessing.Calculator(row);
...
}
[/CODE]
2. While running GridView1 not show the flow (row of gridview) is running?
|
|
|
|
|
|
Member 2458467 wrote: Thread.Sleep(100);
You should never sleep in the UI thread.
You should have one or more worker threads that do the work, and have a way to notify the UI thread when the work is complete. At which point you refresh each row in the grid.
Best,
John
-- LogWizard Meet the Log Viewer that makes monitoring log files a joy!
|
|
|
|
|
I would of done somthing similar as
foreach(dataGridViewRow dr in GridView1.Rows)
{
dr.cells["thisCellName"].Value = "Processing..";
}
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
I also tried your way and then when the run was faulty on
[CODE]
while (i < dataGridView1.Rows.Count) //
{
...
dataGridView1["Status", i].Value = "Processing...";
Debug.Print("Processing...");
Thread.Sleep(100);
...
}
[/CODE]
|
|
|
|
|
As I stated earlier I use a foreach loop over the datagridview and not a while loop
foreach(DataGridviewRow dr in dataGridView1.Rows)
{
dr.Cell["CellName"].Value = "Processing..";
Debug.Print("Processing...");
}
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
I also tried your way but still not be
foreach (DataGridViewRow dr in dataGridView1.Rows)
{
dr.Cell["CellName"].Value = "Processing..";
Debug.Print("Processing...");
}
|
|
|
|
|
Whats happening?
What is the datasource?
Is there an error message?
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
I find examples of the GridView (or datagridview) handled by each line as follows:
including field: "ID", "CONTRACT", "COMPANY", "STATUS"
assuming there is processor Class and Form contains the GridView (or datagridview) will browser each row by a for loop or while loop, ... if not press the Play button, the column: "STATUS" value = empty (), when press the Play button to start running and treats each row, when browsing to at row, the row that are colored and that cell is assigned the phrase "processing...", if the process is complete by Class Process, the cell run assign the word "success", the reverse cell assigned word "not process", if the data fails to assign the cell words: "faulty data", noting that the data assigned to the cell of the column "STATUS "is in the function or procedure of handling class grade is assigned ("processing... ","not processing ", ...). you see attach file
modified 29-Nov-15 21:36pm.
|
|
|
|
|
Hello,
I currently have C++ server and C# client which communicate well using sockets.
But I may need to add some functionality on server side, and I prefer to do that using C# - so can I write a proxy c# application which will receive requests from client, do some processing and forward that to C++ server? and then back to client? is it possible?
|
|
|
|
|
Well...yes...but why?
That's a rather convoluted solution to a problem.
Why not call the C# code on the server? If the C++ code is managed, then it will call it without any problems. If it isn't, then it's not complicated to do: Google "call c# code from unmanaged c++"[^]
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
It's entirely possible provided that security allows it. What you're trying to do could be viewed as a 'man-in-the-middle' attack though so if you've got transport level security on you're going to run into trouble.
I wrote some code a while back to do just this, create a proxy for WCF net.tcp services on other boxes. Where you have multiple services talking to each other on the same box, you can debug one locally and create proxies to real services elsewhere.
Drop me a line if you want some code, but it doesn't inspect the message at all, just intercept and relay.
Regards,
Rob Philpott.
|
|
|
|
|
Thanks but would not writing it be exactly same as writing ordinary
C# client and server using sockets? Just server would get message from other C# client, then forward it to C++ server?
|
|
|
|
|
Yep.
TcpListener/TcpClient on way in, TcpClient on way through.
Regards,
Rob Philpott.
|
|
|
|
|
Would this be efficient?
Or make my program much slower in general?
|
|
|
|