Inheritance: EditorWindow
Exemple #1
0
        /// <summary>
        /// 新建一个Subscribtion
        /// </summary>
        private async void EditFeedButton_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
        {
            EditDialog EditFeedDialog = new EditDialog();
            await EditFeedDialog.ShowAsync();

            FeedEditListView.SelectedItem = null;
        }
        public EditSimpleListPage(
            string pageID,
            string subjectName,
            Icon displayIcon,
            string ownerType,
            string subjectListRelationship,
            string memberType,
            GetSubjectDescriptionDelegate getSubjectDescription,
            GetListMembersDelegate getListMembers,
            DoAddMemberDelegate addMember,
            DoDelMemberDelegate delMember,
            EditDialog editDialog)
        {
            this.pageID = pageID;
            InitializeComponent();
            lbSubject.Text = String.Format(lbSubject.Text, subjectName);
            lbSubjectListRelationship.Text = String.Format(lbSubjectListRelationship.Text, subjectListRelationship);
            pbSubjectImage.Image           = displayIcon.ToBitmap();
            this.getSubjectDescription     = getSubjectDescription;
            this.getListMembers            = getListMembers;
            this.addMember = addMember;
            this.delMember = delMember;

            this.listOwnerType  = ownerType;
            this.listMemberType = memberType;

            this.editDialog = editDialog;

            this.tbDescription.Select();
        }
Exemple #3
0
        private async void AddResultButton_Click(object sender, RoutedEventArgs e)
        {
            DBT.Text         = SomeSeparator.ActualWidth.ToString();
            EditTextBox.Text = String.Empty;
            NonePunishmentRadioButton.IsChecked = true;

            var dialogResult = await EditDialog.ShowAsync();

            if (dialogResult == ContentDialogResult.Primary)
            {
                var result = Double.TryParse(EditTextBox.Text, out double value);

                if (result && value > 0)
                {
                    App.MainPageInstance.UpdateResult(new Result(
                                                          value,
                                                          MainPage.Results.Count + 2, GetCheckedPunishment(),
                                                          null));
                }
                else
                {
                    ShowAlertDialogAsync("Input Format Error!");
                }

                UpdateTotalStatistics();
            }
        }
Exemple #4
0
        private async void ModifyFlyoutItem_Click(object sender, RoutedEventArgs e)
        {
            var indexToModify = (int)(sender as MenuFlyoutItem).Tag;

            EditTextBox.Text = Results[indexToModify].ResultValue.ToString();
            SetCheckedRadioButton(Results[indexToModify].ResultPunishment);

            var dialogResult = await EditDialog.ShowAsync();

            if (dialogResult == ContentDialogResult.Primary)
            {
                var result = Double.TryParse(EditTextBox.Text, out double value);

                if (result && value > 0)
                {
                    //1. Modify result in current memory
                    //2. Modify result in MainPage memory Done by one line of code
                    MainPage.Results[indexToModify].ResultValue      = value;
                    MainPage.Results[indexToModify].ResultPunishment = GetCheckedPunishment();

                    //3. Recalculate Ao5/Ao12 results
                    App.MainPageInstance.RefreshListOfResult(indexToModify, MainPage.Results);

                    //4. Modify result in disk
                    MainPage.SaveDataAsync(false);
                }
                else
                {
                    ShowAlertDialogAsync("Input Format Error!");
                }

                UpdateTotalStatistics();
            }
        }
Exemple #5
0
        private async void EditTodoBtn_Click(XamlUICommand sender, ExecuteRequestedEventArgs args)
        {
            string id = args.Parameter as string;

            EditDialog.Tag          = id;
            TxbEditTitle.Text       = TodoList.GetTodo(id).Title;
            TxbEditDescription.Text = TodoList.GetTodo(id).Description;
            await EditDialog.ShowAsync();
        }
