Exemplo n.º 1
0
    protected void UpdateShutdownItems()
    {
      ISettingsManager sm = ServiceRegistration.Get<ISettingsManager>();
      List<SystemStateItem> systemStateItems = sm.Load<SystemStateDialogSettings>().ShutdownItemList;

      bool timerActive = false;
      Models.SleepTimerModel stm = ServiceRegistration.Get<IWorkflowManager>().GetModel(Consts.WF_STATE_ID_SLEEP_TIMER_MODEL) as Models.SleepTimerModel;
      if (stm != null && stm.IsSleepTimerActive == true)
      {
        timerActive = true;
      }

      _shutdownItems.Clear();
      if (systemStateItems != null)
      {
        for (int i = 0; i < systemStateItems.Count; i++)
        {
          SystemStateItem systemStateItem = systemStateItems[i];
          if (!systemStateItem.Enabled)
            continue;
          ListItem item = new ListItem(Consts.KEY_NAME, Consts.GetResourceIdentifierForMenuItem(systemStateItem.Action, timerActive));
          item.Command = new MethodDelegateCommand(() => DoAction(systemStateItem.Action));
          _shutdownItems.Add(item);
        }
      }
      _shutdownItems.FireChange();
    }
Exemplo n.º 2
0
    public void Select(ListItem item)
    {
      if (item == null)
        return;
      object actionObj;
      object mediaItemObj;
      if (!item.AdditionalProperties.TryGetValue(Consts.KEY_MEDIA_ITEM_ACTION, out actionObj) || !item.AdditionalProperties.TryGetValue(Consts.KEY_MEDIA_ITEM, out mediaItemObj))
        return;

      IMediaItemAction action = actionObj as IMediaItemAction;
      MediaItem mediaItem = mediaItemObj as MediaItem;
      if (action == null || mediaItem == null)
        return;

      try
      {
        ContentDirectoryMessaging.MediaItemChangeType changeType;
        if (action.Process(mediaItem, out changeType) && changeType != ContentDirectoryMessaging.MediaItemChangeType.None)
        {
          ContentDirectoryMessaging.SendMediaItemChangedMessage(mediaItem, changeType);
        }
      }
      catch (Exception ex)
      {
        ServiceRegistration.Get<ILogger>().Error("Error executing MediaItemAction '{0}':", ex, action.GetType());
      }
    }
Exemplo n.º 3
0
        public LayoutTypeModel()
        {
            items = new ItemsList();

            ListItem listItem = new ListItem(Consts.KEY_NAME, "List")
            {
                Command = new MethodDelegateCommand(() => UpdateLayout(LayoutType.List))
            };
            listItem.AdditionalProperties[KEY_LAYOUT_TYPE] = LayoutType.List;
            items.Add(listItem);

            ListItem gridItem = new ListItem(Consts.KEY_NAME, "Grid")
            {
                Command = new MethodDelegateCommand(() => UpdateLayout(LayoutType.Icons))
            };
            gridItem.AdditionalProperties[KEY_LAYOUT_TYPE] = LayoutType.Icons;
            items.Add(gridItem);

            ListItem coversItem = new ListItem(Consts.KEY_NAME, "Covers")
            {
                Command = new MethodDelegateCommand(() => UpdateLayout(LayoutType.Cover))
            };
            coversItem.AdditionalProperties[KEY_LAYOUT_TYPE] = LayoutType.Cover;
            items.Add(coversItem);
        }
 protected override void SettingChanged()
 {
   _items.Clear();
   SkinConfigSetting skinSetting = (SkinConfigSetting) _setting;
   foreach (SkinManagement.Skin skin in skinSetting.Skins)
   {
     ListItem skinItem = new ListItem(KEY_NAME, skin.ShortDescription);
     skinItem.SetLabel(KEY_TECHNAME, skin.Name);
     ISkinResourceBundle resourceBundle;
     string preview = skin.GetResourceFilePath(skin.PreviewResourceKey, false, out resourceBundle);
     if (preview == null)
     {
       Theme defaultTheme = skin.DefaultTheme;
       if (defaultTheme != null)
         preview = defaultTheme.GetResourceFilePath(skin.PreviewResourceKey, false, out resourceBundle);
     }
     skinItem.SetLabel(KEY_IMAGESRC, preview);
     _items.Add(skinItem);
     if (skinSetting.CurrentSkinName == skin.Name)
     {
       skinItem.Selected = true;
       _choosenItem = skinItem;
     }
   }
   _items.FireChange();
   base.SettingChanged();
 }
