I'm not sure how to actually block or remove a user using 'SKYPE4COMlib' extention for Visual C#. I can change my status, return messages but I do not know how to do that.
If anyone has an idea of any other useful commands please list them here also.
User LiamaCloud is correct.
There's a IsBlocked property in User interface.
You can do something like this:
ISkype skype = _skype;
var tbb = skype.Friends.Cast<User>().Where(u => u.FullName.Contains("xxx");
foreach(User notAFriend in tbb)
{
notAFriend.IsBlocked = true;
MessageBox.Show(friend.FullName + " " + friend.IsBlocked);
}
I've tested it and it works.
Best
Related
I am using Firesharp for my app in c# winforms. This database is also connected to my ReactJS website which deals with the same information.
I have noticed that when I make .SetAsync calls to my app on the website and then log in to my Winforms app, my WinForms app will automatically perform the last action I did on my website to my database which is a .setAsync() action which adds some user information to a list of other user's information. Now it will not stop. Anytime I log on to my c# app, it runs it.
It makes me think there is a queue of orders in firesharp?
here is my react code. From what I can tell, it is nothing out of the ordinary:
async function handleSubmit(e) {
e.preventDefault()
var date = moment().format("MM/DD/YYYY" )
setError("")
setLoading(true)
// grab user info first then use that.
await firebaseApp.database().ref("Users/" + currentUser.uid + "/UserData").on('value', snapshot => {
if (snapshot.val() != null) {
setContactObjects({
...snapshot.val()
})
firebaseApp.database().ref("Projects/" + projectGUIDRef.current.value + "/queueList/" + userIdRef.current.value).set({
"EntryTimeStamp": date + " " + moment().format("hh:mm:ss a"),
"IsSyncing": false,
"UserId": userIdRef.current.value,
"UserName": usernameRef.current.value,
})
}
})
history.push("/Demo")
setLoading(false)
}
here is my c# winforms code of where the code is executing. For some reason, when this executes, it also updates the EntryTimeStamp field of the react code and completely sets all the information even if I delete it. It also happens if I run .set().
updateLastLogin2(authLink);
private async void updateLastLogin2(FirebaseAuthLink authLink)
{
IFirebaseConfig config = new FireSharp.Config.FirebaseConfig
{
AuthSecret = this.authLink.FirebaseToken,
BasePath = Command.dbURL,
};
IFirebaseClient client = new FireSharp.FirebaseClient(config);
string newDateTime = DateTime.Now.ToString();
if (authLink.User.DisplayName.Contains(adUserId) && authLink.User.DisplayName.Contains(adUserId))
{
await client.SetAsync("Users/" + this.authLink.User.LocalId + "/UserData/DateLastLogin", newDateTime);
}
}
Any and all help is appreciated, I've been at this for a day and a half now.
I have never used fire-sharp but this is my guess
You are calling await firebaseApp.database().ref("Users/" + currentUser.uid + "/UserData").on('value' in your react, and then in your Csharp you are calling client.SetAsync("Users/" + this.authLink.User.LocalId .
What happens is the both listeners are listening to each other and then causing a loop.
In that case it's probably better to use once instead of on if you are just using it once.
In cases where you cannot use .once, then you should use .off to turn off the listener once you are done.
firebaseApp.database().ref("Users/" + currentUser.uid + "/UserData").once('value'`
You also shouldn't be using await here since ref().on creates a listener, it doesn't return a promise.
You should also move history.push("/Demo") into your firebase database callback function so it's called after you have set data
I have a web form with 4 dropdownlists and a search button that obtains a list from the database using the values of the selected dropdownlist as filters, what I need is that if user A and B select the same values of the dropdownlist, only 1 of them can work with the list obtained from the database. What would be the best way to work this?
//Get employee list
List<Entity.Employee> lstEmployees = new List<Entity.Employee>();
lstEmployees = Logic.Employee.getEmployees(DropDownList1.SelectedValue, DropDownList2.SelectedValue, DropDownList3.SelectedValue, DropDownList4.SelectedValue);
foreach(Employee emp in lstEmployees)
{
//single process per user required
}
//release single process
Here are two options depending on the environment you are using
1) If you are hosting it on a single server
You can use the application pool Application[Key1 + Key2 + Key3] as a way to track if someone is already working on that combination if not, let them continue.
2) If you are hosting it on a web farm
Use a database (or a shared storage somewhere ex: network share) to track the locking of those parameter combination similar to #1
Obviously #1 is easier/faster
2 is scalable
//Get employee list
List<Entity.Employee> lstEmployees = new List<Entity.Employee>();
lstEmployees = Logic.Employee.getEmployees(DropDownList1.SelectedValue, DropDownList2.SelectedValue, DropDownList3.SelectedValue, DropDownList4.SelectedValue);
foreach(Employee emp in lstEmployees)
{
String MyKey = DropDownList1.SelectedValue + DropDownList2.SelectedValue + DropDownList3.SelectedValue + DropDownList4.SelectedValue;
if(Application[MyKey]==null || Application[MyKey]=""){
//single process per user required
}
}
//release single process
I'm assuming that Employee is a class that you have access to?
The simplest solution I can picture here would be to incorporate a boolean field titled something like "isCheckedOut" and simply check for this value before allowing any data modification.
This solution doesn't really mechanically "lock-down" the code, but depending on how you're accessing it, this sort of quick check could be a very simple fix.
I write the code like this
string sProcesoUnico = ddlCompania.SelectedValue + ddlNomina.SelectedValue + ddlPeriodo.SelectedValue + ddlClaveMovi.SelectedValue;
if (Application[sProcesoUnico].ToString() == "" || Application[sProcesoUnico] == null)
{
try
{
// Process
}
catch (Exception)
{
throw;
}
finally
{
Application[sProcesoUnico] = ""; //release process
}
}
It´s ok the way that I release the Application State?
I am using a WebDialogResult defined on a SmartPanel by calling AskExt() that is used to prompt for a password.
Unfortunately, it caches the password that's entered, so it keeps pre-filling the dialog and I want it to be blank every time the dialog is called.
I've tried a variety of different things, such as calling with .AskExt(true), which is supposed to refresh the dialog and invoked .ClearDialog() before calling .AskExt(), and numerous other things including .Cache.Clear(), .Cache.ClearQueryCache(), .Reset(), .Update(new PwdFields()), .Delete(.Current) as well as the more direct .Current.Pwd = null and .Current.Pwd = "", but nothing works.
That is browser problem. In order to solve it I propose you to find id of control with help of firefox or chrome developer toolbar, and use javascript which will clean values.
Then you can add jquery like this:
$( document ).ready(function() {
$("#ctl00_phG_PXSPanelVerify2_PXFormViewVerify2_CustEdPwd2").focus()
{
$("#ctl00_phG_PXSPanelVerify2_PXFormViewVerify2_CustEdPwd2").text("");
}
});
Eventually the combination below consistently cleared the dialog of the password whenever it was re-displayed.
if (this.PasswordLookup1Status.AskExt(true) == WebDialogResult.OK)
{
string currentPassword = this.PasswordLookup1Filter.Current.Pwd;
this.PasswordLookup1Filter.Current.Pwd = "";
this.PasswordLookup1Filter.Update(this.PasswordLookup1Filter.Current);
if (currentPassword == "1234")
{
Base.Transactions.Ask("Information", "Password [" + currentPassword + "] is correct.", MessageButtons.OK);
Base.Transactions.ClearDialog();
}
else
{
throw new PXException("Password [" + currentPassword + "] is incorrect.");
}
this.PasswordLookup1Filter.ClearDialog();
}
How do I get other info from the user like location, birthday, or gender? I'm using this code as a guide for the project that I'm doing. http://windowsphoneaalto.org/2012/01/facebook-get-information-about-the-user/
I was able to get the user's id and name but I can't get the other information. I tried getting the user's location by adding, string location = result["location"].ToString();
I ended up getting a null value and a keynotfoundexception. This is the piece of code that I'm having issues with.
void _fbClient_GetCompleted(object sender, FacebookApiEventArgs e)
{
//Turn the data into Dictionary.
//If you want to see what the Facebook is returning you can check it
//with this tool provided by Facebook
//http://developers.facebook.com/tools/explorer/?method=GET&path=me
var result = (IDictionary<string, object>)e.GetResultData();
//Get the ID value
string id = result["id"].ToString();
//Get the name value
string name = result["name"].ToString();
//Currently the thread running this code
//is not the UI thread and only UI thread can update
//UI. So we are calling the UI thread here.
_page.Dispatcher.BeginInvoke(() => {
MessageBox.Show(name + " (" + id + ")");
});
As far as i remember you'll need to add that to the facebook apps extended permission and then ask the user to give you the rights to share those details.
Look more for extended permission on facebook will solve your problem
So I've been racking my brain trying to figure out how to implement a "talk" function in my game. I'm new to C# programming but I've been doing as much reading and experimenting as I can with the language.
This is what I have so far:
Comm comm = new Comm();
string message = null;
if (InputBox.Text == "say " + message)
{
OutputBox.AppendText(comm.do_say(message));
}
class Comm
{
public string do_say(string message)
{
return "You say: " + message + "\n";
}
}
Now, this doesn't work. I think I know why, but I can't seem to figure out just how to redo it so it does work... I've tried to replace:
(InputBox.Text == "say " + message)
with
(InputBox.Text == "say {0}", message)
and it doesn't work either. So, now I'm out of ideas on how to make this work. I tried searching stackoverflow and google for answers but came up with nothing.
Any help or hints on how to fix it would be great!
Thanks.
You don't know what the message is in advance, right? You need to search for the "Say ", and take the rest of the string as input.
if(InputBox.Text.StartsWith("Say "))
OutputBox.Text += InputBox.Text.SubString(4);
SubString(4) will return whatever's after the first 4 characters in the string, everything after the "Say "
You seem to be looking for pattern matching here, but C# doesn't support pattern matching. In other words, simply writing
if (InputBox.Text == "say " + message)
does not automatically assign "foo" to message whenever the user types "say foo".
Instead, you should probably use regular expressions, which are implemented in C# with the Regex class. Try something like
Match m = Regex.Match(InputBox.Text, #"^say\s+(.*)$", RegexOptions.IgnoreCase);
if (m.Success)
{
OutputBox.AppendText(Comm.GetScreenoutput(m.Groups[1].Value));
}
You don't need to make do_say an instance method, so in the code above I have assumed that Comm is transformed to
static class Comm
{
public static string GetScreenOutput(string message)
{
return "You say: " + message + "\n";
}
}
This code follows the naming conventions for C# code, using Pascal case for method names.
if (InputBox.Text.ToUpper().StartsWith("SAY "))
{
OutputBox.AppendText(comm.do_say(message));
}
This will check if the user used the word say, regardless of the case used.