Exemple #6
0
        private async void OnEditButtonClick(GridRowMouseEventArgs e)
        {
            var product = e.DataItem as Product;

            if (product == null)
            {
                return;
            }
            product.Description = $"Product with ID = {product.ProductId} editing . . .";
            EditorItem          = product;
            await EditDialog.Show();
        }
        private async void EditButton_Click(object sender, RoutedEventArgs e)
        {
            EditDialog dialog = new EditDialog(MyVocabulary);
            await dialog.ShowAsync();

            Bindings.Update();

            var frame = (Frame)Window.Current.Content;
            var page  = (MainPage)frame.Content;

            page.SaveBtnEnabled = true;
            page.UpdateSelectedVocContent();
        }
Exemple #8
0
        /// <summary>
        /// 编辑节点,只改变节点Name字段
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editNode_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tmpDialog = new EditDialog();
            DataRow[] rows;
            //树节点的富文本框添加现在选中节点的名字
            try
            {
                uint id = Convert.ToUInt32(tmpTree.SelectedNode.Tag);
                tmpDialog.RichTextBox.Text = tmpTree.SelectedNode.Text; //回填现在的节点名字

                if (tmpDialog.Show() == DialogResult.OK)
                {
                    tmpTree.SelectedNode.Text = tmpDialog.NodeName; //改变节点的名字
                }

                switch (flag)
                {
                case 0: break;

                case 1:
                    rows = m_DesignDataTable.Select("Id='" + id + "'");
                    rows[0].BeginEdit();
                    rows[0]["Name"]          = tmpTree.SelectedNode.Text;
                    dataGridView[2, 0].Value = tmpTree.SelectedNode.Text;    //界面上视图的改变
                    //rows[0]["DesignContent"] = richTextBox.Rtf; //先编辑内容,然后点击编辑节点,跟习惯的顺序不一致
                    rows[0].EndEdit();
                    break;

                case 2:
                    rows = m_TestDataTable.Select("Id='" + id + "'");
                    rows[0].BeginEdit();
                    rows[0]["Name"] = tmpTree.SelectedNode.Text;
                    // vGridControl.SetCellValue(vGridControl.Rows["Name"], 0, tmpTree.SelectedNode.Text);//界面上视图的改变
                    //判断一下是否为空
                    //rows[0]["TestIdentify"] = vGridControl.GetCellValue(TestIdentify, 0).ToString();
                    //rows[0]["TestPriority"] = testPrio_index;
                    //rows[0]["TraceRelationships"] = vGridControl.GetCellValue(TraceRelationships, 0).ToString();
                    //rows[0]["TestContent"] = vGridControl.GetCellValue(TestContent, 0).ToString();
                    //rows[0]["TestReqResolve"] = vGridControl.GetCellValue(TestReqResolve, 0).ToString();
                    //rows[0]["AdequacyRequirements"] = vGridControl.GetCellValue(AdequacyRequirements, 0).ToString();
                    //rows[0]["TerminalCondition"] = vGridControl.GetCellValue(TerminalCondition, 0).ToString();
                    rows[0].EndEdit();
                    break;
                }
            }
            catch
            {
                MessageBox.Show("请选择节点");
            }
        }
        private async void EditButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            // Prepare ViewModel.
            var companyCarViewModel = new CompanyCarViewModel(ViewModel.SelectedCompanyCar);

            companyCarViewModel.PropertyChanged += (obj, ev) => EditDialog.IsPrimaryButtonEnabled = companyCarViewModel.IsValid;
            companyCarViewModel.Validate();
            EditDialog.DataContext = companyCarViewModel;

            // Process Dialog.
            var result = await EditDialog.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                // Update model.
                companyCarViewModel.Update(ViewModel.SelectedCompanyCar);
            }

            // Cleanup.
            companyCarViewModel.PropertyChanged -= (obj, ev) => EditDialog.IsPrimaryButtonEnabled = companyCarViewModel.IsValid;
        }