Exemplo n.º 5
0
 /// <summary>
 /// this will turn the _users list into the _usersExposed list
 /// </summary>
 private void RefreshUserList()
 {
   IList<IUser> users = ServiceRegistration.Get<IUserService>().GetUsers();
   // clear the exposed users list
   Users.Clear();
   // add users to expose them
   foreach (IUser user in users)
   {
     if (user == null)
     {
       continue;
     }
     ListItem buff = new ListItem();
     buff.SetLabel("UserName", user.UserName);
     buff.SetLabel("UserImage", user.UserImage);
     if (user.NeedsPassword)
     {
       buff.SetLabel("NeedsPassword", "true");
     }
     else
     {
       buff.SetLabel("NeedsPassword", "false");
     }
     buff.SetLabel("LastLogin", user.LastLogin.ToString("G"));
     Users.Add(buff);
   }
   // tell the skin that something might have changed
   Users.FireChange();
 }
    private bool ItemCheckedChanged(int index, ListItem item)
    {
      bool isChecked = (bool) item.AdditionalProperties[Consts.KEY_IS_CHECKED];

      _shutdownItemList[index].Enabled = isChecked;

      return true;
    }
Exemplo n.º 7
0
 public static void SelectMovie(ListItem item)
 {
     var t = new Trailer { Title = (string)item.AdditionalProperties[NAME], Url = (string)item.AdditionalProperties[TRAILER] };
     if (t.Url != "")
     {
         CinemaPlayerHelper.PlayStream(t);
     }
 }
 bool IFanartImageSourceProvider.TryCreateFanartImageSource(ListItem listItem, out FanArtImageSource fanartImageSource)
 {
   SeriesFilterItem series = listItem as SeriesFilterItem;
   if (series != null)
   {
     fanartImageSource = new FanArtImageSource
     {
       FanArtMediaType = FanArtMediaTypes.Series,
       FanArtName = series.SimpleTitle
     };
     return true;
   }
   SeriesItem episode = listItem as SeriesItem;
   if (episode != null)
   {
     fanartImageSource = new FanArtImageSource
     {
       FanArtMediaType = FanArtMediaTypes.Series,
       FanArtName = episode.Series
     };
     return true;
   }
   MovieFilterItem movieCollection = listItem as MovieFilterItem;
   if (movieCollection != null)
   {
     fanartImageSource = new FanArtImageSource
     {
       FanArtMediaType = FanArtMediaTypes.MovieCollection,
       FanArtName = movieCollection.SimpleTitle
     };
     return true;
   }
   MovieItem movie = listItem as MovieItem;
   if (movie != null)
   {
     fanartImageSource = new FanArtImageSource
     {
       FanArtMediaType = FanArtMediaTypes.Movie,
       // Fanart loading now depends on the MediaItemId to support local fanart
       FanArtName = movie.MediaItem.MediaItemId.ToString()
     };
     return true;
   }
   VideoItem video = listItem as VideoItem;
   if (video != null)
   {
     fanartImageSource = new FanArtImageSource
     {
       FanArtMediaType = FanArtMediaTypes.Movie,
       // Fanart loading now depends on the MediaItemId to support local fanart
       FanArtName = video.MediaItem.MediaItemId.ToString()
     };
     return true;
   }
   fanartImageSource = null;
   return false;
 }
    private bool MoveItemUp(int index, ListItem item)
    {
      if (index <= 0 || index >= _shutdownItems.Count)
        return false;
      Utilities.CollectionUtils.Swap(_shutdownItemList, index, index - 1);

      _focusedDownButton = -1;
      _focusedUpButton = index - 1;

      UpdateShutdownItems();
      return true;
    }
