How to get details of an appointment as string in windows phone? - windows-phone

I'm using this code to get appointments in windows phone 8
private void SearchAppointments_Click(object sender, RoutedEventArgs e)
{
Appointments appts = new Appointments();
appts.SearchCompleted += new EventHandler<AppointmentsSearchEventArgs>(Appointments_SearchCompleted);
appts.SearchAsync(DateTime.Now,DateTime.Now.AddDays(7),20);
}
now I need to get subject (or location & etc.) of appointments as string
Can anybody help me please???

As mentioned in MSDN, you can get search appointment result from e.Results in the SearchCompleted event handler :
private void Appointments_SearchCompleted(object sender, AppointmentsSearchEventArgs e)
{
foreach (var appointment in e.Results)
{
//here you can get each Appointment detail
String location = appointment.Location;
String subject = appointment.Subject;
......
}
}

Related

Duplicated output from process.OutputDataReceived

I'm having an issue with duplicated content from redirected output.
In my forms I have two buttons: Run and Clear.
public partial class BatchRun : Form
{
Process process = new Process();
public BatchRun()
{
InitializeComponent();
}
private void RunBTN_Click(object sender, EventArgs e)
{
//initiate the process
this.process.StartInfo.FileName = sMasterBATname;
this.process.StartInfo.UseShellExecute = false;
this.process.StartInfo.CreateNoWindow = true;
this.process.StartInfo.RedirectStandardOutput = true;
this.process.OutputDataReceived += new DataReceivedEventHandler(StandardOutputHandler);
this.process.StartInfo.RedirectStandardInput = true;
this.process.Start();
this.process.BeginOutputReadLine();
}
public void StandardOutputHandler(object sender, DataReceivedEventArgs outLine)
{
BeginInvoke(new MethodInvoker(() =>
{
Label TestLBL = new Label();
TestLBL.Text = text.TrimStart();
TestLBL.AutoSize = true;
TestLBL.Location = new Point(10, CMDpanel.AutoScrollPosition.Y + CMDpanel.Controls.Count * 20);
CMDpanel.Controls.Add(TestLBL);
CMDpanel.AutoScrollPosition = new Point(10, CMDpanel.Controls.Count * 20);
}));
}
private void ClearBTN_Click(object sender, EventArgs e)
{
CMDpanel.Controls.Clear();
this.process.CancelOutputRead();
this.process.Close();
this.process.Refresh();
}
}
This works great if I want to run process only once i.e. close the forms once process has completed.
However, I need to allow user to rerun the same process or run a new one hence I have added a clear button the clear various controls etc.
The problem I'm having is that after clicking clear button, I want to click run button again without closing which should then run the sMAsterBAT file(CMD).
StandardOutputHandler seems to be including content of the previous run as well as the new one resulting in duplicated labels in my CMDpanel.
Is this stored in some kind of buffer? If so, How do i clear it to allow me a rerun?
Could someone explain why this is happening and how to resolve it please.
Spoke to someone at work who fixed it for me. So easy lol
private void ClearBTN_Click(object sender, EventArgs e)
{
CMDpanel.Controls.Clear();
this.process.CancelOutputRead();
this.process.Close();
this.process.Refresh();
this.process = new Process(); // this line resolved my issue!!
}
}

How to hide rows while editing a specific row from the user in gridview

I have a web application which is connected to SQL server management studio.
I have one problem to finish my application.
In my gridview users are able to edit their own reservation, but once i reach update part for the gridview it shows me that the users are able to edit the other reservation and here are some images to show you the meaning of this:
1) this the code in my gridview events
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
if ((row.Cells[9].Text.Trim()).Equals(HttpContext.Current.User.Identity.Name) == false)
{
//row.BackColor = Color.Red;
row.Cells[0].Controls.Clear();
}
}
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
Label1.Text = "Changed";
GridViewRow selectedRow = GridView1.Rows[e.NewEditIndex];
foreach (GridViewRow row in GridView1.Rows)
{
int currentIndex = row.RowIndex;
if (currentIndex != e.NewEditIndex)
{
row.Visible = false;
}
}
}
}
2) this is to show you that user can edit only their own reservation
so how can i solve this ?
I have updated GridView's RowEditing event:
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
// Bind Grid Again Here
}

get data from the server using WCF Windows phone 8

first the server code is working well
//declare the target list to be the reciver
List<string> list = new List<string>();
//at the first declare that
//then call it/
private void check(double l, double lo)
{
Service1Client client = new Service1Client();
client.pbackCompleted += new EventHandler<pbackCompletedEventArgs>(pResult);
client.pbackAsync(l, lo);
}
private void pResult(object sender, pbackCompletedEventArgs e)
{
list = e.Result.ToList<string>();
}
but in debugging list is still null ?
and the function pResult as it is not here ?
how can i return the list and assign it to my list on the device code?
thanks in advance
Try this directly, it worked for me
{
Service1Client client = new Service1Client();
client.pbackAsync(l, lo);
client.pbackCompleted += pResult;
}
void pResult(object sender, pbackCompletedEventArgs e)
{
list = e.Result.ToList<string>();
}
thanks for all, It works as i write in my problem, so there is no problem from the beginning.
May be its microsoft SDK.
#Hitesh Salian thanks a lot. thanks for your try, At real when it didn't work i tried your answer but didn't work.
then suddenly nothing change and the code worked.

DataServiceRequestException was unhandled when calling "SaveChanges()" in WCF application

So i keep getting this error when im trying to save changes in a WCF application
private void button1_Click(object sender, RoutedEventArgs e)
{
MBEMEADataContext cc = new MBEMEADataContext(new Uri("http://ldnmbl-sp10dev/sites/mbemea/_vti_bin/listdata.svc"));
cc.Credentials = System.Net.CredentialCache.DefaultCredentials;
var source = cc.CaseStudies;
cc.AddToCaseStudies(
new CaseStudiesItem
{
Title = textBox1.Text,
Client = textBox2.Text
});
cc.SaveChanges();
}
When cc.SaveChanges(); is called i get "DataServiceRequestException was unhandled" and i dont know why

DOTMsn is not firing the SingedIn event

I have just started building a app using “XihSolutions.DotMSN.dll” version: 2.0.0.40909,
My problem is that it is not firing the “Nameserver_SignedIn” event. Not sure if I am doing something wrong.
your help will be really helpful.
void Nameserver_SignedIn(object sender, EventArgs e)
{
throw new Exception("User Signed In");
}
private string message = string.Empty;
void NameserverProcessor_ConnectionEstablished(object sender, EventArgs e)
{
message = "Connected";
SetMessage();
}
void SetMessage()
{
if (tbMessage.InvokeRequired)
tbMessage. Invoke(new ThreadStart(SetMessage));
else
tbMessage.Text += Environment.NewLine+ message;
}
private void btnSingIn_Click(object sender, EventArgs e)
{
if (messenger.Connected)
{
// SetStatus("Disconnecting from server");
messenger.Disconnect();
}
// set the credentials, this is ofcourse something every DotMSN program will need to
// implement.
messenger.Credentials.Account = tbUserName.Text;
messenger.Credentials.Password = tbPwd.Text;
// inform the user what is happening and try to connecto to the messenger network.
//SetStatus("Connecting to server");
messenger.Connect();
}
You might use MSNPSharp instead - DotMSN is old and may not support the current MSN protocol. There link is here:
http://code.google.com/p/msnp-sharp/