Beispiel #1
0
        public FileActions()
        {
            New           = new Gtk.Action("New", Catalog.GetString("New..."), null, Stock.New);
            NewScreenshot = new Gtk.Action("NewScreenshot", Catalog.GetString("New Screenshot..."), null, Stock.Fullscreen);
            Open          = new Gtk.Action("Open", Catalog.GetString("Open..."), null, Stock.Open);
            OpenRecent    = new RecentAction("OpenRecent", Catalog.GetString("Open Recent"), null, Stock.Open, RecentManager.Default);

            RecentFilter recentFilter = new RecentFilter();

            recentFilter.AddApplication("Pinta");

            (OpenRecent as RecentAction).AddFilter(recentFilter);

            Close  = new Gtk.Action("Close", Catalog.GetString("Close"), null, Stock.Close);
            Save   = new Gtk.Action("Save", Catalog.GetString("Save"), null, Stock.Save);
            SaveAs = new Gtk.Action("SaveAs", Catalog.GetString("Save As..."), null, Stock.SaveAs);
            Print  = new Gtk.Action("Print", Catalog.GetString("Print"), null, Stock.Print);
            Exit   = new Gtk.Action("Exit", Catalog.GetString("Quit"), null, Stock.Quit);

            New.ShortLabel   = Catalog.GetString("New");
            Open.ShortLabel  = Catalog.GetString("Open");
            Open.IsImportant = true;
            Save.IsImportant = true;

            Close.Sensitive = false;
            Print.Sensitive = false;
        }
        /// <summary>
        /// Получить список недавних действий с Трекера
        /// </summary>
        /// <returns>Недавние действия, выполняемые пользователями</returns>
        public async Task <IList <RecentAction> > RetrieveActions()
        {
            await RenewAuthCookieIfExpired();

            var actionsResp = await GetActionResponse("last_actions");

            JArray actionsJson = null;

            using (var respReader = new StreamReader(actionsResp.GetResponseStream()))
            {
                string json = await respReader.ReadToEndAsync();

                actionsJson = (JArray)JsonConvert.DeserializeObject(json);
            }

            var recentActions = actionsJson.Select(j => RecentAction.FromJson(j));

            // Загрузить аватарки
            var logins = recentActions.Select(a => a.UserId).Distinct().ToList();

            logins.Add("default");
            await DownloadAllMissingUserPics(logins.ToArray());

            return(recentActions.ToList());
        }
 private void OnRecentChanged(string item, RecentAction action)
 {
     if (_recentChanged != null)
     {
         _recentChanged(this, new RecentEventArgs {
             Action = action, Item = item
         });
     }
 }
Beispiel #4
0
        private void OnActRecentlyUsedActivated(object sender, System.EventArgs args)
        {
            RecentAction act  = (RecentAction)sender;
            string       path = act.CurrentUri.Replace("file://", string.Empty);

            if (!File.Exists(path))
            {
                MsgDialog.ShowError(this, S._("Error"), S._("Database '{0}' not found."), path);
                return;
            }

            // volumes list will be refreshed asynchronously
            OpenDB(path, false, true, null);
        }
 private void OnRecentChanged(string item, RecentAction action)
 {
     if (_recentChanged != null)
         _recentChanged(this, new RecentEventArgs { Action = action, Item = item });
 }