Ejemplo n.º 1
0
    private void InitComponents()
    {
        _chaseStar           = GetComponentDefault <ChaseStarPanel>("level_panel/infoScrollView/viewport/content/starReward_Panel");
        _taskIcon            = GetComponent <Image>                ("level_panel/awakeMissionImage_scrollView/template/0/map_Img");
        _stageName           = GetComponent <Text>                 ("level_panel/awakeMissionName_Txt");
        _energyCost          = GetComponent <Text>                 ("invite_panel/start_Btn/Text");
        _resetChallengeTimes = GetComponent <Button>               ("level_panel/remainchallengeCount/resetBtn");
        _challengeTimes      = GetComponent <Text>                 ("level_panel/remainchallengeCount/remainCount_Txt");
        _stageDesc           = GetComponent <Text>                 ("level_panel/infoScrollView/viewport/content/stageInfo_Panel/infoBg/content");
        _recommend           = GetComponent <Text>                 ("level_panel/recommend/Text");
        _layout     = GetComponent <VerticalLayoutGroup>  ("level_panel/infoScrollView/viewport/content");
        _chatButton = GetComponent <Button>               ("level_panel/chat");
        _chatNotice = GetComponent <Transform>            ("level_panel/chat/newinfo");

        GetComponent <Toggle>("level_panel/infoScrollView/viewport/content/stageInfo_Panel/packUp")?.onValueChanged.AddListener(CalcContentSize);
        GetComponent <Toggle>("level_panel/infoScrollView/viewport/content/starReward_Panel/packUp")?.onValueChanged.AddListener(CalcContentSize);
        GetComponent <Toggle>("level_panel/infoScrollView/viewport/content/preaward_Panel/packUp")?.onValueChanged.AddListener(CalcContentSize);

        _stars[0] = GetComponent <Transform>("level_panel/awakeMissionImage_scrollView/starframe/star_01");
        _stars[1] = GetComponent <Transform>("level_panel/awakeMissionImage_scrollView/starframe/star_02");
        _stars[2] = GetComponent <Transform>("level_panel/awakeMissionImage_scrollView/starframe/star_03");

        _rewardScrollView = GetComponent <ScrollView>("level_panel/infoScrollView/viewport/content/preaward_Panel/itemList");

        _buyTimesWindow = SubWindowBase.CreateSubWindow <AssistWindow_BuyTimes, Window_Assist>(this, GetComponent <Transform>("level_panel/payChallengeCount")?.gameObject);

        _sweepToggle = GetComponent <Toggle>("checkbox/toggle_02");

        _windowGroup = new WindowGroup(GetComponent <ToggleGroup>("bg"));
        _windowGroup.Registe(SubWindowType.SelectWindow, GetComponent <Toggle>("checkbox/toggle_01"),
                             SubWindowBase.CreateSubWindow <AssistWindow_Select, Window_Assist>(this, GetComponent <Transform>("invite_panel")?.gameObject));
        _windowGroup.Registe(SubWindowType.SweepWindow, _sweepToggle,
                             SubWindowBase.CreateSubWindow <AssistWindow_MoppingUp, Window_Assist>(this, GetComponent <Transform>("sweep_panel")?.gameObject));
    }
Ejemplo n.º 2
0
        public static DeleteConfirmDialog CreateFromGladeFile(Window parent, WindowGroup group)
        {
            var builder = new Builder();

            builder.AddFromFile(IoPath.Combine(AppDomain.CurrentDomain.BaseDirectory, "glade", "delete-confirm-dialog.glade"));
            return(new DeleteConfirmDialog(builder, parent, group));
        }