Exemple #10
0
        public override Window CreateEditDialog(Window owner, ISemanticNetwork semanticNetwork, ILanguage language)
        {
            var control = new ProcessesStatementControl
            {
                Statement = this,
            };

            control.Initialize(semanticNetwork, language);
            var dialog = new EditDialog
            {
                Owner                 = owner,
                Editor                = control,
                Title                 = language.GetExtension <ILanguageProcessesModule>().Statements.Names.Processes,
                SizeToContent         = SizeToContent.WidthAndHeight,
                MinWidth              = 200,
                MinHeight             = 100,
                WindowStartupLocation = WindowStartupLocation.CenterOwner,
            };

            dialog.Localize(language);
            return(dialog);
        }
Exemple #11
0
        public Window CreateEditDialog(Window owner, Semantics.ISemanticNetwork semanticNetwork, ILanguage language)
        {
            updateAttributes(Repositories.Attributes, language);
            var control = new ConceptControl
            {
                EditValue = this,
            };

            control.Initialize(semanticNetwork, language);
            var dialog = new EditDialog
            {
                Owner                 = owner,
                Editor                = control,
                Title                 = language.GetExtension <IWpfUiModule>().Misc.Concept,
                SizeToContent         = SizeToContent.WidthAndHeight,
                MinWidth              = 200,
                MinHeight             = 100,
                WindowStartupLocation = WindowStartupLocation.CenterOwner,
            };

            dialog.Localize(language);
            return(dialog);
        }
        private void renameKnowledgeClick(object sender, RoutedEventArgs e)
        {
            var semanticNetworkNode = SelectedItem as SemanticNetworkNode;

            if (semanticNetworkNode == null)
            {
                return;
            }

            var editingName = semanticNetworkNode.SemanticNetwork.Name;

            var control = new LocalizedStringVariableControl();

            control.Localize(_application.CurrentLanguage);
            control.EditValue = ViewModels.LocalizedString.From(editingName);

            var dialog = new EditDialog
            {
                Owner                 = _owner,
                Editor                = control,
                Title                 = editingName.GetValue(_application.CurrentLanguage),
                SizeToContent         = SizeToContent.WidthAndHeight,
                MinWidth              = 200,
                MinHeight             = 100,
                WindowStartupLocation = WindowStartupLocation.CenterOwner,
            };

            dialog.Localize(_application.CurrentLanguage);

            if (dialog.ShowDialog() == true)
            {
                var command = _commandsFactory.CreateRenameCommand(control.EditValue, _semanticNetworkNode, _application);
                _changeController.Perform(command);
                semanticNetworkNode.RefreshView();
            }
        }
        private async void ShowEditContentDialog()
        {
            foreach (CustomCommand command in ListCommands.SelectedItems)// TODO error & empty field handling
            {
                var dialog = new EditDialog("Edit command", new string[] { command.Name, command.Example, command.ListenFor, command.Feedback, command.BatchCommand });
                ContentDialogResult result = await dialog.ShowAsync();

                if (result == ContentDialogResult.Primary)
                {
                    ViewModel.Commands.Remove(command);
                    ViewModel.Commands.Add(new CustomCommand()
                    {
                        Name         = dialog.result[0],
                        Example      = dialog.result[1],
                        ListenFor    = dialog.result[2],
                        Feedback     = dialog.result[3],
                        BatchCommand = dialog.result[4]
                    });
                }
                else
                {
                }
            }
        }
Exemple #14
0
        private void BtnEdit_OnClick(object sender, RoutedEventArgs e)
        {
            var view = new EditDialog(_product, _numberOfGrams, _date);

            DialogHost.Show(view, "RootDialog", ClosingEventHandler);
        }
Exemple #15
0
 private async void AppBarButton_Click_2(object sender, RoutedEventArgs e)
 {
     await EditDialog.ShowAsync();
 }
 public EditUserDialogDirector(User user)
 {
     Dialog = new EditDialog(this);
     (_vm as EditDialogViewModel).User = user;
 }