Exemplo n.º 10
0
 protected virtual bool MoveItemDown(int index, ListItem item)
 {
   IPlaylist playlist = _playlist;
   if (playlist == null)
     return false;
   lock (playlist.SyncObj)
   {
     if (index < 0 || index >= playlist.ItemList.Count - 1)
       return false;
     playlist.Swap(index, index + 1);
     return true;
   }
 }
 public PlatformSelectModel()
 {
     items = new ItemsList();
     var platforms = Dropdowns.GetPlatformList();
     for (int i = -1; i < platforms.Count; i++)
     {
         string platformName = i < 0 ? "" : platforms[i].Name;
         ListItem item = new ListItem(Consts.KEY_NAME, platformName)
         {
             Command = new MethodDelegateCommand(() => UpdatePlatform(platformName))
         };
         item.AdditionalProperties[KEY_PLATFORM] = platformName;
         items.Add(item);
     }
 }
Exemplo n.º 12
0
        public static void Init()
        {
            items.Clear();
              var oneItemSelected = false;

              foreach (var cd in GoogleMovies.GoogleMovies.Data.List)
              {
            var item = new ListItem();
            item.AdditionalProperties[NAME] = cd.Current.Id;
            item.SetLabel("Name", cd.Current.Name + " - " + cd.Current.Address);
            items.Add(item);
            if (oneItemSelected) continue;
            CinemaHome.SelectCinema(cd.Current.Id);
            oneItemSelected = true;
              }
              items.FireChange();
        }
Exemplo n.º 13
0
    public ViewModeModel()
    {
      ViewSettings settings = ServiceRegistration.Get<ISettingsManager>().Load<ViewSettings>();
      _layoutTypeProperty = new WProperty(typeof(LayoutType), settings.LayoutType);
      _layoutSizeProperty = new WProperty(typeof(LayoutSize), settings.LayoutSize);

      ListItem smallList = new ListItem(Consts.KEY_NAME, Consts.RES_SMALL_LIST)
        {
            Command = new MethodDelegateCommand(() => SetViewMode(LayoutType.ListLayout, LayoutSize.Small)),
        };
      smallList.AdditionalProperties[Consts.KEY_LAYOUT_TYPE] = LayoutType.ListLayout;
      smallList.AdditionalProperties[Consts.KEY_LAYOUT_SIZE] = LayoutSize.Small;
      _viewModeItemsList.Add(smallList);

      ListItem mediumlList = new ListItem(Consts.KEY_NAME, Consts.RES_MEDIUM_LIST)
        {
            Command = new MethodDelegateCommand(() => SetViewMode(LayoutType.ListLayout, LayoutSize.Medium))
        };
      mediumlList.AdditionalProperties[Consts.KEY_LAYOUT_TYPE] = LayoutType.ListLayout;
      mediumlList.AdditionalProperties[Consts.KEY_LAYOUT_SIZE] = LayoutSize.Medium;
      _viewModeItemsList.Add(mediumlList);

      ListItem largeList = new ListItem(Consts.KEY_NAME, Consts.RES_LARGE_LIST)
        {
            Command = new MethodDelegateCommand(() => SetViewMode(LayoutType.ListLayout, LayoutSize.Large))
        };
      largeList.AdditionalProperties[Consts.KEY_LAYOUT_TYPE] = LayoutType.ListLayout;
      largeList.AdditionalProperties[Consts.KEY_LAYOUT_SIZE] = LayoutSize.Large;
      _viewModeItemsList.Add(largeList);

      ListItem largeGrid = new ListItem(Consts.KEY_NAME, Consts.RES_LARGE_GRID)
        {
            Command = new MethodDelegateCommand(() => SetViewMode(LayoutType.GridLayout, LayoutSize.Large))
        };
      largeGrid.AdditionalProperties[Consts.KEY_LAYOUT_TYPE] = LayoutType.GridLayout;
      largeGrid.AdditionalProperties[Consts.KEY_LAYOUT_SIZE] = LayoutSize.Large;
      _viewModeItemsList.Add(largeGrid);

      ListItem coverLarge = new ListItem(Consts.KEY_NAME, Consts.RES_LARGE_COVER)
        {
            Command = new MethodDelegateCommand(() => SetViewMode(LayoutType.CoverLayout, LayoutSize.Large))
        };
      coverLarge.AdditionalProperties[Consts.KEY_LAYOUT_TYPE] = LayoutType.CoverLayout;
      coverLarge.AdditionalProperties[Consts.KEY_LAYOUT_SIZE] = LayoutSize.Large;
      _viewModeItemsList.Add(coverLarge);
    }
