示例#1
0
        private void AddTile()
        {
            IconicTileData oIcontile = new IconicTileData();

            oIcontile.Title = "SignalX";
            //oIcontile.Count = 7;

            oIcontile.IconImage      = new Uri("Assets/Tiles/wp202.png", UriKind.Relative);
            oIcontile.SmallIconImage = new Uri("Assets/Tiles/wp110.png", UriKind.Relative);

            oIcontile.WideContent1 = "SignalX";
            // oIcontile.WideContent2 = "Icon tile";
            //oIcontile.WideContent3 = "All about Live tiles By WmDev";

            oIcontile.BackgroundColor = System.Windows.Media.Colors.Transparent;

            // find the tile object for the application tile that using "Iconic" contains string in it.
            ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("Iconic".ToString()));

            if (TileToFind != null && TileToFind.NavigationUri.ToString().Contains("Iconic"))
            {
                TileToFind.Delete();
                ShellTile.Create(new Uri("/MainPage.xaml?id=Iconic", UriKind.Relative), oIcontile, true);
            }
            else
            {
                ShellTile.Create(new Uri("/MainPage.xaml?id=Iconic", UriKind.Relative), oIcontile, true);
            }
        }
示例#2
0
        //tile updating
        private void PinTile()
        {
            try
            {
                ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("Flip".ToString()));
                TileToFind.Delete();

                FlipTileData tileData = new FlipTileData
                {
                    BackgroundImage     = new Uri("Icons/runNew.png", UriKind.RelativeOrAbsolute),
                    WideBackgroundImage = new Uri("Icons/wideRun.png", UriKind.RelativeOrAbsolute)
                };

                ShellTile.Create(new Uri("/MainPage.xaml?Flip", UriKind.Relative), tileData, true);
            }
            catch (Exception e)
            {
                FlipTileData tileData = new FlipTileData
                {
                    BackgroundImage     = new Uri("Icons/runNew.png", UriKind.RelativeOrAbsolute),
                    WideBackgroundImage = new Uri("Icons/wideRun.png", UriKind.RelativeOrAbsolute)
                };

                ShellTile.Create(new Uri("/MainPage.xaml?Flip", UriKind.Relative), tileData, true);
            }
        }
示例#3
0
        private void btnIconicTile_Click(object sender, RoutedEventArgs e)
        {
            IconicTileData oIcontile = new IconicTileData();

            oIcontile.Title = "Flinger.co Remote";
            oIcontile.Count = 0;

            oIcontile.IconImage      = new Uri("Assets/Tiles/Iconic/202x202.png", UriKind.Relative);
            oIcontile.SmallIconImage = new Uri("Assets/Tiles/Iconic/110x110.png", UriKind.Relative);

            oIcontile.WideContent1 = "windows phone 8 Live tile";
            oIcontile.WideContent2 = "Icon tile";
            oIcontile.WideContent3 = "All about Live tiles By WmDev";

            oIcontile.BackgroundColor = System.Windows.Media.Colors.Orange;

            // find the tile object for the application tile that using "Iconic" contains string in it.
            ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("Iconic".ToString()));

            if (TileToFind != null && TileToFind.NavigationUri.ToString().Contains("Iconic"))
            {
                TileToFind.Delete();
                ShellTile.Create(new Uri("/MainPage.xaml?id=Iconic", UriKind.Relative), oIcontile, true);
            }
            else
            {
                ShellTile.Create(new Uri("/MainPage.xaml?id=Iconic", UriKind.Relative), oIcontile, true);
            }
        }
示例#4
0
        private void IconDelete_Click(object sender, EventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("确实要取消桌面倒计时并清除磁贴吗?", "确认", MessageBoxButton.OKCancel);

            if (MessageBoxResult.OK == result)
            {
                isActived = false;
                isoSetting.Remove("isActived");
                string   msg  = textBoxMsg.Text;
                DateTime date = datePickerDate.Value.Value;
                //int days = Convert.ToInt32(textBoxDay.Text);
                updateIsolate(msg, date);
                isoSetting.Remove("lastUpdate");
                ShellTile NowTile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("TileID=2"));
                if (NowTile != null)
                {
                    NowTile.Delete();
                }
                if (ScheduledActionService.Find(periodicTaskName) != null)
                {
                    ScheduledActionService.Remove(periodicTaskName);
                }
            }
            else
            {
                return;
            }
        }