Exemple #17
0
        /// <summary>
        /// 添加根节点
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addRoot_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tmpDialog = new EditDialog(); //动态添加编辑控件(控件放在窗体中)
            TreeNode tmpNode = new TreeNode();
            UInt16   count;               //Id=1的节点个数
            DataRow  dr;                  //行数据

            DataRow[] rows;               //多个行数据

            switch (flag)
            {
            case 0: break;

            case 1:
                dr    = m_DesignDataTable.NewRow();
                rows  = m_DesignDataTable.Select("Id='1'");
                count = (UInt16)rows.Count <DataRow>();
                //判断ID=1是否存在,定义开始的节点ID为1,ID和PID同时为0,树节点递归显示不出,无限循环
                if (count == 0)
                {
                    if (tmpDialog.Show() == DialogResult.OK)
                    {
                        //添加根节点到树节点集合中
                        tmpNode.Text        = tmpDialog.NodeName;
                        dr["PId"]           = 0;
                        dr["Id"]            = 1;
                        dr["Name"]          = tmpDialog.NodeName;
                        dr["DesignContent"] = "";
                        m_DesignDataTable.Rows.Add(dr);
                        tmpNode.Tag = dr["Id"];    //object类型
                        tmpTree.Nodes.Add(tmpNode);
                    }
                }
                else
                {
                    if (tmpDialog.Show() == DialogResult.OK)
                    {
                        //添加根节点到树节点集合中
                        tmpNode.Text        = tmpDialog.NodeName;
                        dr["PId"]           = 0;
                        dr["Name"]          = tmpDialog.NodeName;
                        dr["DesignContent"] = "";
                        m_DesignDataTable.Rows.Add(dr);
                        tmpNode.Tag = dr["Id"];    //object类型
                        tmpTree.Nodes.Add(tmpNode);
                    }
                }
                break;

            case 2:
                dr    = m_TestDataTable.NewRow();
                rows  = m_TestDataTable.Select("Id='1'");
                count = (UInt16)rows.Count <DataRow>();

                if (count == 0)
                {
                    if (tmpDialog.Show() == DialogResult.OK)
                    {
                        //添加根节点到树节点集合中
                        tmpNode.Text               = tmpDialog.NodeName;
                        dr["PId"]                  = 0;
                        dr["Id"]                   = 1;
                        dr["TestType"]             = "";
                        dr["IdList"]               = "";
                        dr["Name"]                 = tmpDialog.NodeName;
                        dr["TestIdentify"]         = "";
                        dr["TestPriority"]         = 0;
                        dr["TraceRelationships"]   = "";
                        dr["TestContent"]          = "";
                        dr["TestReqResolve"]       = "";
                        dr["AdequacyRequirements"] = "";
                        dr["TerminalCondition"]    = "";
                        m_TestDataTable.Rows.Add(dr);
                        tmpNode.Tag = dr["Id"];    //object类型
                        tmpTree.Nodes.Add(tmpNode);
                    }
                }
                else
                {
                    // DataRow dr1 = m_TestDataTable.NewRow();
                    if (tmpDialog.Show() == DialogResult.OK)
                    {
                        //添加根节点到树节点集合中
                        tmpNode.Text               = tmpDialog.NodeName;
                        dr["PId"]                  = 0;
                        dr["TestType"]             = "";
                        dr["IdList"]               = "";
                        dr["Name"]                 = tmpDialog.NodeName;
                        dr["TestIdentify"]         = "";
                        dr["TestPriority"]         = 0;
                        dr["TraceRelationships"]   = "";
                        dr["TestContent"]          = "";
                        dr["TestReqResolve"]       = "";
                        dr["AdequacyRequirements"] = "";
                        dr["TerminalCondition"]    = "";
                        m_TestDataTable.Rows.Add(dr);
                        tmpNode.Tag = dr["Id"];    //object类型
                        tmpTree.Nodes.Add(tmpNode);
                    }
                }
                break;

            case 3:
                break;

            case 4:
                break;

            default:
                break;
            }
        }
