private bool CanSecureCommandExecute(SecureCommandArgs args)
        {
            if(canExecute == null || canExecute.Invoke(args))
            {
                RoomWindowViewModel roomWindowVM = args.CommandOwner as RoomWindowViewModel;

                if (Me != null && roomWindowVM != null)
                {
                    int targetRoleId = roomWindowVM.SelectedUserVM == null ? BuiltIns.AllRole.Id : roomWindowVM.SelectedUserVM.RoleVM.Id;
                    
                    switch (CommandType)
                    {
                        case BuiltIns.FrontendCommandType:
                        case BuiltIns.UserCommandType:
                            if (roomWindowVM.SelectedUserVM != null)
                            {
                                return Me.HasCommand(roomWindowVM.RoomVM.Id, Id, targetRoleId);
                            }
                            break;
                        case BuiltIns.BackendCommandType:
                            return false;
                        case BuiltIns.NormalCommandType:
                            return true;
                    }
                }
            }
            return false;
        }
 private void ConfigCommandExecute(SecureCommandArgs args)
 {
     if (args != null)
     {
         ConfigurationItemViewModel vm = null;
         ConfigType type = (ConfigType)args.Content;
         switch (type)
         {
             case ConfigType.Audio:
                 vm = new ConfigurationItemViewModel(ApplicationVM.ProfileVM.AudioConfigurationVM);
                 break;
             case ConfigType.Vedio:
                 vm = new ConfigurationItemViewModel(ApplicationVM.ProfileVM.VideoConfigurationVM);
                 break;
             case ConfigType.Personal:
                 break;
             default:
                 break;
         }
         if (vm != null)
         {
             Messenger.Default.Send<EnumNotificationMessage<object, RoomWindowAction>>(new EnumNotificationMessage<object, RoomWindowAction>(RoomWindowAction.ShowConfigWindow, vm));
         }
     }
 }
Exemple #3
0
        public bool CanExecute(object parameter = null)
        {
            if (this.canExecute == null)
            {
                return(true);
            }

            SecureCommandArgs args = parameter as SecureCommandArgs;

            if (args == null)
            {
                args         = new SecureCommandArgs();
                args.Content = parameter;
            }
            if (args.CommandOwner == null && Owner != null)
            {
                args.CommandOwner = Owner;
            }
            if (args.CommnadTarget == null && Target != null)
            {
                args.CommnadTarget = Target;
            }

            return(this.canExecute.Invoke(args));
        }
 private void SwitchUserCommandExecute(SecureCommandArgs args)
 {
     if (CanSwitchUserCommandExecute(args))
     {
         Messenger.Default.Send<EnumNotificationMessage<object, HallWindowAction>>(new EnumNotificationMessage<object, HallWindowAction>(HallWindowAction.SwitchUser));
     }
 }
 public void ExecuteCommand(CommandViewModel commandVM, SecureCommandArgs args)
 {
     var act = GetCommandDelegate(commandVM);
     if (act != null)
     {
         act(args);
     }
 }
 private void SelectUserCommandExecute(SecureCommandArgs args)
 {
     if (CanSelectUserCommandExecute(args))
     {
         RoomWindowVM.SelectUser(this);
         ApplicationVM.RoomWindowVM.CallJavaScript("addMicAndChatUser", NickName, Id);
     }
 }
 private void DeleteAllImageCommandExecute(SecureCommandArgs args)
 {
     for (int i = 0; i < Images.Count; i++)
     {
         orMapper.Delete(new Image { Id = Images[i].Id });
     }
     Images.Clear();
 }
 private void DeleteSelectedImageGroupCommandExecute(SecureCommandArgs args)
 {
     if (!string.IsNullOrEmpty(SelectedImageGroup))
     {
         orMapper.ExecuteCommand("delete from Image where [ImageGroup]='" + SelectedImageGroup + "'");
     }
     ImageGroups.Remove(SelectedImageGroup);
     Images.Clear();
     SelectedImageGroup = Text.Select;
 }
 private void SelectImageGroupCommandExecute(SecureCommandArgs args)
 {
     if (!string.IsNullOrEmpty(SelectedImageGroup) && SelectedImageGroup != Text.Select)
     {
         Images.Clear();
         var imgs = orMapper.Search<Image>("[ImageGroup]='" + SelectedImageGroup+"'");
         imgs.ForEach(img =>
             {
                 Images.Add(new ImageViewModel { Id = img.Id, Title = img.Name, ImageGroup = img.ImageGroup, TheImage = img.TheImage });
             });
     }
 }
 private void DeleteSelectedImageCommandExecute(SecureCommandArgs args)
 {
     for (int i = 0; i < Images.Count; )
     {
         if (Images[i].IsSelected)
         {
             orMapper.Delete(new Image { Id = Images[i].Id });
             Images.RemoveAt(i);
             continue;
         }
         i++;
     }
 }
 private void SecureCommandExecute(SecureCommandArgs args)
 {
     if (CanSecureCommandExecute(args))
     {
         if (execute == null)
         {
             ApplicationVM.ExecuteCommand(this, args);
         }
         else
         {
             execute(args);
         }
     }
 }
 private void OnMicCommandExecute(SecureCommandArgs args)
 {
     if (args != null && RoomClient != null)
     {
         MicType micType = (MicType)args.Content;
         if (Me.MicStatus == MicStatusMessage.MicStatus_Off)
         {
             RoomClient.OnMic(RoomVM.Id, micType, -1);
         }
         else
         {
             switch (micType)
             {
                 case MicType.Private:
                     PrivateMicUserVMs.Remove(Me);
                     break;
                 case MicType.Secret:
                     SecretMicUserVMs.Remove(Me);
                     break;
                 case MicType.Public:
                     switch (Me.MicIndex)
                     {
                         case 0:
                             FirstMicUserVM = null;
                             break;
                         case 1:
                             SecondMicUserVM = null;
                             break;
                         case 2:
                             ThirdMicUserVM = null;
                             break;
                     }
                     break;
             }
             RoomClient.DownMic(RoomVM.Id, micType, Me.MicIndex);
             Me.DownMic();
             updateMicImage(Me.Id, false);// update the local image manually as the downmic meesage will not be received by itself.
         }
     }
 }
