private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            List <object> selected = new List <object>();

            foreach (var p in lstBxParticipants.SelectedItems)
            {
                selected.Add(p);
            }

            foreach (var p in selected)
            {
                Person pToDelete = p as Person;
                if (pToDelete == null)
                {
                    return;
                }

                BusyWndSingleton.Show("Deleting person...");
                try
                {
                    //remove the participant from UI
                    persons.Remove(pToDelete);
                    lstBxParticipants.Items.Refresh();
                    changesExist = true;
                    DaoUtils.deletePersonAndPoints(pToDelete);
                }
                finally
                {
                    BusyWndSingleton.Hide();
                }
            }
        }
Пример #2
0
        public void btnSave_Click(object sender, RoutedEventArgs e)
        {
            BusyWndSingleton.Show("Saving argument, please wait...");
            try
            {
                Topic    t;
                ArgPoint editedPoint;
                getPointAndTopic(out editedPoint, out t);
                if (t == null || editedPoint == null)
                {
                    return;
                }

                if (!t.ArgPoint.Contains(editedPoint))
                {
                    t.ArgPoint.Add(editedPoint);
                }

                if (editedPoint.Description == null)
                {
                    editedPoint.Description = new RichText();
                }
                editedPoint.Description.Text = theBadge.plainDescription.Text;

                saveProcedure(null, -1);
            }
            finally
            {
                BusyWndSingleton.Hide();
            }
        }
Пример #3
0
        private void btnAddPoint_Click(object sender, RoutedEventArgs e)
        {
            Topic t = lstTopics.SelectedItem as Topic;

            if (t == null)
            {
                return;
            }

            BusyWndSingleton.Show("Creating new argument...");
            try
            {
                int orderNumber = OwnArgPoints.Any() ? OwnArgPoints.Last().Ap.OrderNumber + 1 : 1;

                var np = DaoUtils.NewPoint(lstTopics.SelectedItem as Topic, orderNumber);
                if (np != null)
                {
                    theBadge.RemoveFocusFromInputControls();
                    theBadge.DataContext = np;
                    t.ArgPoint.Add(np);
                }
                UpdatePointsOfTopic(lstTopics.SelectedItem as Topic);

                ArgPointExt newArgPointExt = OwnArgPoints.FirstOrDefault(i => i.Ap == np);

                lstPoints.SelectedItem = newArgPointExt;

                saveProcedure(null, -1);
            }
            finally
            {
                BusyWndSingleton.Hide();
            }
        }
Пример #4
0
        private void btnConfirm_Click_1(object sender, RoutedEventArgs e)
        {
            var dstTopic = lstDstTopics.SelectedItem as Topic;

            if (dstTopic == null)
            {
                MessageDlg.Show("Target topic not selected");
                return;
            }

            BusyWndSingleton.Show("Copying points...");
            try
            {
                var ownId  = SessionInfo.Get().person.Id;
                var discId = SessionInfo.Get().discussion.Id;
                foreach (var ap in dstPoints)
                {
                    copyArgPointTo(ap, dstTopic);
                }

                PrivateCenterCtx.SaveChangesIgnoreConflicts();

                _sharedClient.clienRt.SendNotifyStructureChanged(dstTopic.Id, ownId, DeviceType.Wpf);
                var srcTopic = lstSrcTopics.SelectedItem as Topic;
                _sharedClient.clienRt.SendStatsEvent(StEvent.ArgPointTopicChanged, ownId, discId, srcTopic.Id,
                                                     DeviceType.Wpf); //src
                _sharedClient.clienRt.SendStatsEvent(StEvent.ArgPointTopicChanged, ownId, discId, dstTopic.Id,
                                                     DeviceType.Wpf); //dst
            }
            finally
            {
                BusyWndSingleton.Hide();
            }
        }
Пример #5
0
        //void EnsureNonNullDiscussion()
        //{
        //    if (EditedDiscussion == null)
        //        btnAddDiscussion_Click(null,null);
        //}

        private void btnRemove_Click(object sender, RoutedEventArgs e)
        {
            if (EditedDiscussion != null && Ctors.DiscussionExists(EditedDiscussion))
            {
                BusyWndSingleton.Show("Deleting discussion...");
                try
                {
                    if (SessionInfo.Get().discussion != null)
                    {
                        if (SessionInfo.Get().discussion.Id == EditedDiscussion.Id)
                        {
                            SessionInfo.Get().discussion = null;
                        }
                    }

                    DaoUtils.DeleteDiscussion(EditedDiscussion);
                    discussionSelector.Set(PublicBoardCtx.Get().Discussion, "Subject");
                    EditedDiscussion = null;
                }
                finally
                {
                    BusyWndSingleton.Hide();
                }
            }
        }
