Exemple #1
0
        public Grid createHistoryElementList(DailyAchievements dailyAchievements)
        {
            String name = AchievementManager.DateToString(dailyAchievements.date);

            Grid grid = new Grid();

            grid.MouseLeftButtonDown += Grid_MouseLeftButtonDown;
            grid.HorizontalAlignment  = HorizontalAlignment.Stretch;
            grid.VerticalAlignment    = VerticalAlignment.Top;
            grid.Height = 60;

            Label label = new Label();

            label.Width = 180;
            label.HorizontalAlignment = HorizontalAlignment.Left;
            label.Content             = name;
            label.Name     = "dateName";
            label.Style    = myResourceDictionary["LabelStyle"] as Style;
            label.FontSize = 20;
            label.Margin   = new Thickness(0, 10, 0, 0);
            grid.Children.Add(label);

            Label achivementLabel = new Label();

            achivementLabel.HorizontalAlignment = HorizontalAlignment.Right;
            achivementLabel.Style    = myResourceDictionary["LabelStyle"] as Style;
            achivementLabel.FontSize = 20;
            achivementLabel.Name     = "achivementLabel";
            achivementLabel.Margin   = new Thickness(0, 10, 0, 0);
            grid.Children.Add(achivementLabel);
            refreshDailyAchivement(dailyAchievements, grid);

            return(grid);
        }
 public static void SaveAchievement(string FileName, DailyAchievements dailyAchievements)
 {
     using (var writer = new System.IO.StreamWriter(FileName))
     {
         var serializer = new XmlSerializer(dailyAchievements.GetType());
         serializer.Serialize(writer, dailyAchievements);
         writer.Flush();
     }
 }
Exemple #3
0
        public void refreshDailyAchivement(DateTime date)
        {
            DailyAchievements dailyAchievements = AchievementManager.LoadAchievementl(date);
            Grid grid = ListOfDailyAchivements.Find(x =>
                                                    ((Label)LogicalTreeHelper.FindLogicalNode(x, "dateName")).Content.ToString().Equals(AchievementManager.DateToString(dailyAchievements.date))
                                                    );

            refreshDailyAchivement(dailyAchievements, grid);
        }