Ejemplo n.º 3
0
        private CategoryEditDialog(Builder builder, Window parent, WindowGroup group) : base(builder.GetRawOwnedObject("dialog"))
        {
            builder.Autoconnect(this);

            Modal = true;
            SetPosition(WindowPosition.CenterAlways);
            TransientFor = parent;
            this.group   = group;
            this.group.AddWindow(this);

            GtkHelper.AttachSafeDispose(this);

            Label1.Text = TextResource.GetText("SORT_NAME");
            Label2.Text = TextResource.GetText("SETTINGS_CAT_TYPES");
            Label3.Text = TextResource.GetText("SETTINGS_CAT_FOLDER");

            BtnOk.Clicked     += BtnOk_Clicked;
            BtnCancel.Clicked += BtnCancel_Clicked;
            Browse.Clicked    += Browse_Clicked;

            BtnOk.Label     = TextResource.GetText("MSG_OK");
            BtnCancel.Label = TextResource.GetText("ND_CANCEL");

            Title = TextResource.GetText("MSG_CATEGORY");
            SetDefaultSize(400, 200);
        }
Ejemplo n.º 4
0
        public static SettingsDialog CreateFromGladeFile(Window parent, WindowGroup group)
        {
            var builder = new Builder();

            builder.AddFromFile(IoPath.Combine(AppDomain.CurrentDomain.BaseDirectory, "glade", "settings-dialog.glade"));
            return(new SettingsDialog(builder, parent, group));
        }
Ejemplo n.º 5
0
        public AdvancedDownloadDialog(Builder builder, Window parent, WindowGroup group) : base(builder.GetRawOwnedObject("dialog"))// base(TextResource.GetText("DESC_ADV_TITLE"), parent, DialogFlags.Modal)
        {
            SetDefaultSize(550, 450);
            builder.Autoconnect(this);
            Title = TextResource.GetText("DESC_ADV_TITLE");
            Modal = true;
            SetPosition(WindowPosition.CenterAlways);
            TransientFor = parent;
            this.group   = group;
            this.group.AddWindow(this);

            GtkHelper.PopulateComboBox(CmbProxyType !,
                                       TextResource.GetText("NET_SYSTEM_PROXY"),
                                       TextResource.GetText("ND_NO_PROXY"),
                                       TextResource.GetText("ND_MANUAL_PROXY"));

            GtkHelper.ConfigurePasswordField(TxtPassword);
            GtkHelper.ConfigurePasswordField(TxtProxyPassword);
            TxtSpeedLimit !.Text    = "0";
            CmbProxyType !.Changed += CmbProxyType_Changed;

            btnOk.Clicked     += BtnOK_Click;
            btnCancel.Clicked += BtnCancel_Click;

            LoadTexts();

            GtkHelper.AttachSafeDispose(this);
        }
Ejemplo n.º 6
0
        private PasswordDialog(Builder builder, Window parent, WindowGroup group) : base(builder.GetRawOwnedObject("dialog"))
        {
            builder.Autoconnect(this);

            Modal = true;
            SetPosition(WindowPosition.CenterAlways);
            TransientFor = parent;
            this.group   = group;
            this.group.AddWindow(this);

            GtkHelper.AttachSafeDispose(this);

            Label1.Text = TextResource.GetText("DESC_HOST");
            Label2.Text = TextResource.GetText("DESC_USER");
            Label3.Text = TextResource.GetText("DESC_PASS");

            BtnOk.Clicked     += BtnOk_Clicked;
            BtnCancel.Clicked += BtnCancel_Clicked;

            BtnOk.Label     = TextResource.GetText("MSG_OK");
            BtnCancel.Label = TextResource.GetText("ND_CANCEL");

            Title = TextResource.GetText("DESC_PASS");
            SetDefaultSize(400, 300);
        }
Ejemplo n.º 7
0
        //private static Builder builder = new Builder();

        //static AdvancedDownloadDialog()
        //{
        //    builder.AddFromFile(IoPath.Combine(AppDomain.CurrentDomain.BaseDirectory, "glade", "advanced-download-dialog.glade"));
        //}

        //public static Builder LoadBuilder()
        //{
        //    var builder = new Builder();
        //    builder.AddFromFile(IoPath.Combine(AppDomain.CurrentDomain.BaseDirectory, "glade", "advanced-download-dialog.glade"));
        //    return builder;
        //}

        public static AdvancedDownloadDialog CreateFromGladeFile(Window parent, WindowGroup group)
        {
            var builder = new Builder();

            builder.AddFromFile(IoPath.Combine(AppDomain.CurrentDomain.BaseDirectory, "glade", "advanced-download-dialog.glade"));
            return(new AdvancedDownloadDialog(builder, parent, group));
        }
