|
neodeaths wrote: is this possible? Easiest way to do so is by writing a normal windows-application that checks for a "done" flag. You can set the flag from the service, in a database of your choice - or an XML file or similar. Have the application check the file and display a status if required.
Services do not run as user-applications; they're started before a user logs in, and may be running when there's no user to view the dialogs. A small application that starts in the normal user-space would be the easiest way to communicate.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hello to all I can not understand how to recover from model year when the property is not mistakes, I use this class for validation:
public class ValidatableModel : INotifyDataErrorInfo, INotifyPropertyChanged
{
private ConcurrentDictionary<string, List<string>> _errors = new ConcurrentDictionary<string, List<string>>();
public event PropertyChangedEventHandler PropertyChanged;
public void RaisePropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null)
handler(this, new PropertyChangedEventArgs(propertyName));
ValidateAsync();
}
public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged;
public void OnErrorsChanged(string propertyName)
{
var handler = ErrorsChanged;
if (handler != null)
handler(this, new DataErrorsChangedEventArgs(propertyName));
}
public IEnumerable GetErrors(string propertyName)
{
List<string> errorsForName;
_errors.TryGetValue(propertyName, out errorsForName);
return errorsForName;
}
public bool HasErrors
{
get { return _errors.Any(kv => kv.Value != null && kv.Value.Count > 0); }
}
public Task ValidateAsync()
{
return Task.Run(() => Validate());
}
private object _lock = new object();
public void Validate()
{
lock (_lock)
{
var validationContext = new ValidationContext(this, null, null);
var validationResults = new List<ValidationResult>();
Validator.TryValidateObject(this, validationContext, validationResults, true);
foreach (var kv in _errors.ToList())
{
if (validationResults.All(r => r.MemberNames.All(m => m != kv.Key)))
{
List<string> outLi;
_errors.TryRemove(kv.Key, out outLi);
OnErrorsChanged(kv.Key);
}
}
var q = from r in validationResults
from m in r.MemberNames
group r by m into g
select g;
foreach (var prop in q)
{
var messages = prop.Select(r => r.ErrorMessage).ToList();
if (_errors.ContainsKey(prop.Key))
{
List<string> outLi;
_errors.TryRemove(prop.Key, out outLi);
}
_errors.TryAdd(prop.Key, messages);
OnErrorsChanged(prop.Key);
}
}
}
}
This is Model:
public class Busta : ValidatableModel
{
int _BustaID;
string _DescrizioneBusta;
int _NegozioID;
public string _nomeCliente;
[Key]
public int ID { get; set; }
[Required]
[CustomValidation(typeof(Busta), "unicoBustaID")]
public int BustaID
{
get { return _BustaID; }
set { _BustaID = value; RaisePropertyChanged ("BustaID"); }
}
[Required]
[CustomValidation(typeof(Busta), "nullNegozio")]
public int NegozioID
{
get { return _NegozioID; }
set { _NegozioID = value; RaisePropertyChanged("NegozioID"); }
}
[StringLength(20)]
public string NomeCliente { get; set; }
[MaxLength(20)]
[Required]
public string DescrizioneBusta
{
get { return _DescrizioneBusta; }
set { _DescrizioneBusta = value; RaisePropertyChanged("DescrizioneBusta"); }
}
public static ValidationResult unicoBustaID(object obj, ValidationContext context)
{
var user = (Busta)context.ObjectInstance;
if (user.BustaID <= 0 )
{
return new ValidationResult("Codice errato", new List<string> { "BustaID","" });
}
return ValidationResult.Success;
}
public static ValidationResult nullNegozio(object obj, ValidationContext context)
{
var user = (Busta)context.ObjectInstance;
if (user.NegozioID <= 0)
{
return new ValidationResult("Selezionare Un Negozio", new List<string> { "NegozioID", "" });
}
return ValidationResult.Success;
}
}
Then I wanted to make in the ViewModel to recover if the properties of the Model has no Envelope errors but I just always deactivated the button:
SaveCommand = new RelayCommand<Busta>(SalvaBusta,CanSave);
public bool CanSave(object parameter)
{
if (Busta.HasErrors == false )
return true;
else
return false;
}
|
|
|
|
|
Dear Friends
This is my first post, I hope is published in the correct section.
I am really stuck to get a specific text inside a web table from a webbrowser control.
html code:
<tr>
<td class = "text" width = "50%"> e-mail: </ td>
<td class = "text"> target@email.com </ td>
</ tr>
I need to get the email address and display it in a label control.
I tried unsuccessfully several convinations with:
WebBrowser1.Document.GetElementsByTagName
and
WebBrowser1.Document.GetElementsByTagId
I would appreciate any guidance
Regards
Update: developing in VB.Net (VS 2010-2012)
modified 10-Dec-14 10:59am.
|
|
|
|
|
|
Hello everyone,
I am developing a application that will display all instances of Microsoft exchanger servers and sql servers that are running on LAN.
I found the solution for sql servers but could not find any way for exchange server.
Language of my program is c#.
Thanks in advance.
Regards,
Jitendra Singh
|
|
|
|
|
JSingh_Freelancer wrote: I found the solution for sql servers
I doubt it. Not every system may have the SQL Server Browser running (mine isn't) and there may be other impediments. But, if you did find a way, write an article.
I think you will find the task impossible.
|
|
|
|
|
I will write article on that. But right now i am concerned over how to find all instances of exchange servers.
Beacuse as per my understanding many exchange servers can be run on LAN.
Plese correct me if i am somewhere wrong.
Thanks & Regards
Jitendra Singh
|
|
|
|
|
It'd be nice if I could get a list of all targets when I'm on a strange network
A sysop can enter the address manually if there's a need to configure your app.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
How to update image in database using stored procedure in Asp.Net using gridview?
|
|
|
|
|
|
Hello I have a combobox binding to a ObservableCollection of a table, where I fetch the ID field that deposit in another table, so everything is right, the problem arises when I want my ValidatesOnNotifyDataErrors doing its job, but it does the property in question is set to [Required] will post the code I hope you can help out:
Combobox:
<pre lang="xml"><ComboBox HorizontalAlignment="Left" Margin="327,116,0,0" VerticalAlignment="Top" Width="120" ItemsSource="{Binding NegozioObser}" SelectedItem="{Binding NegozioSelezionato, ValidatesOnNotifyDataErrors=True}">
<ComboBox.ItemTemplate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding RagioneSociale}"/>
</Grid>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
property destination in the table Envelope:
[Required]
public int NegozioID
{
get { return _NegozioID; }
set { _NegozioID = value; RaisePropertyChanged("NegozioID"); }
}
withdrawal from the property NegozioID table Shop through this ObservableCollections:
ObservableCollection<Negozio> _Negozios;
public ObservableCollection<Negozio> NegozioObser
{
get { return _Negozios; }
set
{
_Negozios = value;
RaisePropertyChanged("NegozioObser");
}
}
|
|
|
|
|
You've marked NegozioID as required, but you're binding to the NegozioSelezionato property. Have you marked NegozioSelezionato as required?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I did it so I did:
<ComboBox HorizontalAlignment="Left" Margin="327,116,0,0" VerticalAlignment="Top" Width="120" ItemsSource="{Binding NegozioObser, ValidatesOnNotifyDataErrors=True}" SelectedItem="{Binding NegozioSelezionato,ValidatesOnNotifyDataErrors=True}" SelectedValue="{Binding Busta.NegozioID, ValidatesOnNotifyDataErrors=True}" SelectedValuePath="NegozioID" DisplayMemberPath="RagioneSociale"/>
|
|
|
|
|
Try removing the binding for the SelectedItem property, and just leave the SelectedValue / SelectedValuePath .
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks for sharing that information with us. It really help us.
|
|
|
|
|
HI,
EveryBody,
I want to ask that how to add,delete,insert,update data
in connected environment in ado.net???
Thanks...
|
|
|
|
|
|
Hello, I need some advice on how it is right to generate a numeric code that appears in my textbox automatically start the window, explain, I'm making an application where the user must enter a repair of an article, so it must give this article a code that will be unique, I would like to ensure that this code remains stored in the database to have a story.
There is a class in C # that do such a thing?
You would use the primary key or is it better to create another field to the code?
You have or know where I can find some examples?
Thank you all for the help.
P.S. I am working in MVVM F. Entity Code First
|
|
|
|
|
Paolo Mazzon wrote: There is a class in C # that do such a thing?
Not unless you write one.
Paolo Mazzon wrote: You would use the primary key or is it better to create another field to the code?
Either way; it's up to you.
Paolo Mazzon wrote: I am working in MVVM F. Entity Code First
You probably shouldn't pick a strategy before you even know what you're doing.
|
|
|
|
|
Thank you for your response, I know myself that I have to write the method, it is precisely because I do not know how to do that I ask for help, at least the discussion forums are used to this I hope not to disturb nessuno.Good Day
|
|
|
|
|
It seems like you could just start with any number, and increment it every time you need a new code. This is simple, and the numbers would all be unique.
|
|
|
|
|
|
HI,
EveryOne
I want to ask a question regarding ado.net because i am little bit confuse???
For example:- Just like in asp.net we can redirect user to another page in the same way can we redirect user to another form in ado.net.For example:-I have a window form
Form1.cs and i want to redirect user to another form
Form2.cs???So can we redirect user?If we can then Please give the code to redirect user to another Window Form???
Thanks in Advance...
|
|
|
|
|
You already got answers? Why repost? Read what others wrote you, stop to think about the meaning of that and improve your question!!!
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|