コード例 #1
0
 void Instance_OnSlideLockChanged(Slide slide, bool IsLocked, LockingInfo info)
 {
     if (PresentationController.Instance.SelectedSlide.Id == slide.Id)
     {
         this.Invoke(new MethodInvoker(() =>
             {
                 propertyGrid1.IsEnabled = IsLocked && PresentationController.Instance.CanUnlockSlide(slide);
             }));
     }
 }
コード例 #2
0
        static string GetSlideLockingInfoDescr(string name, LockingInfo info, bool useName)
        {
            StringBuilder sb = new StringBuilder();
            if (useName)
                sb.AppendFormat("Сцена {0}", name);
            else
                sb.Append("Сцена");

            if (info != null)
            {
                sb.Append(" заблокирована ");
                switch (info.RequireLock)
                {
                    case RequireLock.ForEdit: sb.Append("для редактирования"); break;
                    case RequireLock.ForShow: sb.Append("для показа"); break;
                }

                sb.AppendFormat(" пользователем {0}", string.IsNullOrEmpty(info.UserIdentity.User.FullName) ? info.UserIdentity.User.Name : info.UserIdentity.User.FullName);
            }
            else
                sb.Append(" не заблокирована");

            return sb.ToString();
        }
コード例 #3
0
 protected abstract void _lockService_AddItem(UserIdentity userIdentity, ObjectKey key, LockingInfo value);
コード例 #4
0
        protected Presentation Merge(UserIdentity identity,
                                     PresentationInfo presentationInfo,
                                     Slide[] newSlideArr,
                                     Presentation presentationStored,
                                     out LockingInfo[] lockedSlides,
                                     out Slide[] slideAlreadyExists)
        {
            IEnumerable<Slide> existedSlides = presentationStored.SlideList.Where(
                sl => newSlideArr.Any(newsl=>newsl.Id == sl.Id));
            if (existedSlides.Count() != 0)
            {
                slideAlreadyExists = existedSlides.ToArray();
                lockedSlides = new LockingInfo[] {};
                return null;
            }

            foreach (Slide slide in newSlideArr)
            {
                //Slide slideStored = presentationStored.SlideList.Find(
                //    sl => sl.Id == slide.Id);
                //if (slideStored != null) return null;
                slide.State = SlideState.Normal;
                presentationStored.SlideList.Add(slide);
            }
            // анализ удаленных слайдов
            List<Slide> slideListDeleted = presentationStored.SlideList.FindAll(
                sl => !presentationInfo.SlideInfoList.Exists(sli => sli.Id == sl.Id));
            if (!IsStandAlone)
            {
                IEnumerable<LockingInfo> lockedSl = slideListDeleted.Select(
                    sl => _lockService.GetLockInfo(ObjectKeyCreator.CreateSlideKey(presentationInfo.UniqueName, sl.Id))).Where(
                    li=>li != null);

                if (lockedSl.Count() != 0)
                {
                    lockedSlides = lockedSl.ToArray();
                    slideAlreadyExists = new Slide[] {};
                    return null;
                }
            }
            // удаляем слайды
            presentationStored.SlideList.RemoveAll(slideListDeleted.Contains);
            presentationStored.SavePresentationLevelChanges(presentationInfo);
            slideAlreadyExists = new Slide[] { };
            lockedSlides = new LockingInfo[] { };
            return presentationStored;
        }
コード例 #5
0
 public static string GetSlideLockingInfoDescr(string name, LockingInfo info)
 {
     return GetSlideLockingInfoDescr(name, info, true);
 }
コード例 #6
0
 public static string GetSlideLockingInfoDescr(LockingInfo info)
 {
     return GetSlideLockingInfoDescr(string.Empty, info, false);
 }
コード例 #7
0
        void Instance_OnSlideLockChanged(Slide slide, bool IsLocked, LockingInfo info)
        {
            bool lockForShow = info != null && info.RequireLock == RequireLock.ForShow;
            if (slideViews(slide) != null)
            {
                if ((Viewer as Control).IsHandleCreated)
                {
                    ((Control)Viewer).Invoke(new MethodInvoker(() =>
                    {
                        if (IsLocked)

                            slideViews(slide).Lock(!lockForShow);
                        else
                        {
                            slideViews(slide).Unlock();
                        }
                    }));
                }
                else
                {
                    if (IsLocked)
                        slideViews(slide).Lock(!lockForShow);
                    else
                    {
                        slideViews(slide).Unlock();
                    }
                }
            }
        }
