|
Message Removed
modified 25-Oct-19 2:03am.
|
|
|
|
|
I am buliding a calculator app to calculate the productivity for an application/project. I am not sure on how to calculate the productivity. Hours * days * Working hours
Any suggestion? Thank you
|
|
|
|
|
Um. How many employees do you know who get just one day off every second month? What do they do in February?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
it is just an time saving estimation. I just will take the employees who access the app in May since the app launched in May
|
|
|
|
|
And how many days are there in May and July?
How many days a week do your employees work? I'm pretty sure it's not 7, or even 6.77 ... So if it's 5, then you estimate will be off by 35% or so.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
can you write the formula? Thank you
|
|
|
|
|
No, it's your homework, and your tutor wants to see your thoughts, not mine!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
thank you. I have solved the questions
|
|
|
|
|
It sounds less ridiculous if you stick to "saves one hour per day". Or not.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
In win7 I do not install Microsoft Agent Core Components (Msagent.exe) as winxp. It's warning error in win7. In winform C# I want install similar software as Microsoft Agent Core Components to use for win7 or win10 ? It is programmable in C # similar to "Microsoft Agent", does anyone know this software ?
|
|
|
|
|
|
I know Microsoft Agent no longer supports Windows 7 and later, do you know any software name similar to Microsoft Agent that can be used in Windows 7 or Windows 10 ?
|
|
|
|
|
Sorry, no idea. You could try one of the Microsoft help forums.
|
|
|
|
|
i have many payment rows in same date and i want to count how many payments i this date and put count result in new 1 row
i'm made it manually by excel but i want make it in c# with SQL Server & Data Grid View
this 2 photos make you understand
https://i.stack.imgur.com/mWj1M.png
https://i.stack.imgur.com/UhOzB.png
|
|
|
|
|
Try:
SELECT MyDateField, COUNT(MyDateField)
FROM MyTable
GROUP BY MyDateField
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I've a nested n-level TreeView that consists of data such as grand father, father, child, and list goes on further. I want to bind Selected TreeView Item to so that I can get the Name and Age of selected person using Linq. Please help me. I'll be very grateful of you.
public class Person
{
public Person()
{
Children = new ObservableCollection<Person>();
}
public string Name { get; set; }
public int Age { get; set; }
public ObservableCollection<Person> Children { get; set; }
}
ObservableCollection<Person> Souce = new ObservableCollection<Person>();
Person P1 =
new Person()
{
Name = "GrandFather",
Age = 90
};
Person P11 = new Person()
{
Name = "Father1",
Age = 60
};
Person P111 = new Person()
{
Name = "Child1",
Age = 30
};
P11.Children.Add(P111);
Person P12 = new Person()
{
Name = "Father2",
Age = 60
};
P1.Children.Add(P11);
P1.Children.Add(P12);
Person P2 =
new Person()
{
Name = "GrandFather2",
Age = 91
};
Person P3 =
new Person()
{
Name = "GrandFather3",
Age = 92
};
Souce.Add(P1);
Souce.Add(P2);
Souce.Add(P3);
trVwPerson.ItemsSource = Souce;
My XAML:
<TreeView Name="trVwPerson" xmlns:obj="clr-namespace:TestWpf">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate DataType = "{x:Type obj:Person}" ItemsSource="{Binding Path=Children}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Name}"/>
<TextBlock Width="10"/>
<TextBlock Text="{Binding Path=Age}"/>
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
|
|
|
|
|
Shouldn't that just be:
<TreeView SelectedItem="{Binding SelectedPerson, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"> Then in your view model you must have a property to connect the binding:
class ViewModel
{
public Person SelectedPerson { get; set; }
} However, you don't seem to have a view model for the entire TreeView.
I think you can set the TreeView's DataContect to an instance of the ViewModel.
For instance:
trVwPerson.DataContext = new ViewModel() But instead I suggest you specify the ViewModel to the MainWindow/UserControl containing the TreeView. For instance: You have your TreeView in your MainWindow or maybe a UserControl to contain the TreeView. For that container specify its DataContext to an instance of the ViewModel.
class MainWindow
{
public MainWindow()
{
this.DataContext = new ViewModel();
}
}
You also need to implement the INotifyPropertyChanged in the ViewModel.
However this is kinda clunky, ugly and tedious. Instead I recommend you use an automatic implementation of INotifyPropertyChanged as a NuGet-package. For instance: PropertyChanged.
I think that should give you some advice how fix your problem.
I have note tested my code, so have in mind if it's now is working right off.
Best regards,
/Steffe
|
|
|
|
|
I have the following code, I put a label in Form_Paint to track the number jump, I see the label jumping continuously but e.Graphics.DrawString(...) only looks once, does anyone know why ?
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
progressBar1.Minimum = 0;
progressBar1.Maximum = 100;
this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
}
int iNum = 0;
private void btnDrawText_Click(object sender, EventArgs e)
{
progressBar1.Value = 0;
progressBar1.Visible = true;
this.timer1.Interval = 100;
this.timer1.Enabled = true;
}
private void ShadowedTextPaint(PaintEventArgs e, int num)
{
using (Font font1 = new Font("Times New Roman", 250, FontStyle.Bold, GraphicsUnit.Pixel))
{
PointF pointF1 = new PointF(310, 270);
e.Graphics.DrawString(num.ToString(), font1, Brushes.LightGreen, pointF1);
lblNum.Text = num.ToString();
}
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
ShadowedTextPaint(e, iNum);
}
private void timer1_Tick(object sender, EventArgs e)
{
if (progressBar1.Value < 100)
{
Random rd = new Random();
iNum = rd.Next(0, 999);
progressBar1.Value++;
}
else
{
this.timer1.Enabled = false;
progressBar1.Visible = false;
}
}
}
|
|
|
|
|
My first guess would be it's because you're setting the Text property of a Label control in your paint event, which will cause the label to Invalidate and require painting, which may be generating another WM_PAINT message for your form.
Handle the paint event, but only do painting in it, not messing with other controls that have nothing to do with drawing content.
Also, your in Tick event handler, the else clause of the If statement is unnecessary. The Timer control in the ToolBox does not need to be re-enabled on every tick, and the ProgressBar is always going to be visible since you never set it to not be visible.
Your Random really shouldn't be recreated on every tick of the timer. You can just create a single instance as the class level and just keep using that. But, since you're not even using the random numbers you're getting, why even have it in there?
|
|
|
|
|
The Label Control I put in the Form_Paint event is for me to troubleshoot it without affecting or messing up the information in the Form_Paint event or argument, I verified this with the Debug.Print debugger ("..." );
My Random function gets a random number and the Tick event determines the time to stop redrawing, the ideas you give me are incorrect.
What do you think is the use of Form_Paint to draw random numbers continuously over time ?
|
|
|
|
|
The Label control was a bad idea because it changes the behavior of your code. When you set the value of the Text property, the label does not get repainted at that time. It forces the label to Invalidate itself, telling Windows that it needs to repaint. Windows will get around to posting a WM_PAINT message to the applications message queue. When the UI thread finally goes back to idle, the queue will get processed and the paint message makes it way to the label control, telling it that it is now OK to paint itself. That is when the label actually changes on screen.
Moving on, you never use the value of the Random so it's never being painted anywhere.
Form_Paint is a bit much for this. I'd create a Control specifically for the purpose. This makes the code reusable and easily maintained.
The control would have it's own Random, it's own Timer, and a couple of methods to Start and Stop it's behavior.
|
|
|
|
|
I use the label control to debug the program instead of the Debug.Print("..."), I think the label control doesn't affect as you say.
you say: "i never use the value of the Random so it's never being painted anywhere." What do I use to generate random numbers ?
you say: "Form_Paint is a bit much for this. I'd create a Control specifically for the purpose ..." I haven't seen you create a Control specifically posted by you for everyone to see ?
|
|
|
|
|
Member 2458467 wrote: I use the label control to debug the program instead of the Debug.Print("..."), I think the label control doesn't affect as you say.
Actually, it does work as I say, and it WILL lie to you when you have the UI thread tied up doing other things instead of letting it process the message pump so forms and controls can repaint themselves.
Don't believe me? Start a new Windows form project and drop a label and a button on the form. Double click the button to create an event handler and drop the following code into the button handler:
for (int i = 1; i < 20000000; i++)
label1.Text = i.ToString();
Run it and click the button. Notice the label doesn't update? Also, you can't move the form around the screen either. It's doing this because you've got the UI thread tied up doing a long-running operation. It's can't process messages, like WM_PAINT, until that operation completes.
Member 2458467 wrote: you say: "i never use the value of the Random so it's never being painted anywhere." What do I use to generate random numbers ?
You use Random to generate the values, but you're not understanding how Random works. When you create a new instance of Random and do not supply it with a seed value, it will use the current timer value. Do this multiple times in a row quick enough, and each one of the Random instances will return the exact same value!
Create a single class-level instance of Random and you can use it throughout the rest of your class code and not have to worry about consecutive instances returning the same values.
public class Form1 : Form
{
private Random RNG = new Random();
.
.
.
private void SomeMethod()
{
...
int x = RNG.Next(10000);
...
}
}
In your code, you're getting the next random value and putting it in a variable, but then you never use that value in your paint code!
Member 2458467 wrote: you say: "Form_Paint is a bit much for this. I'd create a Control specifically for the purpose ..." I haven't seen you create a Control specifically posted by you for everyone to see ?
Because I've got my own code to write that nobody is going to write for me and I'm not in the business of writing other peoples code for them.
But, yeah, I wrote a tons of controls for specific very specific things. You'd be better served by writing a control to do this instead of baking it into the Form code where it cannot be used on other forms without copying all the code for it.
Putting the code in its own control allows you to easily reuse the functionality in other applications, other forms in the same app, and even multiple instances of the control on the same form, all without duplicating in multiple places.
Actually, for this, I'd probably just forget the custom painting, even though it's easy to do, it's a bit more code and there's stuff you have to worry about when painting. I'd probably just create a new class, inherit from Label, add a timer to it, a few methods to start and stop the timer, a few properties like Interval for the timer, and in the Tick event of the timer, just update the number being displayed and call Invalidate to get the control to repaint itself.
...no custom painting required.
|
|
|
|
|
How to search any query on c#?
|
|
|
|
|
I'm sorry but that is not a question we can answer just like that - we cannot work out from that little what you are trying to do.
We have no idea - other than "it's in C#" - what type of query you are trying to search, where your data is, how it's organised or even stored, what kind of search you are trying to do, what results you expect, what you have tried, where you are stuck, or any idea what help you want from us!
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with, we get no context beyond that at all.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|