Пример #1
0
 public static TodoViewModels GetInstance(object e)
 {
     if (Instance == null)
     {
         Instance = new TodoViewModels(e);
     }
     return(Instance);
 }
Пример #2
0
        public MainPage()
        {
            this.InitializeComponent();
            this.View_Model = ViewModels.TodoViewModels.GetInstance(Icon);
            ImageBrush imageBrush = new ImageBrush();

            imageBrush.ImageSource = new BitmapImage(new Uri("ms-appx:///Assets/timg.jpg", UriKind.Absolute));
            All.Background         = imageBrush;
        }
Пример #3
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.View_Model = ViewModels.TodoViewModels.GetInstance(Icon);
            DataTransferManager.GetForCurrentView().DataRequested += OnShareDataRequested;
            var updator = TileUpdateManager.CreateTileUpdaterForApplication();

            updator.Clear();
            for (int count = 0; count < View_Model.AllItems.Count; count++)
            {
                XmlDocument tile = new XmlDocument();
                tile.LoadXml(File.ReadAllText("Tile.xml"));
                XmlNodeList tileText = tile.GetElementsByTagName("text");
                for (int i = 0; i < tileText.Count; i++)
                {
                    ((XmlElement)tileText[i]).InnerText = View_Model.AllItems[count].title;
                    i++;
                    ((XmlElement)tileText[i]).InnerText = View_Model.AllItems[count].description;
                }
                TileNotification notification = new TileNotification(tile);
                updator.Update(notification);
            }
            TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
            if (e.NavigationMode == NavigationMode.New)
            {
                ApplicationData.Current.LocalSettings.Values.Remove("NewPage");
            }
            else
            {
                if (ApplicationData.Current.LocalSettings.Values.ContainsKey("NewPage"))
                {
                    var composite = ApplicationData.Current.LocalSettings.Values["NewPage"] as ApplicationDataCompositeValue;
                    Title.Text  = (string)composite["title"];
                    Detail.Text = (string)composite["detail"];
                    Date.Date   = (DateTimeOffset)composite["date"];
                    //Icon.Source = new BitmapImage(new Uri((string)composite["image"]));
                    ApplicationData.Current.LocalSettings.Values.Remove("NewPage");
                }
            }
        }