public void LoadSettings(string section)
    {
      if (string.IsNullOrEmpty(section))
      {
        return;
      }

      using (Profile.Settings xmlreader = new MPSettings())
      {
        string defaultSharePath = string.Empty;

        switch (section)
        {
          case "movies":
            defaultSharePath = Win32API.GetFolderPath(Win32API.CSIDL_MYVIDEO);
            break;
          case "music":
            defaultSharePath = Win32API.GetFolderPath(Win32API.CSIDL_MYMUSIC);
            break;
          case "pictures":
            defaultSharePath = Win32API.GetFolderPath(Win32API.CSIDL_MYPICTURES);
            break;
        }

        DefaultShare = xmlreader.GetValueAsString(section, "default", "");
        _addOpticalDiskDrives = xmlreader.GetValueAsBool(section, "AddOpticalDiskDrives", true);
        _autoSwitchRemovableDrives = xmlreader.GetValueAsBool(section, "SwitchRemovableDrives", true);
        _rememberLastFolder = xmlreader.GetValueAsBool(section, "rememberlastfolder", false);

        // Shares
        for (int index = 0; index < 128; index++)
        {
          string shareName = String.Format("sharename{0}", index);
          string sharePath = String.Format("sharepath{0}", index);
          string sharePin = String.Format("pincode{0}", index);

          string shareType = String.Format("sharetype{0}", index);
          string shareServer = String.Format("shareserver{0}", index);
          string shareLogin = String.Format("sharelogin{0}", index);
          string sharePwd = String.Format("sharepassword{0}", index);
          string sharePort = String.Format("shareport{0}", index);
          string shareRemotePath = String.Format("shareremotepath{0}", index);
          string shareViewPath = String.Format("shareview{0}", index);

          string shareNameData = xmlreader.GetValueAsString(section, shareName, "");
          string sharePathData = xmlreader.GetValueAsString(section, sharePath, "");
          string sharePinData = Util.Utils.DecryptPassword(xmlreader.GetValueAsString(section, sharePin, ""));

          // provide default shares
          if (index == 0 && shareNameData == string.Empty)
          {
            shareNameData = VirtualDirectory.GetShareNameDefault(defaultSharePath);
            sharePathData = defaultSharePath;
            sharePinData = string.Empty;

            AddStaticShares(DriveType.DVD, "DVD");
          }

          bool shareTypeData = xmlreader.GetValueAsBool(section, shareType, false);
          string shareServerData = xmlreader.GetValueAsString(section, shareServer, "");
          string shareLoginData = xmlreader.GetValueAsString(section, shareLogin, "");
          string sharePwdData = Util.Utils.DecryptPassword(xmlreader.GetValueAsString(section, sharePwd, ""));
          int sharePortData = xmlreader.GetValueAsInt(section, sharePort, 21);
          string shareRemotePathData = xmlreader.GetValueAsString(section, shareRemotePath, "/");
          int shareLayout = xmlreader.GetValueAsInt(section, shareViewPath, (int)GUIFacadeControl.Layout.List);

          // For Music Shares, we can indicate, if we want to scan them every time
          bool shareScanData = false;
          if (section == "music" || section == "movies")
          {
            string shareScan = String.Format("sharescan{0}", index);
            shareScanData = xmlreader.GetValueAsBool(section, shareScan, true);
          }
          // For Movies Shares, we can indicate, if we want to create thumbs
          bool thumbs = true;
          bool folderIsMovie = false;
          if (section == "movies")
          {
            string thumbsCreate = String.Format("videothumbscreate{0}", index);
            thumbs = xmlreader.GetValueAsBool(section, thumbsCreate, true);
            string eachFolderIsMovie = String.Format("eachfolderismovie{0}", index);
            folderIsMovie = xmlreader.GetValueAsBool(section, eachFolderIsMovie, false);
          }

          if (!String.IsNullOrEmpty(shareNameData))
          {
            ShareData newShare = new ShareData(shareNameData, sharePathData, sharePinData, thumbs);
            newShare.IsRemote = shareTypeData;
            newShare.Server = shareServerData;
            newShare.LoginName = shareLoginData;
            newShare.PassWord = sharePwdData;
            newShare.Port = sharePortData;
            newShare.RemoteFolder = shareRemotePathData;
            newShare.DefaultLayout = (GUIFacadeControl.Layout)shareLayout;

            newShare.ScanShare = shareScanData;
            
            if (section == "movies")
            {
              newShare.CreateThumbs = thumbs;
              newShare.EachFolderIsMovie = folderIsMovie;
            }
            AddShare(newShare, shareNameData.Equals(DefaultShare));
          }
        }
        if (_addOpticalDiskDrives)
        {
          AddStaticShares(DriveType.DVD, "DVD");
        }
      }
    }
    protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
    {
      base.OnClicked(controlId, control, actionType);

      // Default folder (select/deselect on click) - settings saved
      if (control == videosShareListcontrol)
      {
        OnSetDefaultFolder();
      }
      // Add new folder
      if (control == btnAdd)
      {
        // reset menu position
        _selectedOption = -1;
        // reset folder browser
        ClearFolders();
        // Clear folder info
        ClearFolderInfoData();
        _userNetFolder = GUILocalizeStrings.Get(145); // Network

        // Show menu
        OnAddEditFolder();

        // Define new folder
        GUIListItem item = new GUIListItem();
        // Watch for last parameter (my version with selective thumbs will use that)
        ShareData shareData = new ShareData("", "", "", true);
        item.AlbumInfoTag = shareData;
        _shareFolderListItem = item;
        // Check new data
        CheckCurrentShareData();

        if (_error)
        {
          _error = false;
          GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
          dlgOk.SetHeading(257);
          dlgOk.SetLine(1, GUILocalizeStrings.Get(300053)); // Error in folder data
          dlgOk.SetLine(2, GUILocalizeStrings.Get(300054)); // Name or path couldn't be empty
          dlgOk.DoModal(GUIWindowManager.ActiveWindow);
          return;
        }

        // Prepare folder info data
        FolderInfo(_shareFolderListItem).DefaultLayout = SettingsSharesHelper.ProperLayoutFromDefault(_folderDefaultLayoutIndex);
        FolderInfo(_shareFolderListItem).Name = _folderName;
        FolderInfo(_shareFolderListItem).Folder = _folderPath;
        FolderInfo(_shareFolderListItem).CreateThumbs = _folderCreateThumbs;
        FolderInfo(_shareFolderListItem).EachFolderIsMovie = _folderEachFolderIsMovie;
        FolderInfo(_shareFolderListItem).PinCode = _folderPin;
        // Almost forgot this, needed for proper sort :)
        _shareFolderListItem.Label = _folderName;
        _shareFolderListItem.OnItemSelected += OnItemSelected;

        // Add new folder in list
        videosShareListcontrol.Add(_shareFolderListItem);
        GUIListItem newItem = _shareFolderListItem;
        Sort();
        int index = videosShareListcontrol.ListItems.IndexOf(newItem);
        videosShareListcontrol.SelectedListItemIndex = index;
      }
      // Edit folder
      if (control == btnEdit)
      {
        string name = _folderName;
        string path = _folderPath;

        // reset menu position
        _selectedOption = -1;

        OnAddEditFolder();

        // Check new data
        CheckCurrentShareData();

        if (_error)
        {
          _error = false;
          GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
          dlgOk.SetHeading(257);
          dlgOk.SetLine(1, GUILocalizeStrings.Get(300053)); // Error in folder data
          dlgOk.SetLine(2, GUILocalizeStrings.Get(300054)); // Name or path couldn't be empty
          dlgOk.DoModal(GUIWindowManager.ActiveWindow);
          _folderName = name;
          _folderPath = path;
          return;
        }
        
        // Update changes
        FolderInfo(_shareFolderListItem).Name = _folderName;
        _shareFolderListItem.Label = _folderName;
        FolderInfo(_shareFolderListItem).Folder = _folderPath;
        FolderInfo(_shareFolderListItem).PinCode = _folderPin;
        FolderInfo(_shareFolderListItem).CreateThumbs = _folderCreateThumbs;
        FolderInfo(_shareFolderListItem).EachFolderIsMovie = _folderEachFolderIsMovie;
        FolderInfo(_shareFolderListItem).DefaultLayout = SettingsSharesHelper.ProperLayoutFromDefault(_folderDefaultLayoutIndex);
        // Add changes to a listitem
        videosShareListcontrol.SelectedListItem.AlbumInfoTag = _shareFolderListItem.AlbumInfoTag;
        videosShareListcontrol.SelectedListItem.Label = _folderName;
        // Sort list
        GUIListItem newItem = _shareFolderListItem;
        Sort();
        int index = videosShareListcontrol.ListItems.IndexOf(newItem);
        videosShareListcontrol.SelectedListItemIndex = index;
      }
      // Remove folder - settings saved
      if (control == btnRemove)
      {
        OnRemoveFolder();
      }
      // Reset folders - settings saved
      if (control == btnReset)
      {
        GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO);
        if (dlgYesNo != null)
        {
          dlgYesNo.SetHeading(GUILocalizeStrings.Get(927)); // Warning
          dlgYesNo.SetLine(1, GUILocalizeStrings.Get(300055)); // this will delete folders
          dlgYesNo.DoModal(GetID);

          if (dlgYesNo.IsConfirmed)
          {
            OnResetFolders();
          }
        }
      }
    }
    private void AddShare(ShareData shareData, bool check)
    {
      GUIListItem listItem = new GUIListItem();
      listItem.Label = shareData.Name;
      //listItem.Label3 = shareData.HasPinCode ? "Yes" : "No";
      listItem.Path = shareData.Folder;
      listItem.AlbumInfoTag = shareData; // Store full data


      if (shareData.IsRemote)
      {
        listItem.Path = String.Format("ftp://{0}:{1}{2}", shareData.Server, shareData.Port,
                                                  shareData.RemoteFolder);
      }
      // Default share
      listItem.IsPlayed = check;
      
      _shareListControl.Add(listItem);
    }