Exemplo n.º 14
0
    private bool TryGetAction(ListItem item, out SystemStateAction action)
    {
      action = SystemStateAction.Suspend;
      if (item == null)
        return false;

      object oIndex;
      if (item.AdditionalProperties.TryGetValue(Consts.KEY_INDEX, out oIndex))
      {
        int? i = oIndex as int?;
        if (i.HasValue)
        {
          action = ShutdownItemList[i.Value].Action;
          return true;
        }
      }
      return false;
    }
Exemplo n.º 15
0
 public ViewModeModel()
 {
     startupItems = new ItemsList();
     var startupStates = StartupStateSetting.StartupStates;
     foreach (string key in startupStates.Keys)
     {
         StartupState state = startupStates[key];
         if (state != StartupState.LASTUSED)
         {
             ListItem item = new ListItem(Consts.KEY_NAME, LocalizationHelper.CreateResourceString(key))
             {
                 Command = new MethodDelegateCommand(() => SetStartupState(state))
             };
             item.AdditionalProperties[KEY_STARTUP_STATE] = state;
             startupItems.Add(item);
         }
     }
 }
Exemplo n.º 16
0
 protected void UpdateSortingsList()
 {
   _sortingItemsList.Clear();
   NavigationData navigationData = GetCurrentNavigationData();
   ICollection<Sorting.Sorting> sortings = navigationData.AvailableSortings;
   if (sortings == null)
     return;
   foreach (Sorting.Sorting sorting in sortings)
   {
     Sorting.Sorting sortingCopy = sorting;
     ListItem sortingItem = new ListItem(Consts.KEY_NAME, sorting.DisplayName)
       {
           Command = new MethodDelegateCommand(() => navigationData.CurrentSorting = sortingCopy)
       };
     sortingItem.AdditionalProperties[Consts.KEY_SORTING] = sortingCopy;
     _sortingItemsList.Add(sortingItem);
   }
   _sortingItemsList.FireChange();
 }
Exemplo n.º 17
0
 protected void UpdateFiltersList()
 {
   _filterItemsList.Clear();
   NavigationData navigationData = GetCurrentNavigationData();
   IList<WorkflowAction> actions = navigationData.GetWorkflowActions();
   if (actions == null)
     return;
   foreach (WorkflowAction action in actions)
   {
     WorkflowAction actionCopy = action;
     ListItem screenItem = new ListItem(Consts.KEY_NAME, action.DisplayTitle)
       {
           Command = new MethodDelegateCommand(actionCopy.Execute)
       };
     screenItem.AdditionalProperties[Consts.KEY_FILTER] = actionCopy;
     _filterItemsList.Add(screenItem);
   }
   _filterItemsList.FireChange();
 }
 protected override void SettingChanged()
 {
   _items.Clear();
   ThemeConfigSetting themeSetting = (ThemeConfigSetting) _setting;
   foreach (Theme theme in themeSetting.Themes)
   {
     ListItem themeItem = new ListItem(KEY_NAME, theme.ShortDescription);
     themeItem.SetLabel(KEY_TECHNAME, theme.Name);
     ISkinResourceBundle resourceBundle;
     string preview = theme.GetResourceFilePath(theme.PreviewResourceKey, false, out resourceBundle);
     themeItem.SetLabel(KEY_IMAGESRC, preview);
     _items.Add(themeItem);
     if (themeSetting.CurrentThemeName == theme.Name)
     {
       themeItem.Selected = true;
       _choosenItem = themeItem;
     }
   }
   _items.FireChange();
   base.SettingChanged();
 }
        ItemsList CreatePossibleValuesList()
        {
            var result = new ItemsList();
            if (PropertyDescriptor.IsBool)
            {
                var item = new ListItem(Consts.KEY_NAME, new StringId("[System.Yes]")) { Selected = Value == true.ToString() };
                item.AdditionalProperties.Add(KEY_VALUE, true.ToString());
                result.Add(item);

                item = new ListItem(Consts.KEY_NAME, new StringId("[System.No]")) { Selected = Value == false.ToString() };
                item.AdditionalProperties.Add(KEY_VALUE, false.ToString());
                result.Add(item);
            }
            else if (PropertyDescriptor.IsEnum)
            {
                foreach (string e in PropertyDescriptor.GetEnumValues())
                {
                    var item = new ListItem(Consts.KEY_NAME, e) { Selected = Value == e };
                    item.AdditionalProperties.Add(KEY_VALUE, e);
                    result.Add(item);
                }
            }
            return result;
        }
