// =============================================================================

        private async void BtnValider_Clicked(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(EntryName.Text) && !string.IsNullOrEmpty(EntryPrenom.Text))
                {
                    ShowLoader();

                    EleveAdded part = new EleveAdded();
                    part.Nom    = EntryName.Text;
                    part.Prenom = EntryPrenom.Text;

                    await DataManager.Instance.AddEleve(_currentClasse.Id, part);

                    UpdateUI();

                    EntryName.Text   = "";
                    EntryPrenom.Text = "";

                    EntryName.Focus();
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Oups", "Un problème à eu lieu lors de l'ajout d'un élève", "Ok");
            }
            finally
            {
                HideLoader();
            }
        }
Example #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((EntryDate.GetHashCode() * 397) ^ EntryName.GetHashCode());
     }
 }
Example #3
0
 /// <summary>Snippet for GetEntry</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetEntryResourceNames()
 {
     // Create client
     DataCatalogClient dataCatalogClient = DataCatalogClient.Create();
     // Initialize request argument(s)
     EntryName name = EntryName.FromProjectLocationEntryGroupEntry("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]", "[ENTRY]");
     // Make the request
     Entry response = dataCatalogClient.GetEntry(name);
 }
        protected override void RunJournalCommand()
        {
            if (Last)
            {
                var journal   = OpenJournal();
                var lastEntry = journal.CreateIndex <JournalEntryFile>().SelectMany(x => x.Entries).OrderByDescending(x => x.EntryDate).First();
                SystemProcess.Start(lastEntry.FilePath);
                return;
            }

            var       fileSystem    = new FileSystem();
            var       journalWriter = new JournalWriter(fileSystem, Location);
            string    path;
            LocalDate entryDate;

            switch (ParameterSetName)
            {
            case "Name":
            {
                entryDate = EntryName.EndsWith(".md") ? Journal.FileNameWithExtensionPattern.Parse(EntryName).Value : Journal.FileNamePattern.Parse(EntryName).Value;
                path      = journalWriter.GetJournalEntryFilePath(entryDate);
                break;
            }

            case "Date":
            {
                entryDate = LocalDate.FromDateTime(Date);
                path      = journalWriter.GetJournalEntryFilePath(entryDate);
                break;
            }

            case "DateOffset":
            {
                entryDate = Today.PlusDays(DateOffset);
                path      = journalWriter.GetJournalEntryFilePath(entryDate);
                break;
            }

            case "Entry":
            {
                entryDate = Journal.FileNamePattern.Parse(Entry.EntryName).Value;
                path      = journalWriter.GetJournalEntryFilePath(entryDate);
                break;
            }

            default:
                throw new NotSupportedException();
            }

            if (!fileSystem.File.Exists(path))
            {
                throw new PSInvalidOperationException($"An entry does not exist for '{entryDate}'.");
            }

            SystemProcess.Start(path);
        }
        /// <summary>Snippet for DeleteEntryAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task DeleteEntryResourceNamesAsync()
        {
            // Create client
            DataCatalogClient dataCatalogClient = await DataCatalogClient.CreateAsync();

            // Initialize request argument(s)
            EntryName name = EntryName.FromProjectLocationEntryGroupEntry("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]", "[ENTRY]");
            // Make the request
            await dataCatalogClient.DeleteEntryAsync(name);
        }
                public override int GetHashCode()
                {
                    const int MagicValue = -1521134295;
                    var       hashCode   = -1211575830;

                    hashCode = (hashCode * MagicValue) + EntryName.GetHashCode();
                    hashCode = (hashCode * MagicValue) + Justification?.GetHashCode() ?? 0;
                    hashCode = (hashCode * MagicValue) + Alternative?.GetHashCode() ?? 0;
                    hashCode = (hashCode * MagicValue) + Assemblies?.GetHashCode() ?? 0;

                    return(hashCode);
                }
 /// <summary>Snippet for GetEntry</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetEntryRequestObject()
 {
     // Create client
     DataCatalogClient dataCatalogClient = DataCatalogClient.Create();
     // Initialize request argument(s)
     GetEntryRequest request = new GetEntryRequest
     {
         EntryName = EntryName.FromProjectLocationEntryGroupEntry("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]", "[ENTRY]"),
     };
     // Make the request
     Entry response = dataCatalogClient.GetEntry(request);
 }
Example #8
0
        /// <summary>Snippet for DeleteTagAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task DeleteTagRequestObjectAsync()
        {
            // Create client
            DataCatalogClient dataCatalogClient = await DataCatalogClient.CreateAsync();

            // Initialize request argument(s)
            DeleteTagRequest request = new DeleteTagRequest
            {
                EntryName = EntryName.FromProjectLocationEntryGroupEntry("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]", "[ENTRY]"),
            };
            // Make the request
            await dataCatalogClient.DeleteTagAsync(request);
        }