Exemple #13
0
        public virtual void Execute(object parameter = null)
        {
            if ((this.CanExecute(parameter) && (this.execute != null)))
            {
                SecureCommandArgs args = parameter as SecureCommandArgs;
                if (args == null)
                {
                    args         = new SecureCommandArgs();
                    args.Content = parameter;
                }

                if (args.CommandOwner == null && Owner != null)
                {
                    args.CommandOwner = Owner;
                }
                if (args.CommnadTarget == null && Target != null)
                {
                    args.CommnadTarget = Target;
                }
                this.execute.Invoke(args);
            }
        }
        public virtual void Execute(object parameter = null)
        {
            if ((this.CanExecute(parameter) && (this.execute != null)))
            {
                SecureCommandArgs args = parameter as SecureCommandArgs;
                if (args == null)
                {
                    args = new SecureCommandArgs();
                    args.Content = parameter;
                }

                if (args.CommandOwner == null && Owner != null)
                {
                    args.CommandOwner = Owner;
                }
                if (args.CommnadTarget == null && Target != null)
                {
                    args.CommnadTarget = Target;
                }
                this.execute.Invoke(args);
            }
        }
        public bool CanExecute(object parameter = null)
        {
            if (this.canExecute == null)
            {
                return true;
            }

            SecureCommandArgs args = parameter as SecureCommandArgs;
            if (args == null)
            {
                args = new SecureCommandArgs();
                args.Content = parameter;
            }
            if (args.CommandOwner == null && Owner != null)
            {
                args.CommandOwner = Owner;
            }
            if (args.CommnadTarget == null && Target != null)
            {
                args.CommnadTarget = Target;
            }

            return this.canExecute.Invoke(args);
        }
 public bool CanStartCapturePhotoCommandExecute(SecureCommandArgs arg)
 {
     return Cameras.Count > 0;
 }
		public bool CanResetCommandExecute(SecureCommandArgs args)
		{
            return true;
		}
		public void ResetCommandExecute(SecureCommandArgs args)
		{
			Reset();
		}
		public void SaveCommandExecute(SecureCommandArgs args)
		{
            bool result = false;
			Save(out result);
            if (result == true)
            {
                Message = Messages.SaveSucceeded;
            }
            else
            {
                Message = Messages.SaveFailed;
            }
		}
		public void SaveCommandExecute(SecureCommandArgs args)
		{
			Save();
		}
 private bool CanSwitchUserCommandExecute(SecureCommandArgs args)
 {
     return ApplicationVM.LocalCache.CurrentUserVM != null;
 }
 public void StartScreenCaptureCommandExecute(SecureCommandArgs arg)
 {
     Messenger.Default.Send<EnumNotificationMessage<object, ConfigurationWindowAction>>(new EnumNotificationMessage<object, ConfigurationWindowAction>(ConfigurationWindowAction.StartScreenCapture, this));
 }
 public void CameraImageCommandExecute(SecureCommandArgs arg)
 {
     Messenger.Default.Send<EnumNotificationMessage<Object, ConfigurationWindowAction>>(new EnumNotificationMessage<object, ConfigurationWindowAction>(ConfigurationWindowAction.CameraPhotoSelect, this));
 }
 public void CommandExecute(SecureCommandArgs args)
 {
     Messenger.Default.Send<EnumNotificationMessage<object, ConfigurationWindowAction>>(new EnumNotificationMessage<object, ConfigurationWindowAction>(ConfigurationWindowAction.ConfigurationStateChanged,this));
 }
 private void CancelCommandExecute(SecureCommandArgs args)
 {
     ApplicationVM.ShutDown();
 }
 public void SaveCapturePhotoCommandExecute(SecureCommandArgs arg)
 {
     Messenger.Default.Send<EnumNotificationMessage<Object, CameraWindowAction>>(new EnumNotificationMessage<object, CameraWindowAction>(CameraWindowAction.Save, this));
     CanSave = false;
 }
 public bool CanSaveCapturePhotoCommandExecute(SecureCommandArgs arg)
 {
     return CanSave;
 }
 public bool CanStartScreenCaptureCommandExecute(SecureCommandArgs arg)
 {
     return PhotoPath != null;
 }
 private bool CanCancelCommandExecute(SecureCommandArgs args)
 {
     return CanCancel;
 }
 public bool CanEndScreenCaptureCommandExecute(SecureCommandArgs arg)
 {
     return IsCutting;
 }
 public bool CanCommandExecute(SecureCommandArgs args)
 {
     return ApplicationVM.LocalCache.CurrentUserVM != null;
 }
 public bool CanSelectImageCommandExecute(SecureCommandArgs arg)
 {
     return Me != null;
 }