Exemplo n.º 20
0
 public static void ShowLoadSkinDialog()
 {
   IScreenManager screenManager = ServiceRegistration.Get<IScreenManager>();
   SkinManager skinManager = ServiceRegistration.Get<ISkinResourceManager>() as SkinManager;
   if (skinManager == null)
     return;
   ItemsList skinItems = new ItemsList();
   foreach (Skin skin in skinManager.Skins.Values)
   {
     if (!skin.IsValid)
       continue;
     string skinName = skin.Name;
     ListItem skinItem = new ListItem(Consts.KEY_NAME, skinName)
       {
           Command = new MethodDelegateCommand(() => screenManager.SwitchSkinAndTheme(skinName, null))
       };
     skinItems.Add(skinItem);
   }
   ShowDialog(Consts.RES_LOAD_SKIN_TITLE, skinItems);
 }
Exemplo n.º 21
0
 public void Select(ListItem item)
 {
   ICommand command = item.Command;
   if (command != null)
     command.Execute();
 }
Exemplo n.º 22
0
 public static void ShowLoadThemeDialog()
 {
   IScreenManager screenManager = ServiceRegistration.Get<IScreenManager>();
   SkinManager skinManager = ServiceRegistration.Get<ISkinResourceManager>() as SkinManager;
   if (skinManager == null)
     return;
   string currentSkinName = screenManager.CurrentSkinResourceBundle.SkinName;
   Skin currentSkin;
   if (!skinManager.Skins.TryGetValue(currentSkinName, out currentSkin))
     return;
   ItemsList themeItems = new ItemsList();
   foreach (Theme theme in currentSkin.Themes.Values)
   {
     if (!theme.IsValid)
       continue;
     string themeName = theme.Name;
     ListItem themeItem = new ListItem(Consts.KEY_NAME, themeName)
       {
           Command = new MethodDelegateCommand(() => screenManager.SwitchSkinAndTheme(null, themeName))
       };
     themeItems.Add(themeItem);
   }
   ShowDialog(Consts.RES_LOAD_THEME_TITLE, themeItems);
 }
Exemplo n.º 23
0
 protected void UpdateShareImportState_NoLock(ListItem shareItem, bool isImporting)
 {
   shareItem.AdditionalProperties[Consts.KEY_IS_IMPORTING] = isImporting;
   shareItem.FireChange();
 }
