コード例 #1
0
ファイル: IndexPageVM.cs プロジェクト: Yxx-yym/ProjectEvent
        /// <summary>
        /// 更新右键菜单(移动分组数据更新)
        /// </summary>
        private void UpdateContextMenu()
        {
            moveGroupMenutItem.Items.Clear();
            var project = projects.GetProject(SelectItem.ID);

            foreach (var g in groupService.GetGroups())
            {
                if (g.ID != project.GroupID)
                {
                    var gm = new MenuItem();
                    gm.Click += (e, c) =>
                    {
                        project.GroupID = g.ID;
                        projects.Update(project);
                        if (group != null)
                        {
                            Projects.Remove(SelectItem);
                        }
                        else
                        {
                            int index = Projects.IndexOf(SelectItem);
                            SelectItem.Tag  = g.Name;
                            Projects[index] = SelectItem;
                        }
                        mainVM.Toast("移动完成", Types.ToastType.Success);
                    };
                    gm.Icon = new Icon()
                    {
                        IconType = g.Icon
                    };
                    gm.Header = g.Name;
                    moveGroupMenutItem.Items.Add(gm);
                }
            }
        }
コード例 #2
0
        private void CreateItemContextMenu()
        {
            MenuItem delItem = new MenuItem();

            delItem.Header     = "删除";
            delItem.Foreground = Colors.GetColor(ColorTypes.Red);
            delItem.Icon       = new Icon()
            {
                IconType   = IconTypes.Delete,
                Foreground = Colors.GetColor(ColorTypes.Red)
            };
            delItem.Click += (e, c) =>
            {
                DeleteProject(SelectItem);
            };
            moveGroupMenutItem        = new MenuItem();
            moveGroupMenutItem.Header = "移动到";
            moveGroupMenutItem.Icon   = new Icon()
            {
                IconType = IconTypes.OpenWithMirrored,
            };


            MenuItem exportItem = new MenuItem();

            exportItem.Header = "导出";
            exportItem.Icon   = new Icon()
            {
                IconType = IconTypes.Share,
            };
            exportItem.Click += (e, c) =>
            {
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.Filter = "Json (*.project.json)|*.project.json";
                if (saveFileDialog.ShowDialog() == true)
                {
                    string projectJson = JsonConvert.SerializeObject(projects.GetProject(SelectItem.ID));
                    IOHelper.WriteFile(saveFileDialog.FileName, projectJson);
                    mainVM.Toast("导出完成", Types.ToastType.Success);
                }
            };
            ItemContextMenu.Items.Add(moveGroupMenutItem);
            ItemContextMenu.Items.Add(exportItem);

            ItemContextMenu.Items.Add(new Separator());
            ItemContextMenu.Items.Add(delItem);
        }
コード例 #3
0
        private ProjectModel GenerateModel(ActionContainer container)
        {
            ProjectModel project = null;

            if (mainVM.Data != null)
            {
                project = projects.GetProject((int)mainVM.Data);
            }
            if (project == null)
            {
                project = new ProjectModel();
            }
            project.ProjectName        = ProjectName;
            project.EventID            = SelectedEventID;
            project.ConditionData      = ConditionData;
            project.ProjectDescription = ProjectDescription;
            project.Actions            = container.GenerateActions();
            project.Icon = ProjectIcon;
            if (mainVM.SelectedGroup != null)
            {
                project.GroupID = mainVM.SelectedGroup.ID;
            }
            return(project);
        }
コード例 #4
0
        private void ReadLogText()
        {
            var logs = eventLog.GetEventLogs().OrderByDescending(m => m.ID);

            foreach (var log in logs)
            {
                var    project = projects.GetProject(log.ProjectID);
                string name    = "[已被删除]";
                if (project != null)
                {
                    name = project.ProjectName;
                }
                Log += $"{log.ID}\r\n方案:{name},时间:{log.Time.ToString()}\r\n-----\r\n";
            }
        }
コード例 #5
0
        public async Task <ProjectDetailsResponseModel> GetProjectDetailsById(string projectId)
        {
            var res = await _projects.GetProject(_authToken, projectId);

            return(res);
        }