Exemplo n.º 1
0
        private void DeleteButton_Click_1(object sender, EventArgs e)
        {
            statusUpdateItem item = (statusUpdateItem)ListCourses.SelectedItem;

            if (item == null)
            {
                return;
            }
            StatusUpdateItems.Remove(item);
            statusUpdateDb.StatusUpdateItems.DeleteOnSubmit(item);
            statusUpdateDb.SubmitChanges();
        }
Exemplo n.º 2
0
        public void CustomMessageBox()
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                CustomMessageBox messageBox = new CustomMessageBox()
                {
                    Caption            = "Queue update on server?",
                    Message            = "You can queue update on our server for quick update or via half an hour scheduler on phone",
                    LeftButtonContent  = "Yes",
                    RightButtonContent = "No"
                };

                int selected = 0;
                if (App.fb_selected)
                {
                    selected += 1;
                }
                if (App.tw_selected)
                {
                    selected += 10;
                }
                if (App.ld_selected)
                {
                    selected += 100;
                }
                statusUpdateItem newitem = new statusUpdateItem
                {
                    status              = statusString,
                    startTime           = App.finalStartTime,
                    endTime             = App.finalExpTime,
                    selected            = selected,
                    picFolder           = "",
                    uploadStatus        = 0,
                    fbAccessToken       = App.fbaccesstokenkey,
                    twAccessToken       = App.twaccesstokenkey,
                    twAccessTokenSecret = App.twaccesstokensecret,
                    ldAccessToken       = App.ldaccesstokenkey
                };
                messageBox.Dismissed += (s1, e1) =>
                {
                    switch (e1.Result)
                    {
                    case CustomMessageBoxResult.LeftButton:
                        UploadService serverUpload = new UploadService();
                        serverUpload.dispatcher    = Dispatcher;
                        serverUpload.item          = newitem;
                        serverUpload.StartUpload();
                        break;

                    case CustomMessageBoxResult.RightButton:
                        StatusUpdateItems.Add(newitem);
                        statusUpdateDb.StatusUpdateItems.InsertOnSubmit(newitem);
                        statusUpdateDb.SubmitChanges();

                        break;

                    case CustomMessageBoxResult.None:
                        StatusUpdateItems.Add(newitem);
                        statusUpdateDb.StatusUpdateItems.InsertOnSubmit(newitem);
                        statusUpdateDb.SubmitChanges();

                        StartPeriodicTask();
                        break;

                    default:
                        StatusUpdateItems.Add(newitem);
                        statusUpdateDb.StatusUpdateItems.InsertOnSubmit(newitem);
                        statusUpdateDb.SubmitChanges();

                        StartPeriodicTask();
                        break;
                    }
                };

                messageBox.Show();
            });
        }