Example #9
0
        //private int numArgsWithTagFromXml(string tag)
        //    {
        //    if (m_xml == null) return 0;

        //    if (!m_xml.GetNthChildWithTag2("args", 0)) return 0;

        //    int count = 0;
        //    int numChildren = m_xml.NumChildren;

        //    int i;
        //    for (i = 0; i < numChildren; i++)
        //        {
        //        if (m_xml.GetChild2(i))
        //            {
        //            if (m_xml.HasChildWithTag(tag)) count++;
        //            //string pContent = m_xml.GetChildContent(tag);
        //            m_xml.GetParent2();
        //            }
        //        }

        //    m_xml.GetParent2();
        //    return count;
        //    }


        public bool HasAsyncFunction(string genericClassName)
        {
            if (genericClassName.Equals("Task") || genericClassName.Equals("TaskChain"))
            {
                return(false);
            }
            if (EntryName.StartsWith("Async"))
            {
                return(false);
            }
            if (!HasEvents)
            {
                return(false);
            }
            if (!AxEnabled)
            {
                return(false);
            }
            if (!CppEnabled)
            {
                return(false);
            }
            if (!DnEnabled)
            {
                return(false);
            }
            if (NoC)
            {
                return(false);
            }
            if (NoObjectiveC)
            {
                return(false);
            }

            if (m_gt == ChilkatTypes.GT_DATE)
            {
                return(false);
            }

            if (HasArgWithGt(ChilkatTypes.GT_DATE))
            {
                return(false);
            }

            return(true);
        }
        /// <summary>Snippet for ListTagsAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task ListTagsRequestObjectAsync()
        {
            // Create client
            DataCatalogClient dataCatalogClient = await DataCatalogClient.CreateAsync();

            // Initialize request argument(s)
            ListTagsRequest request = new ListTagsRequest
            {
                ParentAsEntryName = EntryName.FromProjectLocationEntryGroupEntry("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]", "[ENTRY]"),
            };
            // Make the request
            PagedAsyncEnumerable <ListTagsResponse, Tag> response = dataCatalogClient.ListTagsAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Tag item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ListTagsResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Tag item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int        pageSize   = 10;
            Page <Tag> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Tag item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
        }
Example #11
0
        public virtual bool Equals(EntryName <TEntry> another)
        {
            if (another == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, another))
            {
                return(true);
            }

            if (Id == 0)
            {
                return(false);
            }

            return(this.Id == another.Id);
        }