示例#4
0
        private ShareData FolderInfo(GUIListItem item)
        {
            ShareData folderInfo = item.AlbumInfoTag as ShareData;

            return(folderInfo);
        }
示例#5
0
        public void SaveSettings(string section)
        {
            if (AddOpticalDiskDrives)
            {
                AddStaticShares(DriveType.DVD, "DVD");
            }

            using (Profile.Settings xmlwriter = new MPSettings())
            {
                string defaultShare = string.Empty;

                for (int index = 0; index < 128; index++)
                {
                    string shareName       = String.Format("sharename{0}", index);
                    string sharePath       = String.Format("sharepath{0}", index);
                    string sharePin        = String.Format("pincode{0}", index);
                    string shareType       = String.Format("sharetype{0}", index);
                    string shareServer     = String.Format("shareserver{0}", index);
                    string shareLogin      = String.Format("sharelogin{0}", index);
                    string sharePwd        = String.Format("sharepassword{0}", index);
                    string sharePort       = String.Format("shareport{0}", index);
                    string shareRemotePath = String.Format("shareremotepath{0}", index);
                    string shareViewPath   = String.Format("shareview{0}", index);

                    xmlwriter.RemoveEntry(section, shareName);
                    xmlwriter.RemoveEntry(section, sharePath);
                    xmlwriter.RemoveEntry(section, sharePin);
                    xmlwriter.RemoveEntry(section, shareType);
                    xmlwriter.RemoveEntry(section, shareServer);
                    xmlwriter.RemoveEntry(section, shareLogin);
                    xmlwriter.RemoveEntry(section, sharePwd);
                    xmlwriter.RemoveEntry(section, sharePort);
                    xmlwriter.RemoveEntry(section, shareRemotePath);
                    xmlwriter.RemoveEntry(section, shareViewPath);

                    if (section == "music" || section == "movies")
                    {
                        string shareScan = String.Format("sharescan{0}", index);
                        xmlwriter.RemoveEntry(section, shareScan);
                    }

                    if (section == "movies")
                    {
                        string thumbs = String.Format("videothumbscreate{0}", index);
                        xmlwriter.RemoveEntry(section, thumbs);

                        string movieFolder = String.Format("eachfolderismovie{0}", index);
                        xmlwriter.RemoveEntry(section, movieFolder);
                    }

                    string shareNameData       = string.Empty;
                    string sharePathData       = string.Empty;
                    string sharePinData        = string.Empty;
                    bool   shareTypeData       = false;
                    string shareServerData     = string.Empty;
                    string shareLoginData      = string.Empty;
                    string sharePwdData        = string.Empty;
                    int    sharePortData       = 21;
                    string shareRemotePathData = string.Empty;
                    int    shareLayout         = (int)MediaPortal.GUI.Library.GUIFacadeControl.Layout.List;
                    bool   shareScanData       = false;
                    //ThumbsCreate (default true)
                    bool thumbsCreate  = true;
                    bool folderIsMovie = false;

                    if (_shareListControl != null && _shareListControl.Count > index)
                    {
                        ShareData shareData = _shareListControl[index].AlbumInfoTag as ShareData;

                        if (shareData != null && !String.IsNullOrEmpty(shareData.Name))
                        {
                            shareNameData       = shareData.Name;
                            sharePathData       = shareData.Folder;
                            sharePinData        = shareData.PinCode;
                            shareTypeData       = shareData.IsRemote;
                            shareServerData     = shareData.Server;
                            shareLoginData      = shareData.LoginName;
                            sharePwdData        = shareData.PassWord;
                            sharePortData       = shareData.Port;
                            shareRemotePathData = shareData.RemoteFolder;
                            shareLayout         = (int)shareData.DefaultLayout;
                            shareScanData       = shareData.ScanShare;
                            // ThumbsCreate
                            thumbsCreate  = shareData.CreateThumbs;
                            folderIsMovie = shareData.EachFolderIsMovie;

                            if (shareNameData == _defaultShare)
                            {
                                defaultShare = shareNameData;
                            }

                            xmlwriter.SetValue(section, shareName, shareNameData);
                            xmlwriter.SetValue(section, sharePath, sharePathData);
                            xmlwriter.SetValue(section, sharePin, Util.Utils.EncryptPin(sharePinData));
                            xmlwriter.SetValueAsBool(section, shareType, shareTypeData);
                            xmlwriter.SetValue(section, shareServer, shareServerData);
                            xmlwriter.SetValue(section, shareLogin, shareLoginData);
                            xmlwriter.SetValue(section, sharePwd, sharePwdData);
                            xmlwriter.SetValue(section, sharePort, sharePortData.ToString());
                            xmlwriter.SetValue(section, shareRemotePath, shareRemotePathData);
                            xmlwriter.SetValue(section, shareViewPath, shareLayout);

                            if (section == "music" || section == "movies")
                            {
                                string shareScan = String.Format("sharescan{0}", index);
                                xmlwriter.SetValueAsBool(section, shareScan, shareScanData);
                            }

                            if (section == "movies")
                            {
                                string thumbs = String.Format("videothumbscreate{0}", index);
                                xmlwriter.SetValueAsBool(section, thumbs, thumbsCreate);

                                string folderMovie = String.Format("eachfolderismovie{0}", index);
                                xmlwriter.SetValueAsBool(section, folderMovie, folderIsMovie);
                            }
                        }
                    }
                }
                xmlwriter.SetValue(section, "default", defaultShare);
                xmlwriter.SetValueAsBool(section, "rememberlastfolder", RememberLastFolder);
                xmlwriter.SetValueAsBool(section, "AddOpticalDiskDrives", AddOpticalDiskDrives);
                xmlwriter.SetValueAsBool(section, "SwitchRemovableDrives", SwitchRemovableDrives);
            }
            // Set new shares for internal plugins
            switch (section)
            {
            case "movies":
                GUIVideoFiles.ResetShares();
                break;

            case "music":
                GUIMusicFiles.ResetShares();
                break;

            case "pictures":
                GUIPictures.ResetShares();
                break;
            }
        }
