Exemple #1
0
 private void setStyles()
 {
     background.Background     = Styles.theme();
     aTitle.Foreground         = Styles.text();
     aDescription.Foreground   = Styles.text();
     appFunctionTXT.Foreground = Styles.text();
     appFunction.Background    = Styles.accent();
     //moreOptionsTXT.Foreground = Styles.text();
 }
 private void setStyles()
 {
     windowTitle.Foreground   = Styles.text();
     titleBar.Background      = Styles.accent();
     windowBorder.BorderBrush = Styles.accent();
     messageBox.Foreground    = Styles.text();
     messageBox.CaretBrush    = Styles.text();
     background.Background    = Styles.theme();
     btnYes.Background        = Styles.button();
     btnCancel.Background     = Styles.button();
     btnNo.Background         = Styles.button();
     btnOk.Background         = Styles.button();
     btnYes.Foreground        = Styles.text();
     btnCancel.Foreground     = Styles.text();
     btnNo.Foreground         = Styles.text();
     btnOk.Foreground         = Styles.text();
 }
 public NotificationBox(string text, string title, int time)
 {
     InitializeComponent();
     windowBorder.Visibility  = Visibility.Visible;
     background.Background    = Styles.theme();
     nTitle.Foreground        = Styles.text();
     nBody.Foreground         = Styles.text();
     backBTN.Foreground       = Styles.text();
     windowBorder.BorderBrush = Styles.accent();
     Left                   = SystemParameters.WorkArea.Width - Width - 10;
     Top                    = SystemParameters.WorkArea.Height - Height - 10;
     nTitle.Content         = title;
     nBody.Text             = text;
     timeOpen               = time;
     timeTillClose.Interval = 1000;
     timeTillClose.Tick    += TimeTillClose_Tick;
     timeTillClose.Start();
     Visibility = Visibility.Visible;
     Activate();
 }
        private void getApps()
        {
            Task.Run(async() =>
            {
                if (AppLibaryWindow.startupArgs.Contains("noupdate"))
                {
                    getOfflineModeApps();
                }
                else
                {
                    try
                    {
                        IReadOnlyList <Octokit.Repository> repos = await httpGit.githubClient.Repository.GetAllForUser("kOFReadie");
                        foreach (Octokit.Repository repo in repos)
                        {
                            try
                            {
                                HttpResponseMessage response = await httpGit.httpClient.GetAsync
                                                                   ($"https://raw.githubusercontent.com/kOFReadie/{repo.Name}/master/AppInfo.json");
                                response.EnsureSuccessStatusCode();
                                try
                                {
                                    string responseContent = await response.Content.ReadAsStringAsync();
                                    appDataInfo.Add(JsonConvert.DeserializeObject <List <appData> >(responseContent)[0]);
                                }
                                catch (Exception ex) { msgBox.Show("Failed to get app information"); LogWriter.CreateLog(ex); }
                            }
                            catch { continue; }
                        }
                    }
                    catch (Exception ex)
                    {
                        LogWriter.CreateLog(ex);
                        getOfflineModeApps();
                        msgBox.Show("Failed to get apps. Attempting to run in offline mode.\nError written to log file.");
                    }
                }
            }).Wait();

            if (appDataInfo == null)
            {
                msgBox.Show("Failed to get installed apps, no apps found.\nThis app will now close."); Environment.Exit(0);
            }
            foreach (var appInfo in appDataInfo)
            {
                if (appInfo.show == true || AppLibaryWindow.startupArgs.Contains("showall"))
                {
                    string   aNameSub = string.Empty;
                    string[] sName    = appInfo.appName.Split(' ');
                    foreach (string s in sName)
                    {
                        aNameSub = aNameSub + s;
                    }

                    Grid appTilePlate = new Grid();
                    appTilePlate.Width = 105;
                    appTilePlate.HorizontalAlignment = HorizontalAlignment.Left;
                    appTilePlate.VerticalAlignment   = VerticalAlignment.Top;
                    appTilePlate.Tag        = appInfo.appName;
                    appTilePlate.Margin     = new Thickness(5, 5, 5, 5);
                    appTilePlate.MouseDown += appPage;

                    ProgressBar progressBar = new ProgressBar();
                    progressBar.Visibility  = Visibility.Hidden;
                    progressBar.Background  = null;
                    progressBar.BorderBrush = null;
                    progressBar.Foreground  = Styles.accent();
                    progressBar.Tag         = $"pg{appInfo.appName}";

                    WrapPanel appTile = new WrapPanel();
                    appTile.Tag         = appInfo.appName;
                    appTile.Orientation = Orientation.Vertical;
                    appTile.MouseLeave += appTile_MouseLeave;
                    appTile.MouseEnter += appTile_MouseEnter;

                    #region App Icon
                    BitmapImage appIconImage = new BitmapImage();
                    appIconImage.BeginInit();
                    appIconImage.StreamSource = new MemoryStream(Convert.FromBase64String(appInfo.icon));
                    appIconImage.EndInit();

                    Image appIcon = new Image();
                    appIcon.Height = 100;
                    appIcon.Width  = 100;
                    appIcon.Margin = new Thickness(2.5, 0, 0, 0);
                    appIcon.Source = appIconImage;
                    #endregion

                    TextBlock appName = new TextBlock();
                    appName.FontWeight   = FontWeights.Bold;
                    appName.Margin       = new Thickness(5, 0, 0, 0);
                    appName.FontSize     = 14;
                    appName.TextWrapping = TextWrapping.Wrap;
                    if (appInfo.appName.Length > 12)
                    {
                        appName.Text = appInfo.appName.Substring(0, 12) + "...";
                    }
                    else
                    {
                        appName.Text = appInfo.appName;
                    }
                    appName.Foreground = Styles.text();

                    string installStatus;
                    if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + $"\\{aNameSub}\\{aNameSub}.dll"))
                    {
                        installStatus = "Installed";
                    }
                    else
                    {
                        installStatus = "Install";
                    }

                    Label statusText = new Label();
                    statusText.FontSize   = 11;
                    statusText.Margin     = new Thickness(0, -5, 0, 0);
                    statusText.Content    = installStatus;
                    statusText.Foreground = Styles.text();
                    statusText.Tag        = appInfo.appName.ToLower().Replace(" ", "");

                    #region Tile Assembly
                    appTile.Children.Add(appIcon);
                    appTile.Children.Add(appName);
                    appTile.Children.Add(statusText);

                    appTilePlate.Children.Add(progressBar);
                    appTilePlate.Children.Add(appTile);
                    appTilesPane.Children.Insert(0, appTilePlate);
                    #endregion

                    appTiles.Add(appTilePlate);
                    wrapPanels.Add(appTile);
                    progressBars.Add(progressBar);
                    statusTexts.Add(statusText);
                }
            }
        }