Exemple #18
0
        /// <summary>
        /// 添加子节点,并自动对PID,ID编号
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addNode_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            // 动态添加控件(控件放在窗体中)
            // ftmp = new EditForm();
            tmpDialog = new EditDialog();
            TreeNode tmpNode = new TreeNode();
            DataRow  dr; //行数据


            switch (flag)
            {
            case 0: break;

            case 1:
                dr = m_DesignDataTable.NewRow();
                if (tmpDialog.Show() == DialogResult.OK)
                {
                    //添加子节点到树节点集合中,根据树不同,添加的表格不同
                    try
                    {
                        tmpNode.Text        = tmpDialog.NodeName;
                        dr["PId"]           = Convert.ToUInt32(tmpTree.SelectedNode.Tag);
                        dr["Name"]          = tmpDialog.NodeName;
                        dr["DesignContent"] = "";
                        m_DesignDataTable.Rows.Add(dr);
                        tmpNode.Tag = dr["Id"];    //object类型
                        tmpTree.SelectedNode.Nodes.Add(tmpNode);
                    }
                    catch
                    {
                        MessageBox.Show("请选择根节点");
                    }
                    //展开所有的树节点
                    tmpTree.ExpandAll();
                }
                break;

            case 2:
                dr = m_TestDataTable.NewRow();
                // ftmp.Flag = true;
                if (tmpDialog.Show() == DialogResult.OK)
                {
                    //添加子节点到树节点集合中,根据树不同,添加的表格不同
                    try
                    {
                        tmpNode.Text = tmpDialog.NodeName;

                        dr["PId"]                  = Convert.ToUInt32(tmpTree.SelectedNode.Tag);
                        dr["TestType"]             = tmpTree.SelectedNode.Text;
                        dr["IdList"]               = "";
                        dr["Name"]                 = tmpDialog.NodeName;
                        dr["TestIdentify"]         = "";
                        dr["TestPriority"]         = 0;
                        dr["TraceRelationships"]   = "";
                        dr["TestContent"]          = "";
                        dr["TestReqResolve"]       = "";
                        dr["AdequacyRequirements"] = "";
                        dr["TerminalCondition"]    = "";
                        m_TestDataTable.Rows.Add(dr);
                        tmpNode.Tag = dr["Id"];    //object类型
                        tmpTree.SelectedNode.Nodes.Add(tmpNode);
                    }
                    catch
                    {
                        MessageBox.Show("请选择根节点");
                    }
                    //展开所有的树节点
                    tmpTree.ExpandAll();
                }
                break;

            case 3:
                break;

            case 4:
                break;

            default:
                break;
            }
        }
        protected override async void RelayMethod(object obj)
        {
            string command = obj.ToString();

            //  Do:应用
            if (command == "Button.Click.Edit")
            {
                this.ImageCollection.Clear();

                EditDialog detial = new EditDialog()
                {
                    DataContext = this
                };

                MessageService.ShowWithLayer(detial);

                var model = await await MessageService.ShowWaittingResultMessge(() =>
                {
                    string id = this.SelectedItem?.ID;

                    return(this.Respository.GetMovieWIthDetial(id));
                });

                this.ImageCollection = model.Item2?.ToObservable();
            }
            //  Do:取消
            else if (command == "Button.Click.Load")
            {
                if (this.SelectCase == null)
                {
                    MessageService.ShowSnackMessageWithNotice("请先选择案例!");
                    return;
                }

                var from = await MessageService.ShowWaittingResultMessge(() =>
                {
                    return(this.Respository.GetListAsync(l => l.CaseType == this.SelectCase.ID).Result);
                });

                if (from == null)
                {
                    MessageService.ShowSnackMessageWithNotice("没有视频数据,请先生成视频数据");
                    return;
                }

#pragma warning disable CS4014 // 由于此调用不会等待,因此在调用完成前将继续执行当前方法
                Task.Run(() =>
                {
                    this.ObservableSource.Clear();

                    foreach (var item in from)
                    {
                        MovieModelViewModel viewModel = new MovieModelViewModel(item);

                        this.ObservableSource.Add(viewModel);

                        Thread.Sleep(2);
                    }

                    MessageService.ShowSnackMessageWithNotice("加载完成...");
                });
#pragma warning restore CS4014 // 由于此调用不会等待,因此在调用完成前将继续执行当前方法
            }

            else if (command == "ListBox.SelectionChanged.Filter")
            {
                var tags = this.SelectTag.ToList();

                Func <MovieModelViewModel, bool> expression = l =>
                {
                    if (tags == null || tags.Count == 0)
                    {
                        return(true);
                    }

                    if (string.IsNullOrEmpty(l.TagTypes))
                    {
                        return(false);
                    }

                    return(tags.TrueForAll(k => l.TagTypes.Trim().Split(',').ToList().Exists(m => m == k.Name)));
                };

                this.ObservableSource.Fileter = l => expression(l);
            }

            else if (command == "ListBox.SelectionChanged.OrderBy")
            {
                if (this.OrderBy == "按名称排序")
                {
                    this.ObservableSource.Sort(l => l.Name, this.Desc);
                }
                else if (this.OrderBy == "按大小")
                {
                    this.ObservableSource.Sort(l => l.Size, this.Desc);
                }
                else if (this.OrderBy == "按评分")
                {
                    this.ObservableSource.Sort(l => l.Score, this.Desc);
                }
                else if (this.OrderBy == "按总时间")
                {
                    this.ObservableSource.Sort(l => l.Duration, this.Desc);
                }
                else if (this.OrderBy == "按播放次数")
                {
                    this.ObservableSource.Sort(l => l.PlayCount, this.Desc);
                }
                else if (this.OrderBy == "按清晰度")
                {
                    this.ObservableSource.Sort(l => l.ArticulationType, this.Desc);
                }
                else if (this.OrderBy == "按缩略图")
                {
                    this.ObservableSource.Sort(l => l.Image, this.Desc);
                }
            }

            else if (command == "Button.Click.Set")
            {
                SetControl detial = new SetControl()
                {
                    DataContext = this
                };

                MessageService.ShowWithLayer(detial);
            }

            else if (command == "ListBox.SelectionChanged.TagEdit")
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    if (this.SelectedItem == null)
                    {
                        return;
                    }

                    if (this.EditSelectTag == null || this.EditSelectTag.Count == 0)
                    {
                        return;
                    }

                    this.SelectedItem.TagTypes = this.EditSelectTag?.Select(l => l.Name).Aggregate((l, k) => l + "," + k);
                });
            }

            else if (command == "Button.Click.SetUpdate")
            {
                string message;

                if (!this.ModelState(this.SelectedItem.Model, out message))
                {
                    MessageService.ShowSnackMessage(message);
                    return;
                }

                await this.Respository.UpdateAsync(this.SelectedItem.Model);

                MessageService.CloseWithLayer();

                MessageService.ShowSnackMessage("保存成功!");
            }

            else if (command == "Button.Click.DeleteDeep")
            {
                if (this.SelectedItem == null)
                {
                    return;
                }

                var result = await MessageService.ShowResultMessge("确定要彻底删除文件?");

                if (result)
                {
                    if (File.Exists(this.SelectedItem.Url))
                    {
                        File.Delete(this.SelectedItem.Url);

                        MessageService.ShowSnackMessage("文件已删除:" + this.SelectedItem?.Url);

                        this.RelayMethod("Button.Click.Remove");
                    }
                }
            }

            else if (command == "Button.Click.Remove")
            {
                if (this.SelectedItem == null)
                {
                    return;
                }

                await this.Respository.DeleteAsync(this.SelectedItem.Model.ID);

                this.Invoke(() => this.ObservableSource.Remove(this.SelectedItem));
            }

            else if (command == "BulletCheckBox.CheckedChanged.Click")
            {
                {
                    if (!this.IsEditting)
                    {
                        this.Service3.ClipBoardChanged = null;
                        return;
                    }

                    this.Service3.ClipBoardChanged = async() =>
                    {
                        //Todo  :复制的图片
                        BitmapSource bit = Clipboard.GetImage();

                        if (bit != null)
                        {
                            mbc_dv_movieimage image = new mbc_dv_movieimage();

                            image.MovieID = this.SelectedItem.ID;

                            image.Text = DateTime.Now.ToDateTimeString();

                            image.TimeSpan = DateTime.Now.ToDateTimeString();

                            image.Image = ImageService.BitmapSourceToString(bit);

                            await this.Respository.AddMovieImage(image);

                            this.ImageCollection.Add(image);
                        }
                    };
                }
            }

            else if (command == "Button.Click.DeleteImage")
            {
                await this.Service4.DeleteAsync(this.SelectImage);

                this.ImageCollection.Remove(this.SelectImage);

                MessageService.ShowSnackMessageWithNotice("删除成功!");
            }

            else if (command == "Button.Click.SetImage")
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    this.SelectedItem.Image = this.SelectImage?.Image;
                });

                await this.Respository.SaveAsync();
            }

            else if (command == "ListBox.SelectionChanged.SelectedtemChanged")
            {
                if (this.SelectedItem == null)
                {
                    return;
                }

                var from = this.SelectedItem.TagTypes?.Split(',').ToList();


                if (from == null)
                {
                    this.EditSelectTag = new ObservableCollection <mbc_db_tagtype>();
                    return;
                }

                var result = this.TagCollection.Where(l => from.Exists(k => k == l.Name));

                this.EditSelectTag.Clear();

                ObservableCollection <mbc_db_tagtype> collection = new ObservableCollection <mbc_db_tagtype>();

                foreach (var item in result)
                {
                    collection.Add(item);
                }

                this.EditSelectTag = collection;
            }

            else if (command == "Button.Click.Play")
            {
                if (this.SelectedItem == null)
                {
                    return;
                }

                PlayerDialog player = new PlayerDialog();

                player.Source = new Uri(this.SelectedItem.Url, UriKind.Absolute);


                List <TimeFlagViewModel> times = new List <TimeFlagViewModel>();

                var model = await await MessageService.ShowWaittingResultMessge(() =>
                {
                    string id = this.SelectedItem?.ID;

                    return(this.Respository.GetMovieWIthDetial(id));
                });

                if (model.Item2 != null)
                {
                    foreach (var item in model.Item2)
                    {
                        bool b = TimeSpan.TryParse(item.TimeSpan, out TimeSpan span);

                        if (!b)
                        {
                            continue;
                        }

                        times.Add(new TimeFlagViewModel()
                        {
                            DisPlay = item.Text, TimeSpan = span
                        });
                    }

                    player.Times = times.ToObservable();
                }


                player.FlagClick += async(l, k) =>
                {
                    TimeSpan time = player.GetTime();

                    var flag = new TimeFlagViewModel()
                    {
                        TimeSpan = time
                    };

                    mbc_dv_movieimage image = new mbc_dv_movieimage();

                    string imageFile = await player.BeginShootCut();

                    if (!File.Exists(imageFile))
                    {
                        return;
                    }

                    image.Image = ImageService.BitmapSourceToString(new BitmapImage(new Uri(imageFile, UriKind.Absolute)));

                    bool r = await MessageService.ShowObjectWithPropertyForm(flag, null, "请输入标记信息", 1);

                    if (!r)
                    {
                        return;
                    }

                    image.MovieID = this.SelectedItem.ID;

                    image.Text = flag.DisPlay;

                    image.TimeSpan = time.ToString();



                    await this.Respository.AddMovieImage(image);

                    times = new List <TimeFlagViewModel>();

                    model = await await MessageService.ShowWaittingResultMessge(() =>
                    {
                        string id = this.SelectedItem?.ID;

                        return(this.Respository.GetMovieWIthDetial(id));
                    });

                    if (model.Item2 != null)
                    {
                        foreach (var item in model.Item2)
                        {
                            times.Add(new TimeFlagViewModel()
                            {
                                DisPlay = item.Text, TimeSpan = TimeSpan.Parse(item.TimeSpan)
                            });
                        }

                        player.Times = times.ToObservable();
                    }
                };


                MessageService.ShowWithLayer(player);
            }
        }