示例#5
0
        private void PinToStart_Click(object sender, System.Windows.Input.GestureEventArgs e)
        {
            this.frontTile.SetCityName("No City Selected");
            this.radHubTile.Height = 173;
            this.radHubTile.Width  = 173;
            this.frontTile.SetProperties(new BitmapImage(new Uri("../Images/sunny.png", UriKind.RelativeOrAbsolute)),
                                         String.Format("25{0}", DegreeSign));

            this.backTile.SetProperties(new BitmapImage(new Uri("../Images/sunny-back.png", UriKind.RelativeOrAbsolute)),
                                        "test");
            this.radHubTile.FrontContent = this.frontTile;


            RadExtendedTileData tileData = new RadExtendedTileData()
            {
                VisualElement     = Tile,
                BackVisualElement = this.backTile
            };
            Uri       tileUri = new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute);
            ShellTile tile    = Telerik.Windows.Controls.LiveTileHelper.GetTile(tileUri);

            if (tile != null)
            {
                tile.Delete();
            }

            Telerik.Windows.Controls.LiveTileHelper.CreateTile(tileData, tileUri);
        }
示例#6
0
        public void btnIconicTile_Click(int count)
        {
            UserName       names     = new UserName();
            IconicTileData oIcontile = new IconicTileData();

            oIcontile.Title = names.fbname;
            oIcontile.Count = count;

            oIcontile.IconImage      = new Uri("Assets/Tiles/app_202x202.png", UriKind.Relative);
            oIcontile.SmallIconImage = new Uri("Assets/Tiles/app_110x110.png", UriKind.Relative);

            oIcontile.WideContent1 = "Offline Social";
            //oIcontile.WideContent2 = "Name";
            oIcontile.WideContent3 = "Queued Updates On Phone";


            oIcontile.BackgroundColor = System.Windows.Media.Colors.Orange;

            // find the tile object for the application tile that using "Iconic" contains string in it.
            ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("Iconic".ToString()));

            if (TileToFind != null && TileToFind.NavigationUri.ToString().Contains("Iconic"))
            {
                TileToFind.Delete();
                ShellTile.Create(new Uri("/MainPage.xaml?id=Iconic", UriKind.Relative), oIcontile, true);
            }
            else
            {
                ShellTile.Create(new Uri("/MainPage.xaml?id=Iconic", UriKind.Relative), oIcontile, true);
            }
        }
示例#7
0
        /// <summary>
        /// pin item to main screen.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void appbar_pin_Click(object sender, EventArgs e)
        {
            try
            {
                var       data = (this.DataContext as CityData);
                var       tileParameterData = apiUrl + " splitfromhere " + this.category + " splitfromhere " + data.CompositeKey;
                ShellTile tile = CheckIfTileExist(tileParameterData);
                if (tile == null)
                {
                    StandardTileData secondaryTile = new StandardTileData
                    {
                        Title           = data.Name,
                        BackgroundImage = new Uri(data.BackgroundImage, UriKind.Relative),
                        BackContent     = data.Name
                    };

                    string tileUri = string.Concat("/Views/CityCategoryDetail.xaml?tileParameter=", tileParameterData);
                    ShellTile.Create(new Uri(tileUri, UriKind.Relative), secondaryTile);
                }
                else
                {
                    ApplicationBarIconButton appButton = (ApplicationBarIconButton)ApplicationBar.Buttons[0];
                    tile.Delete();
                    MessageBox.Show(AppResources.SecondaryTileDeletedMessage);
                    appButton.IconUri = new Uri("/Assets/Pin.png", UriKind.Relative);
                    appButton.Text    = AppResources.AppBarButtonPinText;
                }
            }
            catch (Exception)
            { }
        }