示例#6
0
        public void LoadSettings(string section)
        {
            if (string.IsNullOrEmpty(section))
            {
                return;
            }

            using (Profile.Settings xmlreader = new MPSettings())
            {
                string defaultSharePath = string.Empty;

                switch (section)
                {
                case "movies":
                    defaultSharePath = Win32API.GetFolderPath(Win32API.CSIDL_MYVIDEO);
                    break;

                case "music":
                    defaultSharePath = Win32API.GetFolderPath(Win32API.CSIDL_MYMUSIC);
                    break;

                case "pictures":
                    defaultSharePath = Win32API.GetFolderPath(Win32API.CSIDL_MYPICTURES);
                    break;
                }

                DefaultShare               = xmlreader.GetValueAsString(section, "default", "");
                _addOpticalDiskDrives      = xmlreader.GetValueAsBool(section, "AddOpticalDiskDrives", true);
                _autoSwitchRemovableDrives = xmlreader.GetValueAsBool(section, "SwitchRemovableDrives", true);
                _rememberLastFolder        = xmlreader.GetValueAsBool(section, "rememberlastfolder", false);

                // Shares
                for (int index = 0; index < 128; index++)
                {
                    string shareName = String.Format("sharename{0}", index);
                    string sharePath = String.Format("sharepath{0}", index);
                    string sharePin  = String.Format("pincode{0}", index);

                    string shareType       = String.Format("sharetype{0}", index);
                    string shareServer     = String.Format("shareserver{0}", index);
                    string shareLogin      = String.Format("sharelogin{0}", index);
                    string sharePwd        = String.Format("sharepassword{0}", index);
                    string sharePort       = String.Format("shareport{0}", index);
                    string shareRemotePath = String.Format("shareremotepath{0}", index);
                    string shareViewPath   = String.Format("shareview{0}", index);

                    string shareNameData = xmlreader.GetValueAsString(section, shareName, "");
                    string sharePathData = xmlreader.GetValueAsString(section, sharePath, "");
                    string sharePinData  = Util.Utils.DecryptPin(xmlreader.GetValueAsString(section, sharePin, ""));

                    // provide default shares
                    if (index == 0 && shareNameData == string.Empty)
                    {
                        shareNameData = VirtualDirectory.GetShareNameDefault(defaultSharePath);
                        sharePathData = defaultSharePath;
                        sharePinData  = string.Empty;

                        AddStaticShares(DriveType.DVD, "DVD");
                    }

                    bool   shareTypeData       = xmlreader.GetValueAsBool(section, shareType, false);
                    string shareServerData     = xmlreader.GetValueAsString(section, shareServer, "");
                    string shareLoginData      = xmlreader.GetValueAsString(section, shareLogin, "");
                    string sharePwdData        = xmlreader.GetValueAsString(section, sharePwd, "");
                    int    sharePortData       = xmlreader.GetValueAsInt(section, sharePort, 21);
                    string shareRemotePathData = xmlreader.GetValueAsString(section, shareRemotePath, "/");
                    int    shareLayout         = xmlreader.GetValueAsInt(section, shareViewPath, (int)GUIFacadeControl.Layout.List);

                    // For Music Shares, we can indicate, if we want to scan them every time
                    bool shareScanData = false;
                    if (section == "music" || section == "movies")
                    {
                        string shareScan = String.Format("sharescan{0}", index);
                        shareScanData = xmlreader.GetValueAsBool(section, shareScan, true);
                    }
                    // For Movies Shares, we can indicate, if we want to create thumbs
                    bool thumbs        = true;
                    bool folderIsMovie = false;
                    if (section == "movies")
                    {
                        string thumbsCreate = String.Format("videothumbscreate{0}", index);
                        thumbs = xmlreader.GetValueAsBool(section, thumbsCreate, true);
                        string eachFolderIsMovie = String.Format("eachfolderismovie{0}", index);
                        folderIsMovie = xmlreader.GetValueAsBool(section, eachFolderIsMovie, false);
                    }

                    if (!String.IsNullOrEmpty(shareNameData))
                    {
                        ShareData newShare = new ShareData(shareNameData, sharePathData, sharePinData, thumbs);
                        newShare.IsRemote      = shareTypeData;
                        newShare.Server        = shareServerData;
                        newShare.LoginName     = shareLoginData;
                        newShare.PassWord      = sharePwdData;
                        newShare.Port          = sharePortData;
                        newShare.RemoteFolder  = shareRemotePathData;
                        newShare.DefaultLayout = (GUIFacadeControl.Layout)shareLayout;

                        newShare.ScanShare = shareScanData;

                        if (section == "movies")
                        {
                            newShare.CreateThumbs      = thumbs;
                            newShare.EachFolderIsMovie = folderIsMovie;
                        }
                        AddShare(newShare, shareNameData.Equals(DefaultShare));
                    }
                }
                if (_addOpticalDiskDrives)
                {
                    AddStaticShares(DriveType.DVD, "DVD");
                }
            }
        }
