コード例 #1
0
 void ExecCancel()
 {
     if (AddMode)
     {
         AddMode = false;
         AddCmd.RaiseCanExecuteChanged();
         RemoveCmd.RaiseCanExecuteChanged();
         NormalUIState();
         if (Temp != null)
         {
             SelectedItem = Temp;
             Temp         = null;
         }
         else
         {
             CurrentObject = null;
         }
         return;
     }
     if (EditMode)
     {
         EditMode = false;
         AddCmd.RaiseCanExecuteChanged();
         RemoveCmd.RaiseCanExecuteChanged();
         NormalUIState();
         _dataService.GetPartition(SelectedItem.Id, (data, error) =>
         {
             if (error != null)
             {
                 return;
             }                                   // Report error here
             CurrentObject = data;
         });
     }
 }
コード例 #2
0
        internal static void Register(CommandLineApplication app,
                                      Func <ILogger> getLogger)
        {
            app.Command("remove", RemoveCmd =>
            {
                RemoveCmd.Command("source", SourceCmd =>
                {
                    CommandArgument name = SourceCmd.Argument(
                        "name", Strings.SourcesCommandNameDescription);
                    CommandOption configfile = SourceCmd.Option(
                        "--configfile",
                        Strings.Option_ConfigFile,
                        CommandOptionType.SingleValue);
                    SourceCmd.HelpOption("-h|--help");
                    SourceCmd.Description = Strings.RemoveSourceCommandDescription;
                    SourceCmd.OnExecute(() =>
                    {
                        var args = new RemoveSourceArgs()
                        {
                            Name       = name.Value,
                            Configfile = configfile.Value(),
                        };

                        RemoveSourceRunner.Run(args, getLogger);
                        return(0);
                    });
                });
                RemoveCmd.Command("client-cert", ClientCertCmd =>
                {
                    CommandOption packagesource = ClientCertCmd.Option(
                        "-s|--package-source",
                        Strings.Option_PackageSource,
                        CommandOptionType.SingleValue);
                    CommandOption configfile = ClientCertCmd.Option(
                        "--configfile",
                        Strings.Option_ConfigFile,
                        CommandOptionType.SingleValue);
                    ClientCertCmd.HelpOption("-h|--help");
                    ClientCertCmd.Description = Strings.RemoveClientCertCommandDescription;
                    ClientCertCmd.OnExecute(() =>
                    {
                        var args = new RemoveClientCertArgs()
                        {
                            PackageSource = packagesource.Value(),
                            Configfile    = configfile.Value(),
                        };

                        RemoveClientCertRunner.Run(args, getLogger);
                        return(0);
                    });
                });
                RemoveCmd.HelpOption("-h|--help");
                RemoveCmd.Description = Strings.Remove_Description;
                RemoveCmd.OnExecute(() =>
                {
                    app.ShowHelp("remove");
                    return(0);
                });
            });
        }
コード例 #3
0
ファイル: ProtocolEditUi.cs プロジェクト: d-german/sleepEdit
        private void _RemoveNode(ProtocolNode parent, ProtocolNode childNode)
        {
            List <ProtocolNode> list = null;

            getNodesThatLinkToNodeId_(mProtocolNode, ref list, childNode.Id);
            var cmd = new RemoveCmd(parent, childNode, list);

            cmd.Execute();
        }
コード例 #4
0
 void ExecEdit()
 {
     if (SelectedItem != null)
     {
         EditMode = true;
         AddCmd.RaiseCanExecuteChanged();
         RemoveCmd.RaiseCanExecuteChanged();
         AddUIState();
         MessengerInstance.Send("focus", "PartitionFocus");
     }
 }
コード例 #5
0
        void ExecSave()
        {
            int i = 0;

            if (AddMode)
            {
                AddMode = false;
                AddCmd.RaiseCanExecuteChanged();
                RemoveCmd.RaiseCanExecuteChanged();
                _dataService.UpdatePartition(CurrentObject, (data, error) =>
                {
                    if (error != null)
                    {
                        return;
                    }                              // Report error here
                    i = data;
                });
                Partitions.Add(CurrentObject);
                SelectedItem = CurrentObject;
                NormalUIState();
                MessengerInstance.Send(SelectedItem, AppContext.PartitionAddedMsg);
                return;
            }
            if (EditMode)
            {
                EditMode = false;
                AddCmd.RaiseCanExecuteChanged();
                RemoveCmd.RaiseCanExecuteChanged();
                _dataService.UpdatePartition(CurrentObject, (data, error) =>
                {
                    if (error != null)
                    {
                        return;
                    }                              // Report error here
                    i = data;
                });

                int ix = Partitions.IndexOf(SelectedItem);
                Partitions[ix] = CurrentObject;
                SelectedItem   = CurrentObject;

                NormalUIState();
                MessengerInstance.Send(SelectedItem, AppContext.PartitionChangedMsg);
                return;
            }
        }
コード例 #6
0
 void ExecAdd()
 {
     AddMode = true;
     if (SelectedItem != null)
     {
         Temp = SelectedItem;
     }
     AddCmd.RaiseCanExecuteChanged();
     RemoveCmd.RaiseCanExecuteChanged();
     SelectedItem = null;
     AddUIState();
     CurrentObject = new Partition()
     {
         Id = 0, Name = "Новый раздел"
     };
     MessengerInstance.Send("focus", "PartitionFocus");
 }
コード例 #7
0
        public DataAnalysisVM(BaseEntity entityToFocusOn, string dbcontextName) : base(dbcontextName)
        {
            //commands
            GoToEntityCmd = new GoToEntityCmd(this);
            RemoveCmd     = new RemoveCmd(this);
            AddCmd        = new AddCmd(this);

            //initialize
            UpdateHeader();
            try
            {
                User     = (Lecturer)App.AppUser;
                UserRole = Role.Lecturer;
                rowLimit = 30;
                Groups   = new ObservableCollection <Group>(UnitOfWork.GroupRepository.GetTopXFromSearch(GroupSearchTxt, rowLimit));
                if (entityToFocusOn is Group)
                {
                    SelectedGroup = UnitOfWork.GroupRepository.Get(entityToFocusOn.Id);
                }
                else if (entityToFocusOn is Session)
                {
                    Session session = (Session)entityToFocusOn;
                    SelectedGroup = UnitOfWork.GroupRepository.Get(session.Group.Id);
                    if (SelectedGroup != null)
                    {
                        SelectedSession = UnitOfWork.SessionRepository.Get(entityToFocusOn.Id);
                    }
                }
                //Register for pooling update signals
                Mediator.Register(MediatorChannels.PoolingUpdate.ToString(), PoolingUpdate);
            }
            catch (Exception ex)
            {
                ShowFeedback(ex.Message, FeedbackType.Error);
            }
        }
コード例 #8
0
ファイル: ProtocolEditUi.cs プロジェクト: d-german/sleepEdit
        private void _RemoveNode(ProtocolNode parent, ProtocolNode childNode)
        {
            RemoveCmd cmd = new RemoveCmd(parent, childNode);

            cmd.Execute();
        }