Exemplo n.º 24
0
 protected void UpdateSharesList_NoLock(bool create)
 {
   lock (_syncObj)
     if (create)
       _sharesList = new ItemsList();
     else
       _sharesList.Clear();
   try
   {
     IServerConnectionManager scm = ServiceRegistration.Get<IServerConnectionManager>();
     IContentDirectory cd = scm.ContentDirectory;
     IServerController sc = scm.ServerController;
     if (cd == null || sc == null)
       return;
     IRemoteResourceInformationService rris = ServiceRegistration.Get<IRemoteResourceInformationService>();
     ICollection<Share> allShares = cd.GetShares(null, SharesFilter.All);
     IDictionary<string, ICollection<Share>> systems2Shares = new Dictionary<string, ICollection<Share>>();
     foreach (Share share in allShares)
     {
       ICollection<Share> systemShares;
       if (systems2Shares.TryGetValue(share.SystemId, out systemShares))
         systemShares.Add(share);
       else
         systems2Shares[share.SystemId] = new List<Share> { share };
     }
     ICollection<Guid> importingShares = cd.GetCurrentlyImportingShares() ?? new List<Guid>();
     ICollection<string> onlineSystems = sc.GetConnectedClients();
     onlineSystems = onlineSystems == null ? new List<string> { scm.HomeServerSystemId } : new List<string>(onlineSystems) { scm.HomeServerSystemId };
     foreach (KeyValuePair<string, ICollection<Share>> system2Shares in systems2Shares)
     {
       string systemId = system2Shares.Key;
       ICollection<Share> systemShares = system2Shares.Value;
       string systemName;
       string hostName;
       if (systemId == scm.HomeServerSystemId)
       {
         systemName = scm.LastHomeServerName;
         hostName = scm.LastHomeServerSystem.HostName;
       }
       else
       {
         MPClientMetadata clientMetadata = ServerCommunicationHelper.GetClientMetadata(systemId);
         if (clientMetadata == null)
         {
           systemName = null;
           hostName = null;
         }
         else
         {
           systemName = clientMetadata.LastClientName;
           hostName = clientMetadata.LastSystem.HostName;
         }
       }
       ListItem systemSharesItem = new ListItem(Consts.KEY_NAME, systemName);
       systemSharesItem.AdditionalProperties[Consts.KEY_SYSTEM] = systemId;
       systemSharesItem.AdditionalProperties[Consts.KEY_HOSTNAME] = hostName;
       bool isConnected = onlineSystems.Contains(systemId);
       systemSharesItem.AdditionalProperties[Consts.KEY_IS_CONNECTED] = isConnected;
       ItemsList sharesItemsList = new ItemsList();
       foreach (Share share in systemShares)
       {
         ListItem shareItem = new ListItem(Consts.KEY_NAME, share.Name);
         shareItem.AdditionalProperties[Consts.KEY_SHARE] = share;
         string resourcePathName;
         try
         {
           bool isFileSystemResource;
           bool isFile;
           string resourceName;
           DateTime lastChanged;
           long size;
           if (!rris.GetResourceInformation(share.SystemId, share.BaseResourcePath, out isFileSystemResource, out isFile, out resourcePathName, out resourceName, out lastChanged, out size))
             // Error case: The path is invalid
             resourcePathName = LocalizationHelper.Translate(Consts.RES_INVALID_PATH, share.BaseResourcePath);
         }
         catch (Exception) // NotConnectedException when remote system is not connected at all, UPnPDisconnectedException when remote system gets disconnected during the call
         {
           resourcePathName = share.BaseResourcePath.ToString();
         }
         shareItem.SetLabel(Consts.KEY_PATH, resourcePathName);
         string categories = StringUtils.Join(", ", share.MediaCategories);
         shareItem.SetLabel(Consts.KEY_MEDIA_CATEGORIES, categories);
         UpdateShareImportState_NoLock(shareItem, importingShares.Contains(share.ShareId));
         Share shareCopy = share;
         shareItem.Command = new MethodDelegateCommand(() => ReImportShare(shareCopy));
         shareItem.AdditionalProperties[Consts.KEY_REIMPORT_ENABLED] = isConnected;
         sharesItemsList.Add(shareItem);
       }
       systemSharesItem.AdditionalProperties[Consts.KEY_SYSTEM_SHARES] = sharesItemsList;
       lock (_syncObj)
         _sharesList.Add(systemSharesItem);
     }
   }
   finally
   {
     _sharesList.FireChange();
   }
 }