Exemple #5
0
        public Home()
        {
            InitializeComponent();
            try
            {
                background.Background = Styles.theme();
                appName.Foreground    = Styles.text();
                appVersion.Foreground = Styles.text();
                appNameLine.Stroke    = Styles.gBWHorizontal;
                string[] appVersionSS = FileVersionInfo.GetVersionInfo(AppDomain.CurrentDomain.BaseDirectory + "kOFRRepo.dll").FileVersion.Split('.');
                appVersion.Text = $"v{appVersionSS[0]}.{appVersionSS[1]}.{appVersionSS[2]}";

                List <notices> noticesInfo = JsonConvert.DeserializeObject <List <notices> >(AppLibaryWindow.updateInfoJSON);
                foreach (var noticeData in noticesInfo)
                {
                    if (noticeData.show == true || AppLibaryWindow.startupArgs.Contains("showall"))
                    {
                        Grid grid = new Grid();
                        grid.Margin = new Thickness(15, 15, 0, 0);
                        grid.Width  = 175;
                        grid.Height = 210;

                        Rectangle rectangle = new Rectangle();
                        rectangle.Fill    = Styles.button();
                        rectangle.RadiusX = 10;
                        rectangle.RadiusY = 10;

                        WrapPanel wrappanel = new WrapPanel();
                        wrappanel.Width               = 175;
                        wrappanel.Orientation         = Orientation.Vertical;
                        wrappanel.HorizontalAlignment = HorizontalAlignment.Left;
                        wrappanel.VerticalAlignment   = VerticalAlignment.Top;

                        TextBlock Title = new TextBlock();
                        Title.Margin       = new Thickness(10, 10, 0, 0);
                        Title.Width        = 155;
                        Title.TextWrapping = TextWrapping.Wrap;
                        Title.Text         = noticeData.title;
                        Title.FontFamily   = new FontFamily("Century Gothic");
                        Title.FontSize     = 18;
                        Title.Foreground   = Styles.text();

                        TextBlock body = new TextBlock();
                        body.Margin       = new Thickness(10, 5, 0, 0);
                        body.Width        = 155;
                        body.Height       = double.NaN;
                        body.TextWrapping = TextWrapping.Wrap;
                        body.Text         = noticeData.body;
                        body.FontFamily   = new FontFamily("Century Gothic");
                        body.FontSize     = 12;
                        body.Foreground   = Styles.text();

                        wrappanel.Children.Add(Title);
                        wrappanel.Children.Add(body);
                        grid.Children.Add(rectangle);
                        grid.Children.Add(wrappanel);
                        updateWrapPanel.Children.Insert(0, grid);
                    }
                }
            }
            catch (Exception ex) { LogWriter.CreateLog(ex); msgBox.Show("Failed to get alerts from server."); }
        }