示例#8
0
        private void Image_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            //variaveis para saber qual tile deve ser removido caso o usuario seja removido do banco
            var       mySelectedItem = listaUsuarios.SelectedItem as Usuario;
            ShellTile TileToFind     = null;

            if (MessageBox.Show(AppResources.removeUserAsk, AppResources.removeUserTitle, MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                Image   img     = (Image)sender;
                Usuario usuario = (Usuario)img.DataContext;

                TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(mySelectedItem.Nome));

                using (var db = new UsuarioDataContext())
                {
                    db.usuarios.Attach(usuario);
                    db.usuarios.DeleteOnSubmit(usuario);
                    db.SubmitChanges();

                    MessageBox.Show(AppResources.sucessRemoved);
                    CarregarUsuarios();
                }
            }

            // Se o tile existia e o usuario foi removido ele é removido
            if (TileToFind != null)
            {
                TileToFind.Delete();
            }
        }
        private void OnBlogSelectedForDelete(object sender, SelectionChangedEventArgs e)
        {
            App.PopupSelectionService.SelectionChanged -= OnBlogSelectedForDelete;

            if (0 == e.AddedItems.Count)
            {
                return;
            }

            Blog blogToRemove = e.AddedItems[0] as Blog;

            if (null == blogToRemove)
            {
                return;
            }

            // remove this blog's tile
            ShellTile blogTile = App.MasterViewModel.FindBlogTile(blogToRemove);

            if (null != blogTile)
            {
                blogTile.Delete();
            }

            DataService.Current.Blogs.Remove(blogToRemove);
            PushNotificationsHelper.Instance.sendBlogsList();
        }
示例#10
0
        private void TextBlock_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            try
            {
                ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("Flip".ToString()));
                TileToFind.Delete();

                FlipTileData tileData = new FlipTileData
                {
                    BackgroundImage     = new Uri("Icons/runNew.png", UriKind.RelativeOrAbsolute),
                    WideBackgroundImage = new Uri("Icons/wideRun.png", UriKind.RelativeOrAbsolute)
                };

                ShellTile.Create(new Uri("/MainPage.xaml?Flip", UriKind.Relative), tileData, true);
            }
            catch (Exception ex)
            {
                FlipTileData tileData = new FlipTileData
                {
                    BackgroundImage     = new Uri("Icons/runNew.png", UriKind.RelativeOrAbsolute),
                    WideBackgroundImage = new Uri("Icons/wideRun.png", UriKind.RelativeOrAbsolute)
                };

                ShellTile.Create(new Uri("/MainPage.xaml?Flip", UriKind.Relative), tileData, true);
            }
        }
示例#11
0
        private void UnPinLivetile(LivetileTemplateItem item)
        {
            ShellTile oTile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(item.LiveItem.ToString().ToLower()));

            if (oTile != null)
            {
                oTile.Delete();
                item.PinIconOpacity = 0.3;
                string buttonText = AppResources.PinCalendarLivetile;

                if (item.LiveItem == LiveItems.Weather)
                {
                    buttonText = AppResources.PinWeatherLivetile;
                }
                else if (item.LiveItem == LiveItems.Battery)
                {
                    buttonText = AppResources.PinBatteryLivetile;
                }

                foreach (ApplicationBarIconButton button in IAppBarLivetile.Buttons)
                {
                    if (button.Text == buttonText)
                    {
                        button.IsEnabled = true;
                        break;
                    }
                }
            }

            if (!ExistsActiveTile && !(bool)UseLockscreen.IsChecked)
            {
                RemoveAgent(Constants.PERIODIC_TASK_NAME);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PinAppBtn_Click(object sender, EventArgs e)
        {
            var    dc       = (TransportsNantais.ViewModels.StopDetailsViewModel) this.DataContext;
            string tileName = "TanId=" + dc.TanId;

            // check if secondary tile is already made and pinned
            ShellTile Tile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(tileName));

            if (Tile == null)
            {
                // create a new secondary tile
                StandardTileData data = new StandardTileData();
                // tile foreground data
                data.Title           = dc.StopName;
                data.BackgroundImage = new Uri("/Assets/info_trafic.png", UriKind.Relative);
                // create a new tile for this Second Page
                string tilePath = String.Format("/Views/StopDetailsView.xaml?TanId={0}&StopName={1}",
                                                dc.TanId,
                                                Uri.EscapeUriString(dc.StopName));

                ShellTile.Create(new Uri(tilePath, UriKind.Relative), data);
            }
            else
            {
                Tile.Delete();
            }

            this.ChangePinAppBtn();
        }
示例#13
0
        private void cbShowTile_Unchecked(object sender, RoutedEventArgs e)
        {
            ShellTile tile = this.FindTile(SecondaryTileUriSource);

            if (tile != null)
            {
                tile.Delete();
                MessageBox.Show("Secondary tile deleted.");
            }
        }