Exemplo n.º 25
0
 private static void Refresh(ItemsList list, ListItem item)
 {
     RefreshState(list);
     item.FireChange();
 }
Exemplo n.º 26
0
        private static void FillAllItemsList()
        {
            ClearItemsList();

            foreach (var s in CounList)
            {
                var item = new ListItem { AdditionalProperties = { [NAME] = s } };
                item.SetLabel("Name", "[Country." + s + "]");
                if (SelectedCountrys.Contains(s))
                {
                    item.Selected = true;
                }
                Countrys.Add(item);
            }
            Refresh(Countrys);

            foreach (var s in CityList)
            {
                var item = new ListItem { AdditionalProperties = { [NAME] = s } };
                item.SetLabel("Name", s);
                if (SelectedCitys.Contains(s))
                {
                    item.Selected = true;
                }
                Citys.Add(item);
            }
            Refresh(Citys);

            foreach (var s in BitrList)
            {
                var item = new ListItem { AdditionalProperties = { [NAME] = Convert.ToInt32(s) + " kbps" } };
                item.SetLabel("Name", Convert.ToInt32(s) + " kbps");
                if (SelectedBitrate.Contains(Convert.ToInt32(s) + " kbps"))
                {
                    item.Selected = true;
                }
                Bitrate.Add(item);
            }
            Refresh(Bitrate);

            foreach (var s in GenrList)
            {
                var item = new ListItem { AdditionalProperties = { [NAME] = s } };
                item.SetLabel("Name", s);
                if (SelectedGenres.Contains(s))
                {
                    item.Selected = true;
                }
                Genres.Add(item);
            }
            Refresh(Genres);
        }
Exemplo n.º 27
0
 public void ChangeGenre(ListItem item)
 {
     var s = (string)item.AdditionalProperties[NAME];
     if (SelectedGenres.Contains(s))
     {
         SelectedGenres.Remove(s);
         item.Selected = false;
     }
     else
     {
         SelectedGenres.Add(s);
         item.Selected = true;
     }
     SaveImage = "Unsaved.png";
     Refresh(Genres, item);
 }
Exemplo n.º 28
0
        public void ChangeCountry(ListItem item)
        {
            var s = (string)item.AdditionalProperties[NAME];
            if (SelectedCountrys.Contains(s))
            {
                SelectedCountrys.Remove(s);
                item.Selected = false;
            }
            else
            {
                SelectedCountrys.Add(s);
                item.Selected = true;
            }

            // Autofill Citys in selected Country
            if (SelectedCountrys.Count > 0)
            {
                var query = from r in StreamList where _contains(SelectedCountrys, r.Country) select r;
                foreach (var ms in query.Where(ms => !SelectedCitys.Contains(ms.City)))
                {
                    SelectedCitys.Add(ms.City);
                }

                foreach (var i in from i in Citys let si = (string)i.AdditionalProperties[NAME] where SelectedCitys.Contains(si) select i)
                {
                    i.Selected = true;
                    Refresh(Citys, i);
                }
            }
            SaveImage = "Unsaved.png";
            Refresh(Countrys, item);
        }
Exemplo n.º 29
0
 protected static ListItem CreateButtonListItem(string buttonText, Guid dialogHandle, DialogResult dialogResult,
     bool isDefault)
 {
   ListItem result = new ListItem(KEY_NAME, buttonText)
     {
         Command = new DialogResultCommand(dialogHandle, dialogResult)
     };
   if (isDefault)
     result.AdditionalProperties["IsDefault"] = true;
   return result;
 }
Exemplo n.º 30
0
 /// <summary>
 /// Creates a control in the given <paramref name="context"/>.
 /// </summary>
 /// <param name="context">ListItem, can be either "Channel" or "Program"</param>
 /// <returns>Control.</returns>
 private Control CreateControl(ListItem context)
 {
   Control btnEpg = new Control
   {
     LogicalParent = this,
     Context = context,
   };
   return btnEpg;
 }