Example #12
0
        /// <summary>Snippet for ListTags</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void ListTagsResourceNames()
        {
            // Create client
            DataCatalogClient dataCatalogClient = DataCatalogClient.Create();
            // Initialize request argument(s)
            EntryName parent = EntryName.FromProjectLocationEntryGroupEntry("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]", "[ENTRY]");
            // Make the request
            PagedEnumerable <ListTagsResponse, Tag> response = dataCatalogClient.ListTags(parent);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Tag item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (ListTagsResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Tag item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            }

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int        pageSize   = 10;
            Page <Tag> singlePage = response.ReadPage(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Tag item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
        }
        public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestMessage req, TraceWriter log)
        {
            log.Info("C# HTTP trigger function processed a request.");
            var str = "Server=tcp:rlait.database.windows.net,1433;Initial Catalog=RocketLeagueAI;Persist Security Info=False;User ID=cap_admin;Password=qwerty_1234567;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;";

            string increment = req.GetQueryNameValuePairs()
                               .FirstOrDefault(q => string.Compare(q.Key, "increment", true) == 0)
                               .Value;


            if (increment == null)
            {
                // Get request body
                dynamic data = await req.Content.ReadAsAsync <object>();

                increment = data?.increment;
            }
            int inc = Int32.Parse(increment);

            List <object> result = new List <object>();
            List <string> PIDs   = new List <string>();

            string sqlPID = "SELECT PID1, PID2 FROM matchList WHERE matchId = ((SELECT matchId FROM matchList WHERE currentMatch = 1) +" + inc + ");";

            using (SqlConnection connection = new SqlConnection(str))
            {
                connection.Open();
                using (SqlCommand command = new SqlCommand(sqlPID, connection))
                {
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                PIDs.Add(reader.GetString(0));
                                PIDs.Add(reader.GetString(1));
                            }
                        }
                    }
                }
            }


            int i = 1;

            foreach (string PID in PIDs)
            {
                string sqlMatches = "SELECT COUNT(DISTINCT matchID) FROM matchList WHERE PID1 = '" + PID + "' OR PID2 = '" + PID + "';";
                string sqlWins    = "SELECT COUNT(DISTINCT matchID) FROM results WHERE win = 1 AND PID = '" + PID + " ' GROUP BY PID;";
                string sqlName    = "SELECT username, avatar FROM profile WHERE PID = '" + PID + "';";

                EntryName pidRow = new EntryName();
                pidRow.label = "username";
                pidRow.name  = PID;
                result.Add(pidRow);

                using (SqlConnection connection = new SqlConnection(str))
                {
                    connection.Open();
                    using (SqlCommand command = new SqlCommand(sqlMatches, connection))
                    {
                        using (SqlDataReader reader = command.ExecuteReader())
                        {
                            if (reader.HasRows)
                            {
                                while (reader.Read())
                                {
                                    Entry row = new Entry();
                                    row.label = "matches P" + i;
                                    row.count = reader.GetInt32(0);
                                    result.Add(row);
                                }
                            }
                            else
                            {
                                Entry row = new Entry();
                                row.label = "matches P" + i;
                                row.count = 0;
                                result.Add(row);
                            }
                        }
                    }

                    using (SqlCommand command = new SqlCommand(sqlWins, connection))
                    {
                        using (SqlDataReader reader = command.ExecuteReader())
                        {
                            if (reader.HasRows)
                            {
                                while (reader.Read())
                                {
                                    Entry row = new Entry();
                                    row.label = "wins P" + i;
                                    row.count = reader.GetInt32(0);
                                    result.Add(row);
                                }
                            }
                            else
                            {
                                Entry row = new Entry();
                                row.label = "wins P" + i;
                                row.count = 0;
                                result.Add(row);
                            }
                        }
                    }

                    using (SqlCommand command = new SqlCommand(sqlName, connection))
                    {
                        using (SqlDataReader reader = command.ExecuteReader())
                        {
                            if (reader.HasRows)
                            {
                                while (reader.Read())
                                {
                                    EntryName row = new EntryName();
                                    row.label = "username";
                                    row.name  = reader.GetString(0);
                                    result.Add(row);
                                    EntryName rowA = new EntryName();
                                    rowA.label = "avatar";
                                    rowA.name  = reader.GetString(1);
                                    result.Add(rowA);
                                }
                            }
                        }
                    }
                    connection.Close();
                }
                i++;
            }

            string json;

            try
            {
                json = JsonConvert.SerializeObject(result, Formatting.Indented);
            } catch (Exception e)
            {
                json = "{}";
            }

            return(result == null?
                   req.CreateResponse(HttpStatusCode.BadRequest, "If you are seeing this, something went really, really wrong, please contact the admins") :
                       req.CreateResponse(HttpStatusCode.OK, json));
        }
Example #14
0
 public override int GetHashCode()
 {
     return(PackageFile.GetHashCode() ^ EntryName.GetHashCode());
 }
 public bool Equals(EntryName other)
 => new Span <byte>(_name).SequenceEqual(other._name);
        protected override void RunJournalCommand()
        {
            if (Last)
            {
                var journal   = OpenJournal();
                var lastEntry = journal.CreateIndex <JournalEntryFile>().SelectMany(x => x.Entries).OrderByDescending(x => x.EntryDate).FirstOrDefault();
                if (lastEntry == null)
                {
                    throw new PSInvalidOperationException("No entries found!");
                }
                SystemProcess.Start(lastEntry.FilePath);
                return;
            }

            var       fileSystem    = new FileSystem();
            var       journalWriter = new JournalWriter(fileSystem, Location);
            string    path;
            LocalDate entryDate;

            switch (ParameterSetName)
            {
            case "Name":
            {
                entryDate = EntryName.EndsWith(".md") ? Journal.FileNameWithExtensionPattern.Parse(EntryName).Value : Journal.FileNamePattern.Parse(EntryName).Value;
                path      = journalWriter.GetJournalEntryFilePath(entryDate);
                break;
            }

            case "Date":
            {
                entryDate = LocalDate.FromDateTime(Date);
                path      = journalWriter.GetJournalEntryFilePath(entryDate);
                break;
            }

            case "DateOffset":
            {
                entryDate = Today.PlusDays(DateOffset);
                path      = journalWriter.GetJournalEntryFilePath(entryDate);
                break;
            }

            case "Entry":
            {
                entryDate = Journal.FileNamePattern.Parse(Entry.EntryName).Value;
                path      = journalWriter.GetJournalEntryFilePath(entryDate);
                break;
            }

            default:
                throw new NotSupportedException();
            }

            if (!fileSystem.File.Exists(path))
            {
                throw new PSInvalidOperationException($"An entry does not exist for '{entryDate}'.");
            }

            Commit(GitCommitType.PreOpenJournalEntry);
            SystemProcess.Start(path);

            if (Wait)
            {
                var result = Choice($"Reading entry for {entryDate}", "Continue on to next entry?", 0, "&Continue", "&Quit");
                Commit(GitCommitType.PostOpenJournalEntry);
                if (result == 1)
                {
                    ThrowTerminatingError("Pipeline terminated at user's request.", ErrorCategory.NotSpecified);
                }
            }
        }