示例#14
0
        private void toggleSwitchTile_Unchecked(object sender, RoutedEventArgs e)
        {
            ShellTile NowTile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("TileID=2"));

            if (NowTile != null)
            {
                NowTile.Delete();
            }
            HasTile = false;
        }
示例#15
0
        public void DeleteTileFor(long userOrGroupId, bool isGroup)
        {
            ShellTile tile = this.FindTile(userOrGroupId, isGroup);

            if (tile == null)
            {
                return;
            }
            tile.Delete();
        }
示例#16
0
        // Event handler for when the check box is unchecked.  Delete the secondary Tile
        // if it exists.
        private void checkBoxDisplaySecondaryTile_Unchecked(object sender, RoutedEventArgs e)
        {
            // Find the Tile we want to delete.
            ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("DefaultTitle=FromTile"));

            // If the Tile was found, then delete it.
            if (TileToFind != null)
            {
                TileToFind.Delete();
            }
        }
示例#17
0
        public Task <bool> Unpin(TileInfo tileInfo)
        {
            ShellTile tile = this.FindTile(tileInfo.TileId);

            if (tile != null)
            {
                tile.Delete();
            }

            return(Task.FromResult <bool>(true));
        }
示例#18
0
        public static void RemoveTabFromStart(Tab tab)
        {
            ShellTile TileToDelete =
                ShellTile.ActiveTiles.FirstOrDefault(
                    x => x.NavigationUri.ToString().Contains(TileNavigationUrl + tab.Id.ToString()));

            if (!(TileToDelete == null))
            {
                TileToDelete.Delete();
            }
        }
示例#19
0
        private void deleteTile()
        {
            string uri = String.Format("/txtnote;component/MainPage.xaml?ID={0}", fileName);
            // Try to find a Tile that has this page's URI.
            ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault(o => o.NavigationUri.ToString().Contains(uri));

            if (tile != null)
            {
                tile.Delete();
            }
        }
        public static bool DeleteSecondaryTile(Profile p)
        {
            ShellTile delTile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().EndsWith(String.Format("Id={0}", p.Id)));

            if (delTile != null)
            {
                delTile.Delete();
                return(true);
            }
            return(false);
        }
示例#21
0
            public static void DeleteTile(string navDataSource)
            {
                ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault(o => o.NavigationUri.ToString().Contains(navDataSource));

                if (tile == null)
                {
                    return;
                }

                tile.Delete();
            }
示例#22
0
        /// <summary>
        /// Delete tile and image
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void _appBarButtonDelete_Click(object sender, EventArgs e)
        {
            ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("pinned=MyImage.jpg"));

            if (TileToFind != null)
            {
                TileToFind.Delete();
                DeleteImageFile();
                MyImage.Source = null;
            }
            else
            {
                MessageBox.Show("No tile available.");
            }
        }
示例#23
0
文件: LiveTile.cs 项目: kosorin/onedo
 public static void UnpinQuickAdd()
 {
     try
     {
         ShellTile tile = PinnedQuickAddTile();
         if (tile != null)
         {
             tile.Delete();
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine(": Chyba při mazání živé dlaždice pro rychlé přidání: {0}", e.Message);
     }
 }
示例#24
0
        public void cleanupForDeletion()
        {
            ShellTile tile = getSubscriptionsLiveTile();

            if (tile != null)
            {
                Debug.WriteLine("Deleted subscription's live tile.");
                tile.Delete();
            }

            BackgroundWorker worker = new BackgroundWorker();

            worker.DoWork += new DoWorkEventHandler(backgroundCleanupWork);
            worker.RunWorkerAsync();
        }
        private void RadImageButton_Tap_1(object sender, System.Windows.Input.GestureEventArgs e)
        {
            RadExtendedTileData tileData = new RadExtendedTileData()
            {
                VisualElement = Tile
            };
            Uri       tileUri = new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute);
            ShellTile tile    = Telerik.Windows.Controls.LiveTileHelper.GetTile(tileUri);

            if (tile != null)
            {
                tile.Delete();
            }

            Telerik.Windows.Controls.LiveTileHelper.CreateTile(tileData, tileUri);
        }
        public void RemoveTile(String area)
        {
            String    strTileKeyWord = String.Format(Constants.TILE_NAVIGATION_KEYWORD, area);
            ShellTile tile           = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(strTileKeyWord));

            if (tile != null)
            {
                try
                {
                    tile.Delete();
                }
                catch (Exception)
                {
                }
            }
        }