Пример #6
0
        private void onStructChanged(int activeTopic, int initiaterId, DeviceType devType)
        {
            if (initiaterId == SessionInfo.Get().person.Id&& devType == DeviceType.Wpf)
            {
                return;
            }

            BusyWndSingleton.Show("Fetching changes...");
            try
            {
                //save selected topic
                int topicUnderSelectionId = -1;
                var sel = lstTopics.SelectedItem as Topic;
                if (sel != null)
                {
                    topicUnderSelectionId = sel.Id;
                }

                //save selected list of points
                var selectedAp = theBadge.DataContext as ArgPoint;

                ForgetDBDiscussionState();
                DiscussionSelectionChanged();

                //select previously selected topic
                if (topicUnderSelectionId != -1)
                {
                    lstTopics.SelectedItem = PrivateCenterCtx.Get().Topic.FirstOrDefault(t0 => t0.Id == topicUnderSelectionId);
                }

                //select previously selected point
                if (selectedAp != null)
                {
                    //own list
                    if (selectedAp.Person.Id == SessionInfo.Get().person.Id)
                    {
                        lstPoints.SelectedItem = null;
                        lstPoints.SelectedItem = OwnArgPoints.FirstOrDefault(ap0 => ap0.Ap.Id == selectedAp.Id);
                    }
                    else
                    {
                        lstOtherUsers.SelectedItem = OtherUsers.FirstOrDefault(u0 => u0.Pers.Id == selectedAp.Person.Id);

                        lstBadgesOfOtherUser.SelectedItem =
                            ArgPointsOfOtherUser.FirstOrDefault(ap0 => ap0.Ap.Id == selectedAp.Id);
                    }
                }
            }
            finally
            {
                BusyWndSingleton.Hide();
            }
        }
Пример #7
0
 private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     BusyWndSingleton.Show("Saving argument, please wait...");
     try
     {
         SaveProcedure();
     }
     finally
     {
         BusyWndSingleton.Hide();
     }
 }
Пример #8
0
        private void btnRemovePoint_Click(object sender, RoutedEventArgs e)
        {
            if (DateTime.Now.Subtract(_recentRemovalStamp).TotalSeconds < 2.0)
            {
                return;
            }
            _recentRemovalStamp = DateTime.Now;

            ArgPoint ap;
            Topic    t;

            getPointAndTopic(out ap, out t);
            if (ap == null)
            {
                return;
            }
            if (ap.Person.Id != SessionInfo.Get().person.Id)
            {
                return;
            }

            BusyWndSingleton.Show("Removing argument...");
            try
            {
                if (ap.Topic != null)
                {
                    Topic t1 = ap.Topic;

                    recentlyDeleted        = new PointRemoveRecord();
                    recentlyDeleted.person = ap.Person;
                    recentlyDeleted.point  = ap;
                    recentlyDeleted.topic  = ap.Topic;

                    PublicBoardCtx.DropContext();
                    DaoUtils.UnattachPoint(ap);

                    RenumberPointsAfterDeletion(t1, SessionInfo.Get().person.Id);

                    UpdatePointsOfTopic(t1);

                    saveProcedure(ap, t1.Id);
                }
            }
            finally
            {
                BusyWndSingleton.Hide();
            }
        }
Пример #9
0
        private void confirm()
        {
            try
            {
                BusyWndSingleton.Show("Uploading changes, please wait");
                SaveDiscussion();
            }
            finally
            {
                BusyWndSingleton.Hide();
            }

            //by selecting manual device type, we force all clients not to ignore the update as own (e.g. our private board will
            //update, not ignore this notification)
            _sharedClient.clienRt.SendNotifyStructureChanged(-1, SessionInfo.Get().person.Id, DeviceType.Sticky);

            Confirmed = true;
        }
Пример #10
0
 private void btnToPDF_Click(object sender, RoutedEventArgs e)
 {
     BusyWndSingleton.Show("Generating report...");
     GenerateReport();
     BusyWndSingleton.Hide();
 }