示例#1
0
        public override void SetProject(Project project)
        {

        }
示例#2
0
 public override void SetProject(Project project)
 {
     Logger.Log("ctrlHelp > " + project.Name);
 }
        public async System.Threading.Tasks.Task SetProject(Project project)
        {
            if (WPSuite.ConnectedUser == null)
            {
                Logger.Log("SetProject (ctrlDashBoardSprings) - User is null!!");
                await UIHelper.PerformLogout();
                return;
            }

            try
            {
                tvSprings.BeginUpdate();

                tvSprings.AfterSelect -= tvSprings_AfterSelect;

                tvSprings.Nodes.Clear();

                Logger.Log("Get springs for " + project.Name);

                var mres = await WebCallFactory.GetSprings(project.Id, WPSuite.ConnectedUser.Id);

                if (mres.Error)
                    throw mres.Exception;

                foreach (Spring mspring in mres.Springs)
                {
                    var mn = new TreeNode(mspring.Name)
                    {
                        Tag = mspring
                    };
                    if(mspring.Categories != null)
                        mn.Nodes.AddRange(mspring.Categories
                                                 .Select(CreateTreeNodeItem)
                                                 .ToArray());

                    tvSprings.Nodes.Add(mn);
                }

                var msn = tvSprings.Nodes
                                   .Cast<TreeNode>()
                                   .FirstOrDefault(tn => (tn.Tag as Spring)?.Id == Settings.Default.LastSelectedSpringId);


                var mcn = FlattenTree(tvSprings.Nodes
                                               .Cast<TreeNode>())
                                               .FirstOrDefault(tn => (tn.Tag as Category)?.Id == Settings.Default.LastSelectedCategoryId);

                tvSprings.AfterSelect += tvSprings_AfterSelect;

                var mmn = mcn ?? msn ?? tvSprings.Nodes.Cast<TreeNode>().FirstOrDefault();

                if (mmn != null)
                {
                    mmn.EnsureVisible();

                    tvSprings.SelectedNode = mmn;
                }

                if (Settings.Default.LastSelectedCategoryId != 0)
                    WPSuite.SelectedCategory = mres.Springs
                                                   .SelectMany(s => s.Categories)
                                                   .FirstOrDefault(c => c.Id == Settings.Default.LastSelectedCategoryId);

                UIHelper.HideLoader();
            }
            catch (Exception mex)
            {
                UIHelper.HideLoader();
                UIHelper.ShowError(mex);
            }
            finally
            {
                tvSprings.EndUpdate();
            }
        }
示例#4
0
 private ListViewItem CreateProjectRow(Project project)
 {
     return new ListViewItem(project.Name)
     {
         Tag = project.Id
     };
 }
示例#5
0
 private void ShowChatsForProject(Project project)
 {
     Logger.Log("ctrlChats > " + project.Name);
 }
示例#6
0
 public override void SetProject(Project project)
 {
     ShowChatsForProject(project);
 }
示例#7
0
 public abstract void SetProject(Project project);
示例#8
0
        public static void ShowProjectEdit(Project project, Func<Project, Task> afterSave = null)
        {
            var mc = new ctrlProjectEdit(project);

            mc.AfterSave = async p =>
            {
                if (afterSave != null)
                    await afterSave(p);

                mc.ParentForm?.Close();
            };

            ShowControlInForm(mc, ShowInFormControlSize.ControlSize);
        }
示例#9
0
 public ctrlProjectEdit(Project project)
 {
     _project = project;
 }