示例#27
0
        /// <summary>
        /// Checks if the user has an authenication token. If we do, load the user and go to the
        /// main page. If not, load the login screen and redirect them to IE.
        /// </summary>
        private async void LoginTest()
        {
            App.UserAccountEntity = new UserAccountEntity();
            var  authManager = new AuthenticationManager();
            bool loginTest   = await authManager.RefreshAccessToken(App.UserAccountEntity);

            if (loginTest)
            {
                // We have a token! Start the background processing and clear all old notifications.
                StartPeriodicAgent();

                UserAccountEntity.User user = await authManager.GetUserEntity(App.UserAccountEntity);

                if (user == null)
                {
                    MessageBox.Show(AppResources.GenericError);
                    Application.Current.Terminate();
                }
                App.UserAccountEntity.SetUserEntity(user);

                // Clears old notifications and resets the live tile.
                // Note that this ONLY clears normal notifications. Flags on the individual objects (Like friends
                // or new messages) are still there and are cleared when the user activates them.
                NotificationEntity notificationEntity = await GetNotifications(App.UserAccountEntity);

                var notificationList = notificationEntity.Notifications.Where(o => o.SeenFlag == false);
                foreach (var notification in notificationList)
                {
                    await NotificationManager.ClearNotification(notification, App.UserAccountEntity);
                }

                // remove secondary tile
                ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("Title=FoulPlay"));
                if (tile != null)
                {
                    tile.Delete();
                }
                NavigationService.Navigate(new Uri("/Views/MainPivotView.xaml", UriKind.Relative));
            }
            else
            {
                // We don't have a token, or something is wrong with their servers :(. Go to the login page...
                NavigationService.Navigate(new Uri("/Views/LoginPage.xaml", UriKind.Relative));
            }
        }
        /// <summary>
        /// Toggle pinning this a tile for this page on the start menu.
        /// </summary>
        private void PinToStartCheckBox_Click(object sender, RoutedEventArgs e)
        {
            // Try to find a tile that has this page's URI
            ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault(o => o.NavigationUri.ToString().Contains(NavigationService.Source.ToString()));

            if (tile == null)
            {
                // No tile was found, so add one for this page.
                StandardTileData tileData = new StandardTileData {
                    Title = PageTitle.Text
                };
                ShellTile.Create(new Uri(NavigationService.Source.ToString(), UriKind.Relative), tileData);
            }
            else
            {
                // A tile was found, so remove it.
                tile.Delete();
            }
        }
示例#29
0
        public void cleanupForDeletion()
        {
            ShellTile tile = getSubscriptionsLiveTile();

            if (tile != null)
            {
                Debug.WriteLine("Deleted subscription's live tile.");
                tile.Delete();
            }

            if (m_isolatedFileStorage.FileExists(m_PodcastLogoLocalLocation) == false)
            {
                Debug.WriteLine("ERROR: Logo local cache file not found! Subscription: " + m_PodcastName
                                + ", logo file: " + m_PodcastLogoLocalLocation);
                return;
            }

            Debug.WriteLine("Deleting local cache of logo: " + m_PodcastLogoLocalLocation);
            m_isolatedFileStorage.DeleteFile(m_PodcastLogoLocalLocation);
        }
示例#30
0
        private void ApplicationBarIconPinToStartButton_OnClick(object sender, EventArgs e)
        {
            bool agentStarted = backgroundAgent.StartIfEnabled();

            if (agentStarted)
            {
                AppSettings.LiveTileEnabled = true;

                ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("DefaultTitle=new"));
                if (tile != null)
                {
                    tile.Delete();
                }

                if (App.ViewModel != null && App.ViewModel.Item != null)
                {
                    LiveTileCreator.CreateLiveTile("Trivia Buff", App.ViewModel.Item.Title);
                }
            }
        }
示例#31
0
        // Do whatever action the button requested
        public void DoTileAction(string tileAction, Uri tileId, ShellTile tileToFind, ShellTileData tileData)
        {
            switch (tileAction)
            {
                case "create":
                    ShellTile.Create(tileId, tileData, true);
                    break;

                case "update":
                    tileToFind.Update(tileData);
                    break;

                case "delete":
                    tileToFind.Delete();
                    break;
            }
        }