Ejemplo n.º 1
0
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            if (value is DateTime)
            {
                return(RelativeDateConverter.ConvertRelative((DateTime)value));
            }
            else if (parameter as string == "ShowNoDate")
            {
                return(StringResources.ConverterDate_NoDate);
            }

            return(DependencyProperty.UnsetValue);
        }
Ejemplo n.º 2
0
        private List <string> GetConvertedValues()
        {
            Thread.CurrentThread.CurrentCulture   = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
            RelativeDateConverter.LoadResources();

            var result = new List <string>();

            foreach (var date in this.dates)
            {
                StaticTestOverrides.Now = this.now;
                string convertedValue = RelativeDateConverter.ConvertRelative(date);
                result.Add(convertedValue);
            }

            return(result);
        }
Ejemplo n.º 3
0
 public DueDateGroupBuilderFactory(IAbstractFolder folder, ISettings settings)
     : base(folder, settings, true)
 {
     this.converter = new RelativeDateConverter(settings);
 }
Ejemplo n.º 4
0
        public static XmlDocument CreateTileNotificationForTask(ITask task)
        {
            string content = string.Empty;

            try
            {
                var xmlDocument = new XmlDocument();

                const string templateXml = @"
                    <tile>
                      <visual branding=""nameAndLogo"">

                        <binding template=""TileSmall"" hint-textStacking=""center"">
                          <text hint-style=""subtitle"" hint-align=""center"">{0}</text>
                        </binding>

                        <binding template=""TileMedium"" displayName=""{3}"">
                          <text hint-style=""base"">{0}</text>
                          <text hint-style=""caption"">{1}</text>
                          <text hint-style=""captionSubtle"" hint-wrap=""true"">{2}</text>
                        </binding>

                        <binding template=""TileWide"" displayName=""{4}"">
                          <group>
                            <subgroup hint-weight=""33"">
                              <image src=""{5}"" />
                            </subgroup>
                            <subgroup>
                              <text hint-style=""base"">{0}</text>
                              <text hint-style=""caption"">{1}</text>
                              <text hint-style=""captionSubtle"" hint-wrap=""true"">{2}</text>
                            </subgroup>
                          </group>
                        </binding>

                        <binding template=""TileLarge"" displayName=""{4}"">
                          <group>
                            <subgroup>
                              <text hint-style=""base"">{0}</text>
                             <text hint-style=""caption"">{1}</text>
                              <text hint-style=""captionSubtle"" hint-wrap=""true"">{2}</text>
                              <image hint-align=""center"" src=""{5}"" />
                            </subgroup>
                          </group>
                        </binding>

                      </visual>
                    </tile>
                    ";

                string picture = ResourcesLocator.GetFolderIconPng(task.Folder);

                content = string.Format(
                    templateXml,
                    SafeEscape(task.Title),                                                             // 0 title
                    SafeEscape(task.Folder.Name),                                                       // 1 folder
                    SafeEscape(task.Note ?? string.Empty),                                              // 2 notes (max: 65 characters)
                    task.Due.HasValue ? task.Due.Value.ToString("M") : string.Empty,                    // 3 short due (Aug. 22)
                    task.Due.HasValue ? RelativeDateConverter.ConvertRelative(task.Due) : string.Empty, // 4 long due (Today Aug. 22)
                    picture                                                                             // 5 image
                    );

                xmlDocument.LoadXml(content);

                return(xmlDocument);
            }
            catch (Exception ex)
            {
                TrackingManagerHelper.Exception(ex, string.Format("Exception CreateTileNotification: {0}", content));
                return(null);
            }
        }