示例#7
0
        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {
            base.OnClicked(controlId, control, actionType);

            // Default folder (select/deselect on click) - settings saved
            if (control == videosShareListcontrol)
            {
                OnSetDefaultFolder();
            }
            // Add new folder
            if (control == btnAdd)
            {
                // reset menu position
                _selectedOption = -1;
                // reset folder browser
                ClearFolders();
                // Clear folder info
                ClearFolderInfoData();
                _userNetFolder = GUILocalizeStrings.Get(145); // Network

                // Show menu
                OnAddEditFolder();

                // Define new folder
                GUIListItem item = new GUIListItem();
                // Watch for last parameter (my version with selective thumbs will use that)
                ShareData shareData = new ShareData("", "", "", true);
                item.AlbumInfoTag    = shareData;
                _shareFolderListItem = item;
                // Check new data
                CheckCurrentShareData();

                if (_error)
                {
                    _error = false;
                    GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
                    dlgOk.SetHeading(257);
                    dlgOk.SetLine(1, GUILocalizeStrings.Get(300053)); // Error in folder data
                    dlgOk.SetLine(2, GUILocalizeStrings.Get(300054)); // Name or path couldn't be empty
                    dlgOk.DoModal(GUIWindowManager.ActiveWindow);
                    return;
                }

                // Prepare folder info data
                FolderInfo(_shareFolderListItem).DefaultLayout     = SettingsSharesHelper.ProperLayoutFromDefault(_folderDefaultLayoutIndex);
                FolderInfo(_shareFolderListItem).Name              = _folderName;
                FolderInfo(_shareFolderListItem).Folder            = _folderPath;
                FolderInfo(_shareFolderListItem).CreateThumbs      = _folderCreateThumbs;
                FolderInfo(_shareFolderListItem).EachFolderIsMovie = _folderEachFolderIsMovie;
                FolderInfo(_shareFolderListItem).PinCode           = _folderPin;
                // Almost forgot this, needed for proper sort :)
                _shareFolderListItem.Label           = _folderName;
                _shareFolderListItem.OnItemSelected += OnItemSelected;

                // Add new folder in list
                videosShareListcontrol.Add(_shareFolderListItem);
                GUIListItem newItem = _shareFolderListItem;
                Sort();
                int index = videosShareListcontrol.ListItems.IndexOf(newItem);
                videosShareListcontrol.SelectedListItemIndex = index;
            }
            // Edit folder
            if (control == btnEdit)
            {
                string name = _folderName;
                string path = _folderPath;

                // reset menu position
                _selectedOption = -1;

                OnAddEditFolder();

                // Check new data
                CheckCurrentShareData();

                if (_error)
                {
                    _error = false;
                    GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
                    dlgOk.SetHeading(257);
                    dlgOk.SetLine(1, GUILocalizeStrings.Get(300053)); // Error in folder data
                    dlgOk.SetLine(2, GUILocalizeStrings.Get(300054)); // Name or path couldn't be empty
                    dlgOk.DoModal(GUIWindowManager.ActiveWindow);
                    _folderName = name;
                    _folderPath = path;
                    return;
                }

                // Update changes
                FolderInfo(_shareFolderListItem).Name              = _folderName;
                _shareFolderListItem.Label                         = _folderName;
                FolderInfo(_shareFolderListItem).Folder            = _folderPath;
                FolderInfo(_shareFolderListItem).PinCode           = _folderPin;
                FolderInfo(_shareFolderListItem).CreateThumbs      = _folderCreateThumbs;
                FolderInfo(_shareFolderListItem).EachFolderIsMovie = _folderEachFolderIsMovie;
                FolderInfo(_shareFolderListItem).DefaultLayout     = SettingsSharesHelper.ProperLayoutFromDefault(_folderDefaultLayoutIndex);
                // Add changes to a listitem
                videosShareListcontrol.SelectedListItem.AlbumInfoTag = _shareFolderListItem.AlbumInfoTag;
                videosShareListcontrol.SelectedListItem.Label        = _folderName;
                // Sort list
                GUIListItem newItem = _shareFolderListItem;
                Sort();
                int index = videosShareListcontrol.ListItems.IndexOf(newItem);
                videosShareListcontrol.SelectedListItemIndex = index;
            }
            // Remove folder - settings saved
            if (control == btnRemove)
            {
                OnRemoveFolder();
            }
            // Reset folders - settings saved
            if (control == btnReset)
            {
                GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO);
                if (dlgYesNo != null)
                {
                    dlgYesNo.SetHeading(GUILocalizeStrings.Get(927));    // Warning
                    dlgYesNo.SetLine(1, GUILocalizeStrings.Get(300055)); // this will delete folders
                    dlgYesNo.DoModal(GetID);

                    if (dlgYesNo.IsConfirmed)
                    {
                        OnResetFolders();
                    }
                }
            }
        }