コード例 #1
0
ファイル: Task.cs プロジェクト: aloisdg/todotxtlib.net
        public Task(string priority, List <string> projects, List <string> contexts,
                    string body, DateTime?createdDate, string dueDate, bool completed, DateTime?completedDate)
        {
            Priority = priority.Replace("(", String.Empty).Replace(")", String.Empty).ToUpperInvariant();

            _projects = projects ?? new List <string>();
            _contexts = contexts ?? new List <string>();

            CreatedDate = createdDate;
            DueDate     = dueDate;

            Body = body + (Contexts.Any() ? " " : String.Empty)
                   + String.Join(" ", _contexts.ToArray())
                   + (Projects.Any() ? " " : String.Empty)
                   + String.Join(" ", Projects.ToArray())
                   + (String.IsNullOrEmpty(dueDate) ? String.Empty : " due:" + dueDate);

            Completed     = completed;
            CompletedDate = completedDate;

            Raw = (_completed ? "x " : String.Empty)
                  + (!String.IsNullOrEmpty(Priority) ? "(" + Priority + ") " : String.Empty)
                  + (CreatedDate.HasValue ? (CreatedDate.Value.ToString("yyyy-MM-dd") + " ") : String.Empty)
                  + Body;
        }
コード例 #2
0
        public async void OnLoad()
        {
            var service = new StreetPayService();

            IsLoading = true;
            var response = await service.GetProjects();

            IsLoading = false;

            if (response == null)
            {
                return;
            }

            if (response.StatusCode != System.Net.HttpStatusCode.OK || response.Data == null)
            {
                ShowMessage("Error cargando proyectos: {0}, {1}", response.StatusCode, response.Content);
                return;
            }

            if (Projects != null)
            {
                foreach (var proj in response.Data)
                {
                    if (!Projects.Any(x => x.Id == proj.Id))
                    {
                        Projects.Add(proj);
                    }
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Active Dependent type names of this object
        /// </summary>
        public List <string> DependentObjectNames()
        {
            var dependentObjects = new List <string>();

            if (FocusAreaLocationStagings.Any())
            {
                dependentObjects.Add(typeof(FocusAreaLocationStaging).Name);
            }

            if (GrantAllocationAwards.Any())
            {
                dependentObjects.Add(typeof(GrantAllocationAward).Name);
            }

            if (Projects.Any())
            {
                dependentObjects.Add(typeof(Project).Name);
            }

            if (ProjectUpdates.Any())
            {
                dependentObjects.Add(typeof(ProjectUpdate).Name);
            }
            return(dependentObjects.Distinct().ToList());
        }
コード例 #4
0
        private void ButtonLoad_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = null;

            if (!Projects.Any())
            {
                ShowError("At least one project must be in the project list.");
                return;
            }

            if (CsvFilePath.IsEmpty() || !CsvFilePath.EndsWith(".csv", true, CultureInfo.InvariantCulture))
            {
                ShowError("You must set CSV file location.");
                return;
            }

//			if (CsFilePath.IsEmpty() || !CsFilePath.EndsWith(".cs", true, CultureInfo.InvariantCulture))
//			{
//				ShowError("You must set CS file location.");
//				return;
//			}

            DialogResult = true;
            //Close();
        }
コード例 #5
0
ファイル: Create.cshtml.cs プロジェクト: nervosnetwork/tippy
        // To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
        public async Task <IActionResult> OnPostAsync()
        {
            if (Project.LockArg.StartsWith("ckb") || Project.LockArg.StartsWith("ckt"))
            {
                Project.LockArg = Address.ParseAddress(Project.LockArg, Project.LockArg.Substring(0, 3)).Args;
            }


            Project.Tokens = new List <Token>();
            Project.RecordedTransactions = new List <RecordedTransaction>();
            Project.IsActive             = !Projects.Any(p => p.IsActive);
            DbContext.Projects.Add(Project);
            await DbContext.SaveChangesAsync();

            foreach (var item in ConstractFiles)
            {
                if (item.selectforintockb)
                {
                    DbContext.Contracts.Add(new Contracts
                    {
                        ProjectId  = Project.Id,
                        createtime = DateTime.Now,
                        filename   = item.filename,
                        filepath   = item.filepath
                    });
                }
            }
            await DbContext.SaveChangesAsync();



            return(RedirectToPage("./Index"));
        }
コード例 #6
0
        /// <summary>
        /// Active Dependent type names of this object
        /// </summary>
        public List <string> DependentObjectNames()
        {
            var dependentObjects = new List <string>();

            if (MatchmakerOrganizationTaxonomyLeafs.Any())
            {
                dependentObjects.Add(typeof(MatchmakerOrganizationTaxonomyLeaf).Name);
            }

            if (Projects.Any())
            {
                dependentObjects.Add(typeof(Project).Name);
            }

            if (SecondaryProjectTaxonomyLeafs.Any())
            {
                dependentObjects.Add(typeof(SecondaryProjectTaxonomyLeaf).Name);
            }

            if (TaxonomyLeafPerformanceMeasures.Any())
            {
                dependentObjects.Add(typeof(TaxonomyLeafPerformanceMeasure).Name);
            }
            return(dependentObjects.Distinct().ToList());
        }
コード例 #7
0
        private void UpdateCanInstallAndCanUninstall()
        {
            CanUninstall = Projects.Any(project => project.IsSelected && project.InstalledVersion != null && !project.AutoReferenced);

            CanInstall = SelectedVersion != null && Projects.Any(
                project => project.IsSelected &&
                VersionComparer.Default.Compare(SelectedVersion.Version, project.InstalledVersion) != 0);
        }
コード例 #8
0
ファイル: Solution.cs プロジェクト: Falconne/SolutionTools
        public void AddProject(Project project)
        {
            if (Projects.Any(p => p.Equals(project)))
            {
                return;
            }

            Projects.Add(project);
        }
コード例 #9
0
ファイル: CheckConfiguration.cs プロジェクト: aperwe/Cerberus
 /// <summary>
 /// Updates the <see cref="Projects"/> table with any items from the specified <paramref name="projects"/> collection
 /// that are missing in the <see cref="Projects"/> table.
 /// </summary>
 /// <param name="projects">List of projects to add (if missing) to the <see cref="Projects"/> table.</param>
 public void AddMissingProjects(IEnumerable <string> projects)
 {
     foreach (var project in projects)
     {
         if (!Projects.Any(row => row.Name.Equals(project)))
         {
             Projects.AddProjectsRow(project);
         }
     }
 }
コード例 #10
0
ファイル: TrackPlugin.cs プロジェクト: markchipman/Handyman
 private void AddP(string p)
 {
     if (!Projects.Any(x => x.Name == p))
     {
         Projects.Add(new Project {
             Name = p
         });
     }
     Save();
 }
コード例 #11
0
        /// <summary>
        /// Active Dependent type names of this object
        /// </summary>
        public List <string> DependentObjectNames()
        {
            var dependentObjects = new List <string>();

            if (Projects.Any())
            {
                dependentObjects.Add(typeof(Project).Name);
            }
            return(dependentObjects.Distinct().ToList());
        }
コード例 #12
0
        private void OnWindowClosing(CancelEventArgs e)
        {
            if (Projects.Any <ProjectViewModel>(p => !p.State.CanClose()))
            {
                var result = MessageBox.Show(String.Format("If you have unsaved work in your project(s) and may lose work. Are you sure you want to exit?"), String.Format("Exit"), MessageBoxButton.YesNo, MessageBoxImage.Warning);

                if (result == MessageBoxResult.No)
                {
                    e.Cancel = true;
                    return;
                }
            }
        }
コード例 #13
0
ファイル: CCMaterial.cs プロジェクト: ctcrowe/RevitAutomation
        public void Save()
        {
            var dir = "Materials".GetMyDocs();

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            string folder = dir + "\\" + this.Category;

            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }

            XDocument doc = new XDocument(new XElement(this.Category.ToString()))
            {
                Declaration = new XDeclaration("1.0", "utf-8", "yes")
            };


            doc.Root.Add(new XAttribute("Model", this.Model));
            doc.Root.Add(new XAttribute("Manufacturer", this.Manufacturer));
            doc.Root.Add(new XAttribute("Color", this.Color));
            doc.Root.Add(new XAttribute("Description", this.Description));

            if (Patterns.Any())
            {
                foreach (var pat in this.Patterns)
                {
                    XElement ele = new XElement("Pattern");
                    ele.Add(new XAttribute("Description", pat));
                    doc.Root.Add(ele);
                }
            }
            if (Projects.Any())
            {
                foreach (var prj in this.Projects)
                {
                    XElement ele = new XElement("Project");
                    ele.Add(new XAttribute("Description", prj));
                    doc.Root.Add(ele);
                }
            }

            string fn = folder + "\\" + this.Model + ".xml";

            doc.Save(fn);
        }
コード例 #14
0
        /// <summary>
        /// Active Dependent type names of this object
        /// </summary>
        public List <string> DependentObjectNames()
        {
            var dependentObjects = new List <string>();

            if (GisUploadSourceOrganizations.Any())
            {
                dependentObjects.Add(typeof(GisUploadSourceOrganization).Name);
            }

            if (Projects.Any())
            {
                dependentObjects.Add(typeof(Project).Name);
            }
            return(dependentObjects.Distinct().ToList());
        }
コード例 #15
0
        private void FillProperties(InsOptions opt)
        {
            SelectedRegionName = InsOptions.Region.RegionName;
            SelectedRegion     = opt.Region;

            // Выбор текущего проекта, если он есть
            if (opt.Project != null && Projects != null && Projects.Any())
            {
                var findProject = Projects.Find(p => p.Id == opt.Project.Id);
                if (findProject != null)
                {
                    SelectedProject = findProject;
                }
            }
        }
コード例 #16
0
        private void GetDocument_Load(object sender, EventArgs e)
        {
            var client = ServicePool.Instance.GetService <ServerService>();

            client.GetAllProjects(args => {
                Projects = args;
                if (Projects.Any())
                {
                    lbProjects.DataSource    = Projects;
                    lbProjects.DisplayMember = "Name";
                    lbProjects.ValueMember   = "Id";
                    lbProjects.Enabled       = true;
                }
            });
        }
コード例 #17
0
        private bool IsProjectsValid()
        {
            ProjectsErrors = null;

            if (Projects.Any(p => p.PositionId == 0) || Projects.Any(x => x.ProjectId == 0))
            {
                ProjectsErrors += "Fill all the fields of your proejects.\r\n";
            }
            if (Projects.GroupBy(x => x.ProjectId).Any(group => group.Count() > 1))
            {
                ProjectsErrors += "Remove identical projects.\r\n";
            }

            ProjectsErrors = ProjectsErrors?.Trim();

            return(ProjectsErrors == null);
        }
コード例 #18
0
        public CsrCloneWindowViewModel(CsrCloneWindow owner, IList <Project> projects)
        {
            _owner   = owner.ThrowIfNull(nameof(owner));
            Projects = projects.ThrowIfNull(nameof(projects));
            if (!Projects.Any())
            {
                throw new ArgumentException($"{nameof(projects)} must not be empty");
            }
            PickFolderCommand = new ProtectedCommand(PickFoloder);
            CloneRepoCommand  = new ProtectedAsyncCommand(() => ExecuteAsync(CloneAsync), canExecuteCommand: false);
            CreateRepoCommand = new ProtectedCommand(OpenCreateRepoDialog, canExecuteCommand: false);
            RepositoriesAsync.PropertyChanged += RepositoriesAsyncPropertyChanged;

            var projectId = CredentialsStore.Default.CurrentProjectId;

            // If projectId is null, choose first project. Otherwise, choose the project.
            SelectedProject = Projects.FirstOrDefault(x => projectId == null || x.ProjectId == projectId);
        }
コード例 #19
0
        private Task HandleProjectCreated(ProjectCreatedDto msg)
        {
            Messages.Add($"{msg.Name} project created at {msg.OccurredOn}.");

            if (Projects.Any(p => p.Id == msg.Id))
            {
                return(Task.CompletedTask);
            }

            Projects.Add(new ProjectModel
            {
                Id   = msg.Id,
                Name = msg.Name
            });

            StateHasChanged();

            return(Task.CompletedTask);
        }
コード例 #20
0
        /// <summary>
        /// Active Dependent type names of this object
        /// </summary>
        public List <string> DependentObjectNames()
        {
            var dependentObjects = new List <string>();

            if (Projects.Any())
            {
                dependentObjects.Add(typeof(Project).Name);
            }

            if (ProjectTypePerformanceMeasures.Any())
            {
                dependentObjects.Add(typeof(ProjectTypePerformanceMeasure).Name);
            }

            if (ProjectTypeProjectCustomAttributeTypes.Any())
            {
                dependentObjects.Add(typeof(ProjectTypeProjectCustomAttributeType).Name);
            }
            return(dependentObjects.Distinct().ToList());
        }
コード例 #21
0
ファイル: MainViewModel.cs プロジェクト: ygoe/MiniWebCompiler
 private void UpdateStatus()
 {
     if (Projects.Any(p => p.Status == null))
     {
         Status = null;
     }
     else if (Projects.Any(p => p.Status == false))
     {
         Status          = false;
         SelectedProject = Projects.FirstOrDefault(p => p.Status == false);
     }
     else
     {
         Status = true;
         bool justCompiled = Projects.Any(p => p.Files.Any(f => DateTime.UtcNow - f.LastCompileTime < TimeSpan.FromSeconds(5)));
         if (justCompiled)
         {
             PlaySuccessSound();
         }
     }
 }
コード例 #22
0
        internal bool TryGetProjectFilter(out ProjectFilter projectFilter)
        {
            projectFilter = default;

            string language = null;

            if (Language != null &&
                !ParseHelpers.TryParseLanguage(Language, out language))
            {
                return(false);
            }

            if (Projects?.Any() == true &&
                IgnoredProjects?.Any() == true)
            {
                Logger.WriteLine($"Cannot specify both '{ParameterNames.Projects}' and '{ParameterNames.IgnoredProjects}'.", Roslynator.Verbosity.Quiet);
                return(false);
            }

            projectFilter = new ProjectFilter(Projects, IgnoredProjects, language);
            return(true);
        }
コード例 #23
0
        public async Task <MonitorStatus> DoUpdate(IEnumerable <MonitoredProjectSettings> monitoredProjects)
        {
            var projectSyncOutcome = await SyncMonitoredProjects(monitoredProjects);

            if (projectSyncOutcome != MonitorStatus.UpdateSuccessful)
            {
                return(projectSyncOutcome);
            }

            if (!Projects.Any())
            {
                return(MonitorStatus.NoProjects);
            }

            Task[] taskArray = new Task[Projects.Count()];
            for (int i = 0; i < Projects.Count(); i++)
            {
                taskArray[i] = Projects.ElementAt(i).RetrievePullRequests();
            }
            Task.WaitAll(taskArray);

            if (Projects.Any(proj => proj.PullRequestRetrievalStatus == RetrievalStatus.FailedDueToConnection))
            {
                return(MonitorStatus.CouldNotReachServer);
            }

            if (Projects.Any(proj => proj.PullRequestRetrievalStatus == RetrievalStatus.FailedDueToAuth))
            {
                return(MonitorStatus.AuthorisationError);
            }

            if (Projects.Any(proj => proj.PullRequestRetrievalStatus == RetrievalStatus.FailedReasonUnknown) ||
                Projects.Any(proj => proj.PullRequestRetrievalStatus == RetrievalStatus.Unstarted))
            {
                return(MonitorStatus.UnrecognisedError);
            }

            return(MonitorStatus.UpdateSuccessful);
        }
コード例 #24
0
        private void ImportProjectsHandler()
        {
            var dialog = new OpenFileDialog();

            dialog.DereferenceLinks = true;
            dialog.Multiselect      = false;
            dialog.AddExtension     = true;
            dialog.CheckFileExists  = false;
            dialog.CheckPathExists  = true;
            dialog.Filter           = "Projekt-Export|*.projects";
            dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
            dialog.Title            = "Projekte importieren";
            dialog.FileName         = "work";
            if (NavigatorFactory.MyNavigator.NavigateToSystemDialog(dialog) == true)
            {
                var loadedProjects = new ProjectsImporter(dialog.FileName).Import();
                foreach (var loadedProject in loadedProjects)
                {
                    var projectName = loadedProject.Name;
                    for (int i = 0; Projects.Any(p => p.Name.Equals(projectName)); i++)
                    {
                        projectName = string.Format("{0}_{1}", loadedProject.Name, i);
                    }
                    loadedProject.Name = projectName;
                    Projects.Add(loadedProject);
                }
                // Choose newly imported project when there was none selected before
                if (SelectedProject == null && Projects.Count > 0)
                {
                    SelectedProject  = Projects.First();
                    Activities       = SelectedProject.Activities;
                    SelectedActivity = null;
                    NotifyPropertyChanged("");
                }
                MyRepository.Persist();
            }
        }
コード例 #25
0
 /// <summary>
 /// Does this object have any dependent objects? (If it does have dependent objects, these would need to be deleted before this object could be deleted.)
 /// </summary>
 /// <returns></returns>
 public bool HasDependentObjects()
 {
     return(FocusAreaLocationStagings.Any() || GrantAllocationAwards.Any() || Projects.Any() || ProjectUpdates.Any());
 }
 private void UpdateActionEnabled()
 {
     ActionEnabled =
         Projects != null &&
         Projects.Any(i => i.Selected);
 }
コード例 #27
0
        public async Task UpdateHasPendingMigrations()
        {
            await Task.WhenAll(Categories.Select(c => c.UpdateHasPendingMigrations()));

            HasPendingMigrations.Value = Categories.Any(c => c.HasPendingMigrations.Value) || Projects.Any(p => p.HasPendingMigrations.Value);
        }
コード例 #28
0
 /// <summary>
 /// Does this object have any dependent objects? (If it does have dependent objects, these would need to be deleted before this object could be deleted.)
 /// </summary>
 /// <returns></returns>
 public bool HasDependentObjects()
 {
     return(MatchmakerOrganizationTaxonomyLeafs.Any() || Projects.Any() || SecondaryProjectTaxonomyLeafs.Any() || TaxonomyLeafPerformanceMeasures.Any());
 }
コード例 #29
0
 public override bool CanDelete()
 {
     return(!Chapters.Any() && !Components.Any() && !Projects.Any() && !Maintenances.Any());
 }
コード例 #30
0
 /// <summary>
 /// Does this object have any dependent objects? (If it does have dependent objects, these would need to be deleted before this object could be deleted.)
 /// </summary>
 /// <returns></returns>
 public bool HasDependentObjects()
 {
     return(Projects.Any() || ProjectTypePerformanceMeasures.Any() || ProjectTypeProjectCustomAttributeTypes.Any());
 }