/// <inheritdoc/> protected override string FormatValueAsString(IReadOnlyList <TValue> values) { if (values == null || values.Count == 0) { return(null); } if (SelectionMode != DateInputSelectionMode.Single) { var results = new List <string>(); foreach (var value in values) { results.Add(Formaters.FormatDateValueAsString(value, DateFormat)); } return(String.Join(SelectionMode == DateInputSelectionMode.Multiple ? ", " : " to ", results)); } else { if (values[0] == null) { return(null); } return(Formaters.FormatDateValueAsString(values[0], DateFormat)); } }
public object[] ToArrayTimeSliceGroupItem(int groupLength) { if (Target == null || Target.IsEmpty) { return(null); } return(new object[] { IsActive, Target.Name, Formaters.FormatTime(groupLength) }); }
/// <summary> /// Function:Edit a group info. /// Author :Jerry Xu /// Date :2008-7-14 /// </summary> /// <param name="name"></param> public void EditGroup(string name) { //Show the edit form TimeSliceGroupEditForm group = new TimeSliceGroupEditForm(name); //group.GroupName = name; //if (this.ParentForm != null) // this.ParentForm.TopMost = true; group.ShowModalDialog(); //Refresh group info if (group.IsRefresh) { LoadGroup(group.GroupName); foreach (TreeListNode node in _nodesList) { node[2] = Formaters.FormatTime(group.GroupLength); } } }
static void Main(string[] args) { Trace.Write("START"); Debuggers.LogError("error occured"); Debuggers.LogError(new Exception("ex occured")); Dictionary <string, int> dict = new Dictionary <string, int>() { { "Marketing", 1 }, { "Sales", 2 }, { "IT", 3 } }; var dictExists = dict.Contains(new KeyValuePair <string, int>("IT", 2)); Formaters.DateAndTime(DateTime.Now, 10.23456D); Debuggers.Start(); var customers = Linqers.CustomersWithOrdersByYear(2017); Linqers.GetProductsLongestNameByCategory(); string asyncResult; Task.Run(async() => { asyncResult = await Threads.StartAsync(); }).GetAwaiter().GetResult(); Threads.RunTimer(); var publicTypes = new Reflections().GetPublicTypes(); var assemblyName = new Reflections().GetAssemblyName(); var isPositiveDecimal = Regexes.PositiveWithTwoDecimalPlaces(5.666M); Console.WriteLine("Available memory: " + new PerformanceCounter("Memory", "Available MBytes").NextValue()); var assemblies = new Reflections().GetTypesFromCurrentDomain(); Product productForSerialization = new Product() { CategoryId = 1, Id = 2, IsValid = true }; Serializators.SerializeWithBinaryFormatter(productForSerialization, "bin.dat"); Serializators.SerializeWithDataContractToFile(productForSerialization, "datacontract.dat"); string userSerialized = Serializators.SerializeWithBinaryWriter(new Product { Id = 10 }); DateTime?nullableDateTime = null; bool isDateNotNull = nullableDateTime.HasValue; RateCollection rateCollection = new RateCollection(new Rate[] { new Rate { Value = 1 } }); foreach (var item in rateCollection) { Console.WriteLine(item); } var currentAssembly = Assembly.GetExecutingAssembly(); var sb = new StringBuilder(); sb.Append("First"); sb.AppendLine(); sb.Append("Second"); Console.WriteLine(sb); SortedList <string, string> sortedList = new SortedList <string, string>() { { "asd", "dsa" } }; Debug.Assert(false, "stop"); float amount = 1.6F; object amountObj = amount; int amountInt = (int)(float)amountObj; new Product().Add("book1"); User newUser = new User() { UserGroup = Group.Supervisors | Group.Users }; bool isTrue = newUser.UserGroup < Group.Administrator; var userGroup = newUser.UserGroup; Console.WriteLine(userGroup); string stringNull = null; string stringNotNull = "asd"; Comparers.AreEqual(stringNull, stringNotNull); Rate rate1 = new Rate() { Value = 1, Category = "cat" }; string xml = Serializators.SerializeWithDataContract(rate1); string json = Serializators.SerializeWithDataContractJson(rate1); Console.WriteLine("xml:\r\n" + xml); Console.WriteLine("json:\r\n" + json); Subscriber sub = new Subscriber(); sub.Subscribe(); sub.Execute(); Console.Read(); return; DataContractJsonSerializer js = new DataContractJsonSerializer(typeof(Rate)); Console.WriteLine(string.Format("{0} asdasd {1:000#} asd", 4, 159)); Console.WriteLine(123.ToString("000#")); Rate ratenull = null; int wynik; int.TryParse(ratenull.Category, out wynik); Console.Read(); BaseLogger logger = new Logger(); logger.Log("Log started"); logger.Log("Base: Log contiuniug"); ((Logger)logger).LogCompleted(); Console.Read(); return; Reflections.SetPropertiesOnObject(new Rate() { MyInt = 10 }, "MyInt", "MyIntSpecified"); float mojfloat = 1.6F; double dable = (double)mojfloat; var hashed = Hashers.HashByAlgName(@"C:\windows-version.txt", "SHA"); Threads.ConcurrentDict(); var x = from i in new List <int> { 1, 2 } group i by i into grouped where grouped.Key > 1 select grouped.Key; string xmlInput = "<xml><RateSheet><rate category=\"boutou\" date=\"2012-12-12\"><value>0.03</value></rate><rate category=\"druga\" date=\"2011-11-11\"><value>0.04</value></rate></RateSheet></xml>"; var result = Serializators.ReadFromXml(xmlInput); SHA1Managed SHhash = new SHA1Managed(); //new Class2().Method1(); Class1 class1 = new Class1(); INewInterface interf = class1; interf.Method1(); IEnumerable <Person> people = new List <Person>() { new Person { PhoneNumbers = new List <PhoneNumber> { new PhoneNumber { Number = "1" }, new PhoneNumber { Number = "2" } } }, new Person { PhoneNumbers = new List <PhoneNumber> { new PhoneNumber { Number = "2" }, new PhoneNumber { Number = "3" } } }, }; IEnumerable <IEnumerable <PhoneNumber> > phoneLists = people.Select(p => p.PhoneNumbers); IEnumerable <PhoneNumber> phoneNumbers = people.SelectMany(p => p.PhoneNumbers); }
/// <inheritdoc/> protected override string FormatValueAsString(TValue value) => Formaters.FormatDateValueAsString(value, DateFormat);