Ejemplo n.º 8
0
        private QueueSelectionDialog(Builder builder, Window parent, WindowGroup group) : base(builder.GetRawOwnedObject("dialog"))
        {
            builder.Autoconnect(this);
            Modal = true;
            SetPosition(WindowPosition.CenterAlways);
            TransientFor = parent;
            this.group   = group;
            this.group.AddWindow(this);

            GtkHelper.AttachSafeDispose(this);
            Title = TextResource.GetText("Q_MOVE_TO");
            SetDefaultSize(400, 300);
            LoadTexts();

            listStore      = new ListStore(typeof(string));
            LbQueues.Model = listStore;

            var queueNameRendererText = new CellRendererText();
            var queueNameColumn       = new TreeViewColumn("", queueNameRendererText, "text", 0)
            {
                Resizable   = false,
                Reorderable = false,
                Sizing      = TreeViewColumnSizing.Autosize,
                Expand      = true
            };

            LbQueues.HeadersVisible = false;
            LbQueues.AppendColumn(queueNameColumn);

            BtnCancel.Clicked += BtnCancel_Clicked;
            BtnOK.Clicked     += BtnOK_Clicked;
        }
Ejemplo n.º 9
0
        //private TimeSpan GetSchedulerStartTime()
        //{
        //    var hrs = CmbHour1.Active + 1;
        //    var min = CmbMinute1.Active + 1;
        //    return TimeHelper.ConvertH12ToH24(hrs,
        //           min, CmbAmPm1.Active == 0);
        //}

        //private TimeSpan GetSchedulerStopTime()
        //{
        //    var hrs = CmbHour2.Active + 1;
        //    var min = CmbMinute2.Active;
        //    return TimeHelper.ConvertH12ToH24(hrs,
        //           min, CmbAmPm2.Active == 0);
        //}

        //private void SetTime(TimeSpan value, ComboBox cmbHrs, ComboBox cmbMin, ComboBox cmbAmPm)
        //{
        //    suppressEvent = true;
        //    TimeHelper.ConvertH24ToH12(value, out int hh, out int mi, out bool am);
        //    cmbAmPm.Active = am ? 0 : 1;
        //    cmbHrs.Active = hh - 1;
        //    cmbMin.Active = mi;
        //    suppressEvent = false;
        //}

        //private void SetStartTime(TimeSpan value)
        //{
        //    SetTime(value, CmbHour1, CmbMinute1, CmbAmPm1);
        //}

        //private void SetStopTime(TimeSpan value)
        //{
        //    SetTime(value, CmbHour2, CmbMinute2, CmbAmPm2);
        //}

        public static QueueSchedulerDialog CreateFromGladeFile(Window parent, WindowGroup group)
        {
            var builder = new Builder();

            builder.AddFromFile(IoPath.Combine(AppDomain.CurrentDomain.BaseDirectory, "glade", "queue-manager-dialog.glade"));
            return(new QueueSchedulerDialog(builder, parent, group));
        }
Ejemplo n.º 10
0
 public void AddGroup(WindowGroupType groupType, WindowGroup windowGroup)
 {
     if (groups == null)
     {
         groups = new Dictionary <int, WindowGroup>();
     }
     groups[groupType.GetHashCode()] = windowGroup;
 }
Ejemplo n.º 11
0
        public static NewQueueDialog CreateFromGladeFile(Window parent, WindowGroup group,
                                                         Action <DownloadQueue, bool> okAction,
                                                         DownloadQueue?modifyingQueue)
        {
            var builder = new Builder();

            builder.AddFromFile(IoPath.Combine(AppDomain.CurrentDomain.BaseDirectory, "glade", "new-queue-dialog.glade"));
            return(new NewQueueDialog(builder, parent, group, okAction, modifyingQueue));
        }
Ejemplo n.º 12
0
        public void AGroup()
        {
            var wing = new WindowGroup()
            {
                DataContext = windowGroupVM
            };

            wing.ShowDialog();
            Console.WriteLine("AddGroup");
        }