コード例 #8
0
ファイル: LayoutController.cs プロジェクト: AlexSneg/VIRD-1.0
 void OnSlideLockChanged(Slide slide, bool IsLocked, LockingInfo info)
 {
     if (CurrentLayout != null)
     {
         if (slide == CurrentLayout.Slide)
         {
             _slideLocked = IsLocked && PresentationController.Instance.CanUnlockSlide(slide);
             _view.EnableEdit(CanEdit);
         }
     }
 }
コード例 #9
0
 override protected void _lockService_AddItem(UserIdentity userIdentity, ObjectKey key, LockingInfo value)
 {
     PresentationKey presentationKey = GetPresentationKey(key);
     if (presentationKey == null) return;
     if (key.GetObjectType() == ObjectType.Presentation)
         _globalNotifier.Notify(userIdentity, this, "ObjectLocked", value);
     else
     {
         _presentationNotifier.Notify(userIdentity, presentationKey, "ObjectLocked", value);
     }
     //_presentationNotifier.SubscribeForMonitor(presentationKey, value.UserIdentity);
 }
コード例 #10
0
 void m_controller_OnSlideLockChanged(Slide slide, bool IsLocked, LockingInfo info)
 {
     if (slide != null)
     {
         if (m_controller.IsSlideSelected(slide))
         {
             if (this.IsHandleCreated)
             {
                 this.Invoke(new MethodInvoker(() =>
                     {
                         lockStripButton.Enabled = !IsLocked;
                         unlockStripButton.Enabled = IsLocked;
                         //removeStripButton.Enabled = !IsLocked;
                     }));
             }
         }
     }
     else
     {
         this.Invoke(new MethodInvoker(() =>
                 {
                     lockStripButton.Enabled = false;
                     unlockStripButton.Enabled = false;
                     //removeStripButton.Enabled = false;
                 }));
     }
     SetLockButtonsState(slide);
 }
コード例 #11
0
        void UpdateKeyStatus(PresentationKey key, LockingInfo info)
        {
            var pp = pList.Where(p => p.UniqueName == key.PresentationUniqueName);
            if (pp.Count() > 0)
            {
                PresentationInfo pi = pp.First();
                PresentationInfoExt ext = new PresentationInfoExt(pi, info);
                int i = pList.IndexOf(pi);
                if ((i != -1) && i <= pList.Count - 1)
                    pList[i] = ext;

                view.Invoke(new MethodInvoker(() =>
                {
                    view.RefreshView();
                }));
            }
        }
コード例 #12
0
ファイル: LockingInfo.cs プロジェクト: AlexSneg/VIRD-1.0
 public LockingInfoWithCommunicationObject(LockingInfo lockingInfo, ICommunicationObject communicationObject)
 {
     _lockingInfo = lockingInfo;
     _communicationObject = communicationObject;
 }
コード例 #13
0
        private void UpdateSlideStatus(SlideKey key, LockingInfo info)
        {
            //это касается нашего сценария?
            if (((PresentationKey)(key.PresentationKey)).PresentationUniqueName == this.m_Presentation.UniqueName)
            {
                Slide slide = m_Presentation.SlideList.FirstOrDefault(s => s.Id == key.Id);
                lock (_lockUpdateSlideStatus)
                {
                    if (slide != null)
                    {
                        //update lock info
                        SlideInfo sInfo = m_PresentationInfo.SlideInfoList.FirstOrDefault(s => s.Id == key.Id);
                        bool otherUserLockForShow = ((sInfo.LockingInfo != null) && (info != null) && !sInfo.LockingInfo.UserIdentity.Equals(info.UserIdentity) && (info.RequireLock == RequireLock.ForShow));
                        sInfo.LockingInfo = info;
                        if ((info == null) || otherUserLockForShow) //slide changed something else
                        {
                            slide.Cached = false;
                            slide.State = SlideState.Normal;
                            LoadSlide(slide);
                            //if (otherUserLockForShow && (OnSlideChangedExternally != null))
                            //    OnSlideChangedExternally(slide);

                            if (SelectedSlide.Id == slide.Id)
                                PerformChangeLayout();
                        }
                        SendOnSlideLockChanged(slide, info != null, info);
                        if (otherUserLockForShow && (OnOtherUserLockForShow != null) && PresentationChanged)
                        {
                            OnOtherUserLockForShow(slide);
                        }
                    }
                }
            }
        }
コード例 #14
0
 public void SendOnSlideLockChanged(Slide slide, bool Locked, LockingInfo info)
 {
     if (OnSlideLockChanged != null)
         OnSlideLockChanged(slide, Locked, info);
 }