Exemple #4
0
 public static Dictionary <string, string> GetDailyMessageDataAsync(DailyAchievements dailies, List <Achievement> achievements)
 {
     return(new Dictionary <string, string>()
     {
         { "PvE", GetAchievementDatas(dailies.PVE, achievements) },
         { "PvP", GetAchievementDatas(dailies.PVP, achievements) },
         { "WvW", GetAchievementDatas(dailies.WVW, achievements) },
         { "Fractals", GetAchievementDatas(dailies.Fractals, achievements) },
         { "Special", GetAchievementDatas(dailies.Special, achievements) },
     });
 }
        public formDailies(Form parent)
        {
            InitializeComponent();

            SetStyle(ControlStyles.ResizeRedraw, true);

            this.parent     = parent;
            this.KeyPreview = true;

            alignment = HorizontalAlignment.Right;

            fontBar         = new System.Drawing.Font("Segoe UI Semibold", 9.75f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            fontName        = new System.Drawing.Font("Segoe UI Semibold", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            fontDescription = new System.Drawing.Font("Segoe UI Semilight", 8.25f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

            padding = (parent.Width - parent.ClientSize.Width) / 2;
            if (padding > 5)
            {
                padding = 0;
            }
            else
            {
                padding = 5;
            }

            imageDefault = Properties.Resources.icon42684;

            da      = new DailyAchievements();
            dailies = new DailyAchievements.Dailies[3];

            popup       = new Popup(imageDefault);
            popup.Owner = this;

            buttonMinimize.ForeColorHovered = Util.Color.Darken(SystemColors.GrayText, 0.5f);

            panelContainer.MouseWheel += panelContainer_MouseWheel;
            panelContainer.MouseHover += panelContainer_MouseHover;
            this.MouseWheel           += panelContainer_MouseWheel;

            Settings.ShowDailies.ValueChanged += Settings_ValueChanged;
            Settings_ValueChanged(Settings.ShowDailies, EventArgs.Empty);

            if (Settings.ShowDailies.Value.HasFlag(Settings.DailiesMode.AutoLoad))
            {
                SelectTab(DailyType.Today);
            }
            else
            {
                loadOnShow = true;
            }
        }
        public DailyAchievement(DateTime date, MainWindow mainWindow)
        {
            this.mainWindow = mainWindow;
            InitializeComponent();
            WindowEnricher.enrichWindow(this);
            this.dailyAchievement = AchievementManager.LoadAchievementl(date);

            for (int i = 0; i < dailyAchievement.achievements.Count; i++)
            {
                Grid newElement = createAchivementElementList(dailyAchievement.achievements[i]);
                ListOfAchivements.Add(newElement);
                this.AchievementsListGrid.Children.Add(newElement);
            }
            updateVerticalPositionOfListElements();
        }
        public static DailyAchievements LoadAchievementl(DateTime date)
        {
            String            fileName = "achievements/" + DateToString(date) + ".xml";
            DailyAchievements dailyAchievements;

            if (File.Exists(fileName))
            {
                using (var stream = System.IO.File.OpenRead(fileName))
                {
                    var serializer = new XmlSerializer(typeof(DailyAchievements));
                    dailyAchievements = serializer.Deserialize(stream) as DailyAchievements;
                }
            }
            else
            {
                dailyAchievements              = new DailyAchievements();
                dailyAchievements.date         = date;
                dailyAchievements.achievements = new List <Achievement.Achievement>();
            }
            return(dailyAchievements);
        }
Exemple #8
0
        public void refreshDailyAchivement(DailyAchievements dailyAchievements, Grid grid)
        {
            int RequierCount   = AchievementAnalizer.getRequierCount(dailyAchievements);
            int AchivedRequier = AchievementAnalizer.getAchivedRequierCount(dailyAchievements);

            String achivementLabelContent = AchivedRequier.ToString() + "/"
                                            + RequierCount.ToString() + "     " +
                                            AchievementAnalizer.getAchivedCount(dailyAchievements).ToString() + "/"
                                            + AchievementAnalizer.getCount(dailyAchievements).ToString();

            ((Label)LogicalTreeHelper.FindLogicalNode(grid, "achivementLabel")).Content = achivementLabelContent;
            SolidColorBrush myBrush;

            if ((AchivedRequier == RequierCount) && RequierCount != 0)
            {
                myBrush = new SolidColorBrush(Colors.Green);
            }
            else
            {
                myBrush = new SolidColorBrush(Colors.Red);
            }
            myBrush.Opacity = 0.1;
            grid.Background = myBrush;
        }
Exemple #9
0
        public MainWindow()
        {
            model.LoadModel();
            InitializeComponent();
            System.IO.Directory.CreateDirectory("achievements");

            WindowEnricher.enrichWindow(this);
            DateTime date           = DateTime.Now;
            DateTime lastUpdateDate = model.GetActualState().lastTimeUpdateReminders;

            while (!(date.Year == lastUpdateDate.Year && date.Month == lastUpdateDate.Month && date.Day == lastUpdateDate.Day - 1))
            {
                String fileName = "achievements/" + AchievementManager.DateToString(date) + ".xml";
                if (File.Exists(fileName))
                {
                    break;
                }
                DailyAchievements dailyAchievements = new DailyAchievements();
                dailyAchievements.date         = date;
                dailyAchievements.achievements = model.GetActualState().DailyReminders.Select(x =>
                {
                    Achievement achievement = new Achievement();
                    achievement.Name        = x.Name;
                    achievement.Achived     = false;
                    achievement.type        = x.type;
                    achievement.achivedInt  = 0;
                    achievement.Required    = isDateRequired(date, x);
                    return(achievement);
                }).ToList();
                AchievementManager.SaveAchievement(fileName, dailyAchievements);
                date = date.AddDays(-1);
            }

            date = DateTime.Now;
            for (int i = 0; i < 10; i++)
            {
                DailyAchievements dailyAchievements = AchievementManager.LoadAchievementl(date);

                Grid newElement = createHistoryElementList(dailyAchievements);
                ListOfDailyAchivements.Add(newElement);
                this.HistoryGrid.Children.Add(newElement);
                date = date.AddDays(-1);
            }

            updateVerticalPositionOfListElements(ListOfDailyAchivements, 60);


            date = DateTime.Now;
            this.actualAchievements = AchievementManager.LoadAchievementl(date);

            for (int i = 0; i < actualAchievements.achievements.Count; i++)
            {
                if ((!actualAchievements.achievements[i].Achived) && actualAchievements.achievements[i].achivedInt == 0)
                {
                    Grid newElement = createAchivementElementList(actualAchievements.achievements[i]);
                    ListOfAchivements.Add(newElement);
                    this.ReminderGrid.Children.Add(newElement);
                }
            }
            updateVerticalPositionOfListElements(ListOfAchivements, 120);
        }
Exemple #10
0
 public static int getAchivedCount(DailyAchievements dailyAchievements)
 {
     return(dailyAchievements.achievements.FindAll(x => (x.Achived || x.achivedInt > 0)).Count);
 }
Exemple #11
0
 public static int getCount(DailyAchievements dailyAchievements)
 {
     return(dailyAchievements.achievements.Count());
 }
Exemple #12
0
 public static int getAchivedRequierCount(DailyAchievements dailyAchievements)
 {
     return(dailyAchievements.achievements.FindAll(x => x.Required && (x.Achived || x.achivedInt > 0)).Count);
 }
Exemple #13
0
 public static int getRequierCount(DailyAchievements dailyAchievements)
 {
     return(dailyAchievements.achievements.FindAll(x => x.Required).Count);
 }