示例#1
0
 public CarrierDPDWindow(Carrier carrier) :
     base(Gtk.WindowType.Toplevel)
 {
     this.Build();
     this.carrier = carrier;
     if (carrier.GetIcon() != null)
     {
         this.CarrierImage.Pixbuf = carrier.GetIcon();
         this.Icon = carrier.GetIcon();
     }
     this.OnOpen();
 }
示例#2
0
        // ========== Select Carrier ==========
        protected void SelectCarrier(Carrier carrier)
        {
            if (carrier == null)
            {
                throw new Exception("Tried to view a null carrier.");
            }

            this.SelectedCarrier = carrier;

            this.CarrierNameEntry.Text = this.SelectedCarrier.GetConfigValue("name");

            if (SelectedCarrier.GetIcon() != null)
            {
                this.CarrierImage.Pixbuf = this.SelectedCarrier.GetIcon();
                this.Icon = this.SelectedCarrier.GetIcon();
            }

            this.URLEntry.Text = this.SelectedCarrier.GetConfigValue("url");

            if (!this.printerProfilesLoaded)
            {
                this.PrinterProfileSelectionCombo.AppendText("Default");
            }
            int printerIndex = 0;
            int index        = 0;

            foreach (string profileName in Program.printer.PrinterProfiles.Keys)
            {
                if (profileName != "Default" && !this.printerProfilesLoaded)
                {
                    this.PrinterProfileSelectionCombo.AppendText(profileName);
                }
                if (profileName == this.SelectedCarrier.GetConfigValue("printerProfile"))
                {
                    printerIndex = index;
                }
                index++;
            }
            TreeIter iter;

            if (!this.PrinterProfileSelectionCombo.Model.IterNthChild(out iter, printerIndex))
            {
                Program.LogError("CarrierPOST", "Unable to get an iterator for printer profile selection. Index: " + printerIndex);
            }
            this.PrinterProfileSelectionCombo.SetActiveIter(iter);
            this.printerProfilesLoaded = true;

            this.AdditionalPOSTTextView.Buffer.Text = this.SelectedCarrier.GetConfigValue("additionalPOST");
        }