Ejemplo n.º 13
0
        private LanguageDialog(Builder builder, Window parent, WindowGroup group) : base(builder.GetRawOwnedObject("dialog"))
        {
            builder.Autoconnect(this);

            Modal = true;
            SetPosition(WindowPosition.CenterAlways);
            TransientFor = parent;
            this.group   = group;
            this.group.AddWindow(this);

            GtkHelper.AttachSafeDispose(this);

            Label1.Text = TextResource.GetText("MSG_LANG1");
            Label2.Text = TextResource.GetText("MSG_LANG2");

            BtnOk.Clicked     += BtnOk_Clicked;
            BtnCancel.Clicked += BtnCancel_Clicked;

            BtnOk.Label     = TextResource.GetText("MSG_OK");
            BtnCancel.Label = TextResource.GetText("ND_CANCEL");

            Title = TextResource.GetText("MENU_LANG");
            SetDefaultSize(400, 200);

            var indexFile = IoPath.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Lang\index.txt");
            var items     = new List <string>();
            var n         = 0;
            var c         = 0;

            if (File.Exists(indexFile))
            {
                var lines = File.ReadAllLines(indexFile);
                foreach (var line in lines)
                {
                    var index = line.IndexOf("=");
                    if (index > 0)
                    {
                        var name = line.Substring(0, index);
                        items.Add(name);
                        if (name == Config.Instance.Language)
                        {
                            c = n;
                        }
                        n++;
                    }
                }
                if (items.Count > 0)
                {
                    GtkHelper.PopulateComboBoxGeneric <string>(CmbLanguage, items.ToArray());
                    CmbLanguage.Active = c;
                }
            }
        }
Ejemplo n.º 14
0
 private PropertiesDialog(Builder builder, Window parent, WindowGroup group) : base(builder.GetRawOwnedObject("dialog"))
 {
     builder.Autoconnect(this);
     Modal = true;
     SetPosition(WindowPosition.CenterAlways);
     TransientFor = parent;
     group.AddWindow(this);
     GtkHelper.AttachSafeDispose(this);
     Title = TextResource.GetText("MENU_PROPERTIES");
     SetDefaultSize(400, 200);
     LoadTexts();
 }
Ejemplo n.º 15
0
        private LinkRefreshWindow(Builder builder) : base(builder.GetRawOwnedObject("window"))
        {
            builder.Autoconnect(this);
            SetDefaultSize(400, 200);
            SetPosition(WindowPosition.CenterAlways);
            this.group = new WindowGroup();
            this.group.AddWindow(this);

            GtkHelper.AttachSafeDispose(this);

            BtnStop.Label = TextResource.GetText("BTN_STOP_PROCESSING");
            LblText.Text  = TextResource.GetText("REF_WAITING_FOR_LINK");

            Title            = TextResource.GetText("MENU_REFRESH_LINK");
            DeleteEvent     += LinkRefreshWindow_DeleteEvent;
            BtnStop.Clicked += BtnStop_Clicked;
        }
Ejemplo n.º 16
0
        private AboutDialog(Builder builder, Window parent, WindowGroup group) : base(builder.GetRawOwnedObject("dialog"))
        {
            builder.Autoconnect(this);

            Modal = true;
            SetPosition(WindowPosition.CenterAlways);
            TransientFor = parent;
            this.group   = group;
            this.group.AddWindow(this);

            GtkHelper.AttachSafeDispose(this);

            AppLogo.Pixbuf     = GtkHelper.LoadSvg("xdm-logo", 128);
            TxtAppVersion.Text = "Xtreme Download Manager 8.0.1 BETA";
            TxtAppVersion.StyleContext.AddClass("medium-font");
            TxtCopyright.Text = "© 2013 Subhra Das Gupta";
            TxtWebsite.Label  = "www.xtremedownloadmanager.com";
            TxtWebsite.Uri    = Links.HomePageUrl;

            Title = TextResource.GetText("MENU_ABOUT");
            SetDefaultSize(500, 450);
        }
Ejemplo n.º 17
0
        private DeleteConfirmDialog(Builder builder, Window parent, WindowGroup group) : base(builder.GetRawOwnedObject("dialog"))
        {
            builder.Autoconnect(this);


            Modal = true;
            SetPosition(WindowPosition.CenterAlways);
            TransientFor = parent;
            this.group   = group;
            this.group.AddWindow(this);

            GtkHelper.AttachSafeDispose(this);

            BtnDelete.Clicked += BtnDelete_Clicked;
            BtnCancel.Clicked += BtnCancel_Clicked;

            BtnDelete.Label  = TextResource.GetText("DESC_DEL");
            BtnCancel.Label  = TextResource.GetText("ND_CANCEL");
            ChkDiskDel.Label = TextResource.GetText("LBL_DELETE_FILE");
            TxtLabel.Text    = TextResource.GetText("DEL_SEL_TEXT");

            Title = TextResource.GetText("MENU_DELETE_DWN");
            SetDefaultSize(400, 200);
        }
Ejemplo n.º 18
0
        private NewDownloadWindow(Builder builder) : base(builder.GetRawOwnedObject("window"))
        {
            builder.Autoconnect(this);
            SetDefaultSize(500, 300);
            KeepAbove = true;

            Title = TextResource.GetText("ND_TITLE");
            SetPosition(WindowPosition.CenterAlways);
            ImgFileIcon !.Pixbuf = GtkHelper.LoadSvg("file-download-line", 48);

            windowGroup = new WindowGroup();
            windowGroup.AddWindow(this);

            dropdownItems = new ListStore(typeof(string));

            //TxtUrl = (Entry)builder.GetObject("txtUrl");
            //TxtFile = (Entry)builder.GetObject("txtFile");
            //CmbLocation = (ComboBox)builder.GetObject("cmdFolder");
            //lblFileSize = (Label)builder.GetObject("lblFileSize");
            //lblIgnoreLabel = (LinkButton)builder.GetObject("lblIgnoreLabel");
            //btnDownloadLater = (Button)builder.GetObject("btnDownloadLater");
            //btnDownloadNow = (Button)builder.GetObject("btnDownloadNow");
            //btnMore = (Button)builder.GetObject("btnMore");
            //lblAddress = (Label)builder.GetObject("lblAddress");
            //lblFile = (Label)builder.GetObject("lblFile");
            //lblSaveIn = (Label)builder.GetObject("lblSaveIn");

            lblAddress.Text        = TextResource.GetText("ND_ADDRESS");
            lblFile.Text           = TextResource.GetText("ND_FILE");
            lblSaveIn.Text         = TextResource.GetText("LBL_SAVE_IN");
            btnDownloadNow.Label   = TextResource.GetText("ND_DOWNLOAD_NOW");
            btnDownloadLater.Label = TextResource.GetText("ND_DOWNLOAD_LATER");
            btnMore.Label          = TextResource.GetText("ND_MORE");
            lblIgnoreLabel.Label   = TextResource.GetText("ND_IGNORE_URL");

            CmbLocation.Changed      += CmbLocation_Changed;
            this.Destroyed           += Window_Closed;
            TxtUrl.Changed           += TxtUrl_TextChanged;
            btnDownloadNow.Clicked   += btnDownload_Click;
            btnDownloadLater.Clicked += btnDownloadLater_Click;
            btnMore.Clicked          += btnAdvanced_Click;
            lblIgnoreLabel.Clicked   += TextBlock_MouseDown;

            dropdownItems = GtkHelper.PopulateComboBox(CmbLocation);

            CmbLocation.Hexpand = true; //If there's available space, we use it
            //CellRendererText renderer = (CmbLocation.Cells[0] as CellRendererText); //Get the ComboBoxText only renderer
            //renderer.WrapWidth = 10; //Always show at least 20 chars
            //renderer.Ellipsize = Pango.EllipsizeMode.End;

            //CmbLocation.Model = dropdownItems;
            //var cmbRenderer = new CellRendererText();
            //CmbLocation.PackStart(cmbRenderer, true);
            //CmbLocation.AddAttribute(cmbRenderer, "text", 0);

            PrepareMenu();

            this.ShowAll();

            GtkHelper.AttachSafeDispose(this);
        }
Ejemplo n.º 19
0
        private SettingsDialog(Builder builder,
                               Window parent,
                               WindowGroup group) : base(builder.GetRawOwnedObject("dialog"))
        {
            builder.Autoconnect(this);

            Modal = true;
            SetDefaultSize(640, 480);
            SetPosition(WindowPosition.CenterAlways);
            TransientFor = parent;
            this.group   = group;
            this.group.AddWindow(this);
            GtkHelper.AttachSafeDispose(this);

            LoadTexts();

            Title = TextResource.GetText("TITLE_SETTINGS");
            GtkHelper.PopulateComboBoxGeneric <int>(CmbMinVidSize, new int[] { 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 });
            GtkHelper.PopulateComboBoxGeneric <int>(CmbMaxParallalDownloads, Enumerable.Range(1, 50).ToArray());
            GtkHelper.PopulateComboBox(CmbDblClickAction, TextResource.GetText("CTX_OPEN_FOLDER"), TextResource.GetText("MSG_OPEN_FILE"));

            CreateCategoryListView();

            GtkHelper.PopulateComboBoxGeneric <int>(CmbTimeOut, Enumerable.Range(1, 300).ToArray());
            GtkHelper.PopulateComboBoxGeneric <int>(CmbMaxSegments, Enumerable.Range(1, 64).ToArray());
            GtkHelper.PopulateComboBoxGeneric <int>(CmbMaxRetry, Enumerable.Range(1, 100).ToArray());
            GtkHelper.PopulateComboBox(CmbProxyType, TextResource.GetText("NET_SYSTEM_PROXY"),
                                       TextResource.GetText("ND_NO_PROXY"), TextResource.GetText("ND_MANUAL_PROXY"));

            CreatePasswordManagerListView();

            VideoWikiLink.Clicked += VideoWikiLink_Clicked;
            BtnChrome.Clicked     += BtnChrome_Clicked;
            BtnFirefox.Clicked    += BtnFirefox_Clicked;
            BtnEdge.Clicked       += BtnEdge_Clicked;
            BtnOpera.Clicked      += BtnOpera_Clicked;
            BtnCopy1.Clicked      += BtnCopy1_Clicked;
            BtnCopy2.Clicked      += BtnCopy2_Clicked;
            BtnDefault1.Clicked   += BtnDefault1_Clicked;
            BtnDefault2.Clicked   += BtnDefault2_Clicked;
            BtnDefault3.Clicked   += BtnDefault3_Clicked;

            BtnCopy1.Image = new Image(GtkHelper.LoadSvg("file-copy-line"));
            BtnCopy2.Image = new Image(GtkHelper.LoadSvg("file-copy-line"));

            BtnOK.Clicked     += BtnOK_Clicked;
            BtnCancel.Clicked += BtnCancel_Clicked;

            BtnTempFolderBrowse.Clicked     += BtnTempFolderBrowse_Clicked;
            BtnDownloadFolderBrowse.Clicked += BtnDownloadFolderBrowse_Clicked;

            CatAdd.Clicked  += CatAdd_Clicked;
            CatEdit.Clicked += CatEdit_Clicked;
            CatDel.Clicked  += CatDel_Clicked;
            CatDef.Clicked  += CatDef_Clicked;

            CmbProxyType.Changed += CmbProxyType_Changed;

            AddPass.Clicked  += AddPass_Clicked;
            DelPass.Clicked  += DelPass_Clicked;
            EditPass.Clicked += EditPass_Clicked;

            BtnBrowse.Clicked         += BtnBrowse_Clicked;
            BtnUserAgentReset.Clicked += BtnUserAgentReset_Clicked;
        }
Ejemplo n.º 20
0
        private NewQueueDialog(Builder builder,
                               Window parent,
                               WindowGroup group,
                               Action <DownloadQueue, bool> okAction,
                               DownloadQueue?modifyingQueue) : base(builder.GetRawOwnedObject("dialog"))
        {
            builder.Autoconnect(this);

            Modal = true;
            SetPosition(WindowPosition.CenterAlways);
            TransientFor = parent;
            this.group   = group;
            this.group.AddWindow(this);
            GtkHelper.AttachSafeDispose(this);
            LoadTexts();
            Title = TextResource.GetText("LBL_QUEUE_OPT1");
            SetDefaultSize(640, 480);
            BtnCancel.Clicked += BtnCancel_Clicked;
            BtnOK.Clicked     += BtnOK_Clicked;

            this.listStore = new ListStore(
                typeof(bool), typeof(string),
                typeof(string), typeof(string),
                typeof(string), typeof(InProgressEntryWrapper));

            this.lvDownloads.Model = this.listStore;

            var fileNameColumn = new TreeViewColumn
            {
                Resizable   = true,
                Reorderable = false,
                Title       = TextResource.GetText("SORT_NAME"),
                Sizing      = TreeViewColumnSizing.Fixed,
                FixedWidth  = 200
            };

            var checkboxRenderer = new CellRendererToggle {
            };

            checkboxRenderer.Toggled += CheckboxRenderer_Toggled;
            fileNameColumn.PackStart(checkboxRenderer, false);
            fileNameColumn.SetAttributes(checkboxRenderer, "active", 0);

            var fileNameRendererText = new CellRendererText();

            fileNameColumn.PackStart(fileNameRendererText, false);
            fileNameColumn.SetAttributes(fileNameRendererText, "text", 1);
            this.lvDownloads.AppendColumn(fileNameColumn);

            var dateColumn = new TreeViewColumn
            {
                Resizable   = true,
                Reorderable = false,
                Title       = TextResource.GetText("SORT_DATE"),
                Sizing      = TreeViewColumnSizing.Fixed,
                FixedWidth  = 150
            };
            var dateRendererText = new CellRendererText();

            dateColumn.PackStart(dateRendererText, false);
            dateColumn.SetAttributes(dateRendererText, "text", 2);
            this.lvDownloads.AppendColumn(dateColumn);

            var sizeColumn = new TreeViewColumn
            {
                Resizable   = true,
                Reorderable = false,
                Title       = TextResource.GetText("SORT_SIZE"),
                Sizing      = TreeViewColumnSizing.Fixed,
                FixedWidth  = 150
            };
            var sizeRendererText = new CellRendererText();

            sizeColumn.PackStart(sizeRendererText, false);
            sizeColumn.SetAttributes(sizeRendererText, "text", 3);
            this.lvDownloads.AppendColumn(sizeColumn);

            var statusColumn = new TreeViewColumn
            {
                Resizable   = true,
                Reorderable = false,
                Title       = TextResource.GetText("SORT_STATUS"),
                Sizing      = TreeViewColumnSizing.Fixed,
                FixedWidth  = 150
            };
            var statusRendererText = new CellRendererText();

            statusColumn.PackStart(statusRendererText, false);
            statusColumn.SetAttributes(statusRendererText, "text", 4);
            this.lvDownloads.AppendColumn(statusColumn);

            this.okAction = okAction;
            if (modifyingQueue == null)
            {
                this.TxtQueueName.Text = "New queue #" + QueueManager.QueueAutoNumber;
                QueueManager.QueueAutoNumber++;
            }
            else
            {
                this.TxtQueueName.Text = modifyingQueue.Name;
                this.modifyingQueue    = modifyingQueue;
            }

            var set = new HashSet <string>();

            foreach (var queue in QueueManager.Queues)
            {
                foreach (var id in queue.DownloadIds)
                {
                    set.Add(id);
                }
            }

            foreach (var ent in ApplicationContext.Application.GetAllInProgressDownloads().Select(x => new EntryWrapper {
                Entry = x
            }))
            {
                if (!set.Contains(ent.Entry.Id))
                {
                    listStore.AppendValues(false,
                                           ent.Entry.Name,
                                           ent.Entry.DateAdded.ToShortDateString() + " " + ent.Entry.DateAdded.ToShortTimeString(),
                                           FormattingHelper.FormatSize(ent.Entry.Size),
                                           ent.Entry.Status.ToString(),
                                           ent);
                }
            }

            ChkSelectAll.Toggled += ChkSelectAll_Toggled;
        }
Ejemplo n.º 21
0
        private QueueSchedulerDialog(Builder builder, Window parent, WindowGroup group) : base(builder.GetRawOwnedObject("dialog"))
        {
            builder.Autoconnect(this);
            Modal = true;
            SetPosition(WindowPosition.CenterAlways);
            TransientFor = parent;
            this.group   = group;
            this.group.AddWindow(this);

            GtkHelper.AttachSafeDispose(this);
            Title = TextResource.GetText("DESC_Q_TITLE");
            SetDefaultSize(700, 500);
            LoadTexts();
            queueListStore = new ListStore(typeof(string), typeof(DownloadQueue));
            LbQueues.Model = queueListStore;

            var queueNameRendererText = new CellRendererText();
            var queueNameColumn       = new TreeViewColumn("", queueNameRendererText, "text", 0)
            {
                Resizable   = false,
                Reorderable = false,
                Sizing      = TreeViewColumnSizing.Autosize,
                Expand      = true
            };

            LbQueues.HeadersVisible = false;
            LbQueues.AppendColumn(queueNameColumn);
            queueScroll.SetSizeRequest(150, 100);

            filesListStore = new ListStore(typeof(string), typeof(string), typeof(string), typeof(InProgressDownloadItem));
            lvFiles.Model  = filesListStore;

            var k = 0;

            foreach (var key in new string[] { "ND_FILE", "SORT_SIZE", "SORT_STATUS" })
            {
                var cellRendererText = new CellRendererText();
                var treeViewColumn   = new TreeViewColumn(TextResource.GetText(key), cellRendererText, "text", k++)
                {
                    Resizable   = true,
                    Reorderable = false,
                    Sizing      = TreeViewColumnSizing.Fixed,
                    FixedWidth  = 150
                };
                lvFiles.AppendColumn(treeViewColumn);
            }

            this.SchedulerPanel = new SchedulerPanelControl(
                chkEveryday,
                new CheckButton[] { chkSun, chkMon, chkTue, chkWed, chkThu, chkFri, chkSat },
                new TimePickerControl(CmbHour1, CmbMinute1, CmbAmPm1, LblQueueStart),
                new TimePickerControl(CmbHour2, CmbMinute2, CmbAmPm2, LblQueueStop)
                );

            this.SchedulerPanel.Schedule = defaultSchedule;

            this.SchedulerPanel.ValueChanged += (_, _) =>
            {
                DownloadSchedule?schedule = null;
                if (ChkEnableScheduler.Active)
                {
                    schedule = this.SchedulerPanel.Schedule;
                }
                if (GtkHelper.GetSelectedValue <DownloadQueue>(LbQueues, 1) is DownloadQueue queue)
                {
                    queue.Schedule = schedule;
                }
            };

            this.LbQueues.Selection.Changed += (_, _) =>
            {
                var selected = GtkHelper.GetSelectedValue <DownloadQueue>(LbQueues, 1);
                if (selected != null)
                {
                    UpdateControls(selected);
                }
            };

            this.lvFiles.Selection.Changed += (_, _) => ListSelectionChanged();

            this.ChkEnableScheduler.Toggled += (_, _) =>
            {
                SchedulerPanel.Enabled = this.ChkEnableScheduler.Active;
                if (GtkHelper.GetSelectedValue <DownloadQueue>(LbQueues, 1) is DownloadQueue queue)
                {
                    queue.Schedule = this.ChkEnableScheduler.Active ? this.SchedulerPanel.Schedule : null;
                }
            };

            Hidden            += QueueSchedulerDialog_Hidden;
            BtnNew.Clicked    += BtnNew_Clicked;
            BtnStart.Clicked  += BtnStart_Clicked;
            BtnStop.Clicked   += BtnStop_Clicked;
            BtnDel.Clicked    += BtnDel_Clicked;
            BtnCancel.Clicked += BtnCancel_Clicked;
            BtnAdd.Clicked    += BtnAdd_Clicked;
            BtnRemove.Clicked += BtnRemove_Clicked;
            BtnUp.Clicked     += BtnUp_Clicked;
            BtnDown.Clicked   += BtnDown_Clicked;
            BtnMoveTo.Clicked += BtnMoveTo_Clicked;
            BtnSave.Clicked   += BtnSave_Clicked;

            lvFiles.Selection.Mode = SelectionMode.Multiple;

            SchedulerPanel.Enabled = false;
        }