public static List <AppInfo> LoadIcons(Canvas Parent) { List <AppInfo> AppsList = new List <AppInfo>(); if (File.Exists(SaveFiles.Location() + SaveFiles.AppInfoFile)) { string[] lines = File.ReadAllLines(SaveFiles.Location() + SaveFiles.AppInfoFile); foreach (string line in lines) { try { AppInfo app = new AppInfo(GetVariable("ShortCutLocation", line), GetVariable("ShortCutIcon", line)); Canvas.SetTop(app, int.Parse(GetVariable("Top", line))); Canvas.SetLeft(app, int.Parse(GetVariable("Left", line))); app.FileName.Text = GetVariable("Text", line); app.Parameters = GetVariable("Parameters", line); Parent.Children.Add(app); app.ParentCanvas = Parent; if (!app.IsThereisErrors) { AppsList.Add(app); } } catch (Exception) { } } } else { AppsList = Initialize(AppsList, Parent); } SaveIcons(AppsList); return(AppsList); }
public static void SaveMainWindowTheme(List <SettingsHolder> data, string FileName) { string[] Variable = new string[data.Count()]; int i = 0; foreach (SettingsHolder item in data) { Variable[i] = item.Name + "=\"" + item.Value + "\""; i++; } File.WriteAllLines(SaveFiles.Location() + FileName, Variable); }
public static void SaveGroupNames(List <TextBox> groupnames) { string[] lines = new string[groupnames.Count]; int i = 0; foreach (TextBox groupname in groupnames) { lines[i] += "Name=\"" + groupname.Name + "\"\t" + "Text=\"" + groupname.Text + "\""; i++; } File.WriteAllLines(SaveFiles.Location() + SaveFiles.ShortcutsGroupsNameFile, lines); }
//Shortcuts section public static void SaveShortcuts(List <ShortcutsSaveData> shortcuts) { string[] lines = new string[shortcuts.Count]; int i = 0; foreach (ShortcutsSaveData shortcut in shortcuts) { lines[i] += "Group=\"" + shortcut.ParentTile + "\"\t"; lines[i] += "Text=\"" + shortcut.item.FileName_beta.Text + "\"\t"; lines[i] += GetBasicInfo(shortcut.item); i++; } File.WriteAllLines(SaveFiles.Location() + SaveFiles.ShortcutsFile, lines); }
//AppInfo Section public static void SaveIcons(List <AppInfo> AppsList) { string[] lines = new string[AppsList.Count]; int i = 0; foreach (AppInfo app in AppsList) { lines[i] += "Top=\"" + Canvas.GetTop(app) + "\"\t"; lines[i] += "Left=\"" + Canvas.GetLeft(app) + "\"\t"; lines[i] += "Text=\"" + app.FileName.Text + "\"\t"; lines[i] += GetBasicInfo(app); i++; } File.WriteAllLines(SaveFiles.Location() + SaveFiles.AppInfoFile, lines); }
//check if the app opened for the first time public static bool IsFirstTime() { if (Directory.Exists(SaveFiles.Location())) { if (File.Exists(SaveFiles.Location() + SaveFiles.MainThemeFile)) { return(false); } else { return(true); } } else { Directory.CreateDirectory(SaveFiles.Location()); return(true); } }
public static List <TextBox> LoadGroupNames() { List <TextBox> GroupsNames = new List <TextBox>(); if (File.Exists(SaveFiles.Location() + SaveFiles.ShortcutsGroupsNameFile)) { string[] lines = File.ReadAllLines(SaveFiles.Location() + SaveFiles.ShortcutsGroupsNameFile); foreach (string line in lines) { try { TextBox tb = new TextBox(); tb.Name = GetVariable("Name", line); tb.Text = GetVariable("Text", line); GroupsNames.Add(tb); } catch (Exception) { } } } return(GroupsNames); }
public static List <ShortcutsSaveData> LoadShortcuts() { List <ShortcutsSaveData> shortcuts = new List <ShortcutsSaveData>(); if (File.Exists(SaveFiles.Location() + SaveFiles.ShortcutsFile)) { string[] lines = File.ReadAllLines(SaveFiles.Location() + SaveFiles.ShortcutsFile); foreach (string line in lines) { try { ShortcutItem app = new ShortcutItem(GetVariable("ShortCutLocation", line), GetVariable("ShortCutIcon", line)); app.FileName_beta.Text = GetVariable("Text", line); app.Parameters = GetVariable("Parameters", line); if (!app.IsThereisErrors) { shortcuts.Add(new ShortcutsSaveData(GetVariable("Group", line), app)); } } catch (Exception) { } } } return(shortcuts); }
public static void SetCustomTheme() { if (File.Exists((SaveFiles.Location() + SaveFiles.MainThemeFile))) { string ThemeFile = File.ReadAllText(SaveFiles.Location() + SaveFiles.MainThemeFile); try { AppTheme.Background = Data.GetVariable("MainAppBackground", ThemeFile); } catch (Exception) { } try { AppTheme.Foreground = Data.GetVariable("MainAppForeground", ThemeFile); } catch (Exception) { } try { AppTheme.NavBarBackground = Data.GetVariable("NavBarBackground", ThemeFile); } catch (Exception) { } try { AppTheme.NavBarForeground = Data.GetVariable("NavBarForeground", ThemeFile); } catch (Exception) { } try { AppTheme.NavBarHover = Data.GetVariable("NavBarHover", ThemeFile); } catch (Exception) { } try { AppTheme.NavBarActive = Data.GetVariable("NavBarActive", ThemeFile); } catch (Exception) { } try { AppTheme.ActiveItems = Data.GetVariable("ActiveItem", ThemeFile); } catch (Exception) { } try { AppTheme.Effects = Data.GetVariable("ItemsEffect", ThemeFile); } catch (Exception) { } } if (File.Exists(SaveFiles.Location() + SaveFiles.HomePageThemeFile)) { string HomePageThemeFile = File.ReadAllText(SaveFiles.Location() + SaveFiles.HomePageThemeFile); try { AppTheme.HomePageShortCutsHover = Data.GetVariable("ItemHover", HomePageThemeFile); } catch (Exception) { } try { AppTheme.HomePageShortCutFontColor = Data.GetVariable("HomePageFontColor", HomePageThemeFile); } catch (Exception) { } try { AppTheme.HomePageBackground = Data.GetVariable("HomePageBackground", HomePageThemeFile); } catch (Exception) { } try { AppTheme.HomePageVideoSound = Data.GetVariable("IsMuted", HomePageThemeFile); } catch (Exception) { } } }