Esempio n. 1
0
		public ThreadWithState(frmViewer aViewer, IDataMgr aDataMgr, GetReportDataComplete aDelegate) {
			//The constructor obtains the state information and the callback delegate
			Debug.Write("ThreadWithState::ThreadWithState()\n");
			this.m_oViewer = aViewer;
			this.m_oDataMgr = aDataMgr;
			this.m_oCallBack = aDelegate;
		}
Esempio n. 2
0
        /// <summary>
        /// Muestra el reporte en un mediante el visor de Crystal Reports o
        /// manda a imprimir el reporte directamente a la impresora configurada.
        /// </summary>
        /// <param name="report"> Documento .rpt </param>
        /// <param name="reportName"> Nombre del reporte. </param>
        /// <param name="isDialog"> Se mostrará en una ventana tipo Dialogo. </param>
        /// <param name="owner"> Ventana Principal que utiliza el visor. </param>
        /// <param name="isDirectPrint"> Bandera de impresion directa. </param>
        /// <history>
        /// [edgrodriguez] 16/Jul/2016 Created
        /// </history>
        public static void ShowReport(ReportDocument report, string reportName = "", bool isDialog = false, Window owner = null, EnumPrintDevice PrintDevice = EnumPrintDevice.pdScreen, bool IsInvitation = false, int numCopies = 1)
        {
            switch (PrintDevice)
            {
            case EnumPrintDevice.pdPrinter:
                var boPrintReportOptions = new PrintReportOptions();
                boPrintReportOptions.PrinterName = (IsInvitation) ? ConfigRegistryHelper.GetConfiguredPrinter("PrintInvit") : boPrintReportOptions.PrinterName;
                if (IsInvitation && string.IsNullOrEmpty(boPrintReportOptions.PrinterName))
                {
                    UIHelper.ShowMessage($"The printer is not configured, please configure your printer.");
                    return;
                }
                var boReportClientDocument  = report.ReportClientDocument;
                var boPrintOutputController = boReportClientDocument.PrintOutputController;

                boPrintReportOptions.JobTitle       = reportName;
                boPrintReportOptions.NumberOfCopies = numCopies;
                boPrintOutputController.PrintReport(boPrintReportOptions);
                break;

            case EnumPrintDevice.pdScreen:
                var crViewer = new frmViewer(report, reportName);
                crViewer.Owner = owner;
                if (isDialog)
                {
                    crViewer.ShowDialog();
                    break;
                }
                crViewer.Show();
                break;
            }
        }
Esempio n. 3
0
 public ThreadWithState(frmViewer aViewer, IDataMgr aDataMgr, GetReportDataComplete aDelegate)
 {
     //The constructor obtains the state information and the callback delegate
     Debug.Write("ThreadWithState::ThreadWithState()\n");
     this.m_oViewer   = aViewer;
     this.m_oDataMgr  = aDataMgr;
     this.m_oCallBack = aDelegate;
 }
Esempio n. 4
0
 internal Inspectors(TabControl oRequestTabs, TabControl oResponseTabs, frmViewer oMain)
 {
     this.m_tabsRequest        = oRequestTabs;
     this.m_tabsResponse       = oResponseTabs;
     this.m_Viewer             = oMain;
     this.m_RequestInspectors  = new Hashtable();
     this.m_ResponseInspectors = new Hashtable();
     if (CONFIG.bLoadInspectors)
     {
         this.ScanInspectors();
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Despliega el reporte
 /// </summary>
 /// <history>
 /// [aalcocer] 01/03/2016 Created
 /// </history>
 private void btnPreview_Click(object sender, RoutedEventArgs e)
 {
     if (!dtgDatos.Items.IsEmpty)
     {
         StaStart("Loading preview...");
         fillMailReport();
         var _frmViewer = new frmViewer(_rptMailOuts);
         _frmViewer.ShowDialog();
         StaEnd();
     }
     else
     {
         UIHelper.ShowMessage("There is no data.");
     }
 }
Esempio n. 6
0
 /// <summary>
 /// Muestra la vista previa del reporte que esta cargado en el richTextBox
 /// </summary>
 ///<history>
 ///[erosado]  08/04/2016  Created
 /// </history>
 private void imgPreview_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (UIRichTextBoxHelper.HasInfo(ref richTextBox))
     {
         StaStart("Loading preview...");
         fillMailReport();
         var _frmViewer = new frmViewer(_rptMailOuts);
         _frmViewer.ShowDialog();
         StaEnd();
     }
     else
     {
         UIHelper.ShowMessage("There is no info to show a preview view.", MessageBoxImage.Information, "Mail Outs Configuration");
     }
 }
        /// <summary>
        /// Imprime el reporte RefundsLetter
        /// </summary>
        /// <history>
        /// [edgrodriguez] 15/Jul/2016 Created
        /// </history>
        private async void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            var Refund = grdRefund.SelectedItem as DepositsRefund;

            if (Refund != null)
            {
                var RptRefundLetter = await BRDepositsRefund.GetRptRefundLetter(Refund.drID);

                if (RptRefundLetter.Any())
                {
                    var objRptRefundletter = RptRefundLetter[0].Cast <RptRefundLetter>().FirstOrDefault();
                    var reportText         = await BRReportsTexts.GetReportTexts("RefundLetter", objRptRefundletter.gula);

                    var header = reportText[0].reText
                                 .Replace("[SaleRoom]", objRptRefundletter.SaleRoom)
                                 .Replace("[RefundDate]", objRptRefundletter.RefundDate.ToString())
                                 .Replace("[RefundID]", objRptRefundletter.RefundID.ToString())
                                 .Replace("[RefundFolio]", objRptRefundletter.RefundFolio.ToString())
                                 .Replace("[GuestID]", objRptRefundletter.GuestID.ToString())
                                 .Replace("[OutInvt]", objRptRefundletter.OutInvt)
                                 .Replace("[GuestNames]", objRptRefundletter.GuestNames)
                                 .Replace("[TotalAmount]", objRptRefundletter.TotalAmount.ToString("#,##0.00"))
                                 .Replace("[PRName]", objRptRefundletter.PRName);
                    var footer = reportText[1].reText;

                    var crptRefundLetter = new Reports.rptRefundLetter();
                    crptRefundLetter.Database.Tables["depositRefund"].SetDataSource(ObjectHelper.ObjectToList(objRptRefundletter));
                    crptRefundLetter.Database.Tables["reportText"].SetDataSource(ObjectHelper.ObjectToList(new Classes.objReportText {
                        Header = header, Footer = footer
                    }));
                    crptRefundLetter.Subreports["RptBookingDeposits.rpt"].SetDataSource(TableHelper.GetDataTableFromList(RptRefundLetter[1].Cast <RptRefundLetter_BookingDeposit>().ToList()));

                    CrystalReportHelper.SetLanguage(crptRefundLetter, objRptRefundletter.gula);

                    //(crptRefundLetter.ReportDefinition.ReportObjects["txtHeader"] as FieldObject).ObjectFormat. = header;
                    //(crptRefundLetter.ReportDefinition.ReportObjects["txtFooter"] as FieldObject).Text = footer;

                    var frmReportViewer = new frmViewer(crptRefundLetter);
                    frmReportViewer.Show();
                }
            }
            else
            {
                UIHelper.ShowMessage("Select a Refund from the list.");
            }
        }
        public frmEditProp()
        {
            InitializeComponent();
            // show all property values
            frmViewer frmView = new frmViewer();

            txtPropID.Text    = frmViewer.SetTextValuePropID;
            txtPropName.Text  = frmViewer.SetTextValuePropName;
            txtHostID.Text    = frmViewer.SetTextValueHostID;
            txtHostName.Text  = frmViewer.SetTextValueHostName;
            txtNumProp.Text   = Convert.ToString(frmViewer.SetTextValueNumProp);
            txtLati.Text      = frmViewer.SetTextValueLati;
            txtLongi.Text     = frmViewer.SetTextValueLongi;
            txtRoomType.Text  = frmViewer.SetTextValueRoomType;
            txtPrice.Text     = Convert.ToString(frmViewer.SetTextValuePrice);
            txtMinNights.Text = Convert.ToString(frmViewer.SetTextValueMinNights);
            txtDays.Text      = Convert.ToString(frmViewer.SetTextValueDays);
        }
Esempio n. 9
0
        /// <summary>
        ///Prepara el reporte de invitación para ser visualizado
        /// </summary>
        /// <history>
        /// [jorcanche] 16/04/2016 created
        /// [jorcanche] 12/05/2016 Se cambio de frmInvitaciona RptinvitationHelper
        /// </history>
        public static async void RptInvitation(int guest = 0, string peID = "USER", Window window = null)
        {
            //Traemos la informacion del store y la almacenamos en un procedimiento
            InvitationData invitationData = await BRInvitation.RptInvitationData(guest);

            //Le damos memoria al reporte de Invitacion
            var rptInvi = new rptInvitation();

            /************************************************************************************************************
             *                          Información Adiocional sobre el DataSource del Crystal
             *************************************************************************************************************
             * Para que el DataSource acepte una entidad primero se debe de converir a lista
             * 1.- ObjectHelper.ObjectToList(invitationData.Invitation)
             * Pero sí al convertirlo hay propiedades nulas, el DataSource no lo aceptara y marcara error; para evitar esto
             * se debera convertir a DateTable para que no tenga nulos.
             * 2.- TableHelper.GetDataTableFromList(ObjectHelper.ObjectToList(invitationData.Invitation))
             *************************************************************************************************************/

            //Le agregamos la informacion
            rptInvi.SetDataSource(TableHelper.GetDataTableFromList(ObjectHelper.ObjectToList(new IM.Base.Classes.RptInvitationIM(invitationData.Invitation))));
            //Cargamos los subreportes
            rptInvi.Subreports["rptInvitationGuests.rpt"].SetDataSource(TableHelper.GetDataTableFromList(invitationData.InvitationGuest?.Select(c => new IM.Base.Classes.RptInvitationGuestsIM(c)).ToList() ?? new List <Classes.RptInvitationGuestsIM>()));
            rptInvi.Subreports["rptInvitationDeposits.rpt"].SetDataSource(invitationData.InvitationDeposit?.Select(c => new IM.Base.Classes.RptInvitationDepositsIM(c)).ToList() ?? new List <Classes.RptInvitationDepositsIM>());
            rptInvi.Subreports["rptInvitationGifts.rpt"].SetDataSource(TableHelper.GetDataTableFromList(invitationData.InvitationGift?.Select(c => new IM.Base.Classes.RptInvitationGiftsIM(c)).ToList() ?? new List <Classes.RptInvitationGiftsIM>()));

            //Cambiamos el lenguaje de las etiquetas.
            CrystalReportHelper.SetLanguage(rptInvi, invitationData.Invitation.gula);

            //Fecha y hora
            rptInvi.SetParameterValue("lblDateTime", BRHelpers.GetServerDateTime());

            //Cambiado por
            rptInvi.SetParameterValue("lblChangedBy", peID);

            //Cargamos el Viewer
            var frmViewer = new frmViewer(rptInvi)
            {
                Owner = window
            };

            frmViewer.ShowDialog();
        }
Esempio n. 10
0
        /// <summary>
        /// Obtiene un reporte de Equity
        /// </summary>
        /// <param name="membershipNum">numero de membresia</param>
        /// <param name="company">compania</param>
        /// <param name="clubAgency">agencia</param>
        /// <param name="clubGuest">club</param>
        /// <param name="owner">Ventana padre</param>
        /// <history>
        /// [ecanul] 06/04/2016 Created
        /// [ecanul] 07/04/2016 Modificated Agregado Validaciones y "show" del reporte
        /// [ecanul] 20/04/2016 Modificated Metodo Movido de frmInhouse a EquityHelpers
        /// [ecanul] 06/07/2016 Modified. Agregue subreporte RptEquityMembershipsPrevious
        /// [ecanul] 08/09/2016 Modified. Agregado nombre del web service y Club en el titulo del mensaje que genero un error.
        /// [wtorres] 06/09/2016 Modified. Agregue el parametro owner
        /// </history>
        public static void EquityReport(string membershipNum, Decimal company, int?clubAgency, int?clubGuest,
                                        Window owner)
        {
            EnumClub club;

            // si tiene membrecia
            if (membershipNum != null && membershipNum != "")
            {//si tiene permiso para el reporte de equity
                if (Context.User.HasPermission(EnumPermission.Equity, EnumPermisionLevel.ReadOnly))
                {
                    // // // ShowReport
                    // determinamos el club
                    if (clubAgency != null && clubAgency != 0)
                    {
                        club = (EnumClub)clubAgency;
                    }
                    else if (clubGuest != null && clubGuest != 0)
                    {
                        club = (EnumClub)clubGuest;
                    }
                    else
                    {
                        //Si no se encuentra un club en la tabla de agencies o en la tabla del guest se manda un error diciendo esto y se sale del metodo
                        UIHelper.ShowMessage("Agency Not Found", MessageBoxImage.Error, "Equity Report");
                        return;
                    }

                    Services.ClubesService.RptEquity rptClubes = null;

                    var clubesTitle     = $"Equity Report - Clubes - {EnumToListHelper.GetEnumDescription(club)}";
                    var callCenterTitle = $"Equity Report - Credito y Cobranza - {EnumToListHelper.GetEnumDescription(club)}";
                    try
                    {
                        //obtenemos los datos del reporte del servicio de Clubes
                        rptClubes = ClubesHelper.GetRptEquity(membershipNum, Convert.ToInt32(company), club);
                    }
                    catch (Exception ex)
                    {
                        UIHelper.ShowMessage(ex, clubesTitle);
                        return;
                    }


                    //si no se pudo generenar el reporte en clubes y nos salimos
                    if (rptClubes == null)
                    {
                        UIHelper.ShowMessage("This report did not return data", MessageBoxImage.Exclamation, clubesTitle);
                        return;
                    }
                    //si no encontramos la membrecia en clubles, nos salimos
                    if (rptClubes.Membership == null)
                    {
                        UIHelper.ShowMessage("Membership not found", MessageBoxImage.Exclamation, clubesTitle);
                        return;
                    }
                    Services.CallCenterService.RptEquity rptCallCenter = null;
                    try
                    {
                        //Obtenemos la membrecia en el servicio de Call Center
                        rptCallCenter = CallCenterHelper.GetRptEquity(membershipNum, Convert.ToInt32(company), club);
                    }
                    catch (Exception ex)
                    {
                        UIHelper.ShowMessage(ex, callCenterTitle);
                        return;
                    }

                    // si no se pudo generar reporte en Call Center nos salimos
                    if (rptCallCenter == null)
                    {
                        UIHelper.ShowMessage("This report did not return data", MessageBoxImage.Exclamation, callCenterTitle);
                        return;
                    }

                    // si no encontramos la membresia en Credito y Cobranza Reserva, nos salimos
                    if (rptCallCenter.Membership == null)
                    {
                        UIHelper.ShowMessage("Membership not found", MessageBoxImage.Exclamation, callCenterTitle);
                        return;
                    }

                    // indicamos que ciertas listas del reporte no tienen registros
                    RptEquityHeader header = new RptEquityHeader();
                    header.HasGolfFields = rptClubes.GolfFieldsDetail.Length > 0;
                    header.IsElite       = (club == EnumClub.PalaceElite);

                    var equity = new rptEquity();
                    //datos generales de equity
                    equity.Database.Tables["Membership"].SetDataSource(ObjectHelper.ObjectToList(rptClubes.Membership));
                    equity.Database.Tables["Member"].SetDataSource(ObjectHelper.ObjectToList(rptCallCenter.Membership));
                    //Si no tiene un Salesman  con OPC no se envia nada
                    Services.ClubesService.RptEquitySalesman[] salesmanOPC = rptClubes.Salesmen.Where(sm => sm.Title.Trim() == "OPC").ToArray();
                    if (salesmanOPC.Length > 0)
                    {
                        equity.Database.Tables["SalesmanOPC"].SetDataSource(salesmanOPC);
                    }
                    equity.Database.Tables["Hotel"].SetDataSource(ObjectHelper.ObjectToList(rptClubes.Hotels));
                    equity.Database.Tables["GolfFieldsHeader"].SetDataSource(ObjectHelper.ObjectToList(rptClubes.GolfFieldsHeader));
                    if (rptClubes.Verification != null)
                    {
                        rptClubes.Verification.VOLUMENGOLF = rptCallCenter.Membership.Golf - (rptClubes.Verification.VOLUMENGOLF / EquityHelpers.GetIVAByOffice(rptClubes.Membership.OFFICE));
                    }
                    equity.Database.Tables["Verification"].SetDataSource(ObjectHelper.ObjectToList(rptClubes.Verification));
                    //Subreportes
                    if (club == EnumClub.PalaceElite)
                    {
                        header.HasMembershipsPrevious = rptClubes.MembershipsPrevious.Length > 0;
                        if (header.HasMembershipsPrevious)
                        {
                            equity.Subreports["rptEquityMembershipsPrevious.rpt"].SetDataSource(rptClubes.MembershipsPrevious);
                        }
                    }
                    equity.Subreports["rptEquitySalesman.rpt"].SetDataSource(rptClubes.Salesmen);
                    equity.Subreports["rptEquityCoOwners.rpt"].SetDataSource(rptClubes.CoOwners);

                    equity.Subreports["rptEquityBeneficiaries.rpt"].Database.Tables["Reporte"].SetDataSource(rptClubes.Beneficiaries);
                    equity.Subreports["rptEquityBeneficiaries.rpt"].Database.Tables["Membership"].SetDataSource(ObjectHelper.ObjectToList(rptCallCenter.Membership));

                    equity.Subreports["rptEquityGolfFields.rpt"].SetDataSource(rptClubes.GolfFieldsDetail);
                    equity.Subreports["rptEquityRoomTypes.rpt"].SetDataSource(rptClubes.RoomTypes);

                    RptEquityProvision[] provisionsSNORM = rptCallCenter.Provisions.Where(p => p.IsSNORM == true).ToArray();
                    header.HasSNORM = provisionsSNORM.Length > 0;
                    if (header.HasSNORM)
                    {
                        equity.Subreports["rptEquityProvisionsSNORM.rpt"].SetDataSource(provisionsSNORM);
                    }

                    RptEquityProvision[] provisionsSAIRF = rptCallCenter.Provisions.Where(p => p.IsSAIRF == true).ToArray();
                    header.HasSAIRF = provisionsSAIRF.Length > 0;
                    equity.Subreports["rptEquityProvisionsSAIRF.rpt"].SetDataSource(provisionsSAIRF);

                    RptEquityProvision[] provisionsSRCI = rptCallCenter.Provisions.Where(p => p.IsSRCI == true).ToArray();
                    header.HasSRCI = provisionsSRCI.Length > 0;
                    equity.Subreports["rptEquityProvisionsSRCI.rpt"].SetDataSource(provisionsSRCI);

                    RptEquityProvision[] provisionsSCOMP = rptCallCenter.Provisions.Where(p => p.IsSCOMP == true).ToArray();
                    header.HasSCOMP = provisionsSCOMP.Length > 0;
                    equity.Subreports["rptEquityProvisionsSCOMP.rpt"].SetDataSource(provisionsSCOMP);

                    RptEquityProvision[] provisionsSCRG = rptCallCenter.Provisions.Where(p => p.IsSCRG == true).ToArray();
                    header.HasSCRG = provisionsSCRG.Length > 0;
                    equity.Subreports["rptEquityProvisionsSCRG.rpt"].SetDataSource(provisionsSCRG);

                    RptEquityProvision[] provisionsSIGR = rptCallCenter.Provisions.Where(p => p.IsSIGR == true).ToArray();
                    header.HasSIGR = provisionsSIGR.Length > 0;
                    equity.Subreports["rptEquityProvisionsSIGR.rpt"].SetDataSource(provisionsSIGR);

                    RptEquityProvision[] provisionsSVEC = rptCallCenter.Provisions.Where(p => p.IsSVEC == true).ToArray();
                    header.HasSVEC = provisionsSVEC.Length > 0;
                    equity.Subreports["rptEquityProvisionsSVEC.rpt"].SetDataSource(provisionsSVEC);

                    RptEquityProvision[] provisionsSREF = rptCallCenter.Provisions.Where(p => p.IsSREF == true).ToArray();
                    header.HasSREF = provisionsSREF.Length > 0;
                    equity.Subreports["rptEquityProvisionsSREF.rpt"].SetDataSource(provisionsSREF);

                    equity.Database.Tables["Header"].SetDataSource(ObjectHelper.ObjectToList(header));
                    if (rptCallCenter.Reservations.Length != 0)
                    {
                        equity.Subreports["rptEquityReservations.rpt"].SetDataSource(rptCallCenter.Reservations);
                    }

                    if (rptClubes.BalanceElectronicPurseHeaders.Length == 0)
                    {
                        equity.Subreports["rptEquityBalanceElectronicPurse.rpt"].ReportDefinition.Sections["GroupHeaderSection1"].SectionFormat.EnableSuppress = true;
                    }
                    equity.Subreports["rptEquityBalanceElectronicPurse.rpt"].Database.Tables["EquityBalanceElectronicPurseDetail"].SetDataSource(rptClubes.BalanceElectronicPurseDetails);
                    equity.Subreports["rptEquityBalanceElectronicPurse.rpt"].Database.Tables["BalanceElectronicPurseHeader"].SetDataSource(rptClubes.BalanceElectronicPurseHeaders);
                    var sum = rptCallCenter.Membership.Down - rptCallCenter.Membership.Down_escrow - rptCallCenter.Membership.Down_bal;
                    if (sum > 1)
                    {
                        equity.Subreports["rptEquityPaymentPromises.rpt"].SetDataSource(rptClubes.PaymentPromises);
                    }
                    if (club == EnumClub.PalaceElite)
                    {
                        equity.Subreports["rptEquityWeeksNights.rpt"].Database.Tables["WeeksNightsDetail"].SetDataSource(rptClubes.WeeksNightsDetails);
                        equity.Subreports["rptEquityWeeksNights.rpt"].Database.Tables["WeeksNightsHeader"].SetDataSource(rptClubes.WeeksNightsHeaders);
                    }
                    if (club == EnumClub.PalaceElite)
                    {
                        equity.Subreports["rptEquityGolfRCI.rpt"].SetDataSource(rptClubes.GolfRCI);
                    }
                    else
                    {
                        equity.ReportDefinition.ReportObjects["srptGolfRCI"].ObjectFormat.EnableSuppress = true;
                    }
                    if (club == EnumClub.PalaceElite)
                    {
                        equity.Subreports["rptEquityPromotions.rpt"].SetDataSource(rptClubes.Promotions);
                    }

                    if (club == EnumClub.PalaceElite)
                    {
                        if (rptClubes.MemberExtension != null)
                        {
                            if (rptClubes.MemberExtension.WHOLESALER)
                            {
                                equity.ReportDefinition.Sections["Section2"].SectionFormat.EnableSuppress = false;
                            }
                        }
                    }

                    var frm = new frmViewer(equity);
                    frm.Owner = owner;
                    frm.ShowDialog();
                }
                else
                {
                    UIHelper.ShowMessage("Access denied");
                }
            }
        }
Esempio n. 11
0
        internal static void SaveSettings(frmViewer f)
        {
            if (!bIsViewOnly)
            {
                RegistryKey oReg = Registry.CurrentUser.CreateSubKey(GetRegPath("UI"));
                oReg.SetValue("StackedLayout", bStackedLayout);
                oReg.SetValue("AutoScroll", bAutoScroll);
                oReg.SetValue("SmartScroll", bSmartScroll);
                oReg.SetValue("SearchUnmarkOldHits", bSearchUnmarkOldHits);
                oReg.SetValue("ResetCounterOnClear", bResetCounterOnClear);
                oReg.SetValue(f.Name + "_WState", (int)f.WindowState);
                if (f.WindowState != FormWindowState.Normal)
                {
                    if (!f.Visible)
                    {
                        f.Visible = true;
                    }
                    f.WindowState = FormWindowState.Normal;
                }
                oReg.SetValue(f.Name + "_Top", f.Top);
                oReg.SetValue(f.Name + "_Left", f.Left);
                oReg.SetValue(f.Name + "_Height", f.Height);
                oReg.SetValue(f.Name + "_Width", f.Width);

                oReg.SetValue("tabsRequest_Height", f.tabsRequest.Height);
                string str = string.Empty;
                foreach (ColumnHeader header in f.lvSessions.Columns)
                {
                    Utilities.LV_COLUMN lParam = new Utilities.LV_COLUMN {
                        mask = 0x20
                    };
                    Utilities.SendLVMessage(f.lvSessions.Handle, 0x105f, (IntPtr)header.Index, ref lParam);
                    str = str + lParam.iOrder.ToString() + ",";
                }
                oReg.SetValue("lvSessions_order", str.Substring(0, str.Length - 1));
                str = string.Empty;
                foreach (ColumnHeader header2 in f.lvSessions.Columns)
                {
                    str = str + header2.Width.ToString() + ",";
                }
                oReg.SetValue("lvSessions_widths", str.Substring(0, str.Length - 1));
                oReg.Close();
                oReg = Registry.CurrentUser.CreateSubKey(sRootKey);
                oReg.SetValue("StartupCount", iStartupCount);
                Utilities.SetRegistryString(oReg, "FontSize", flFontSize.ToString(CultureInfo.InvariantCulture));
                oReg.SetValue("colorDisabledEdit", colorDisabledEdit.ToArgb());
                oReg.SetValue("AttachOnBoot", bAttachOnBoot);
                oReg.SetValue("AllowRemote", m_bAllowRemoteConnections);
                oReg.SetValue("ReuseServerSockets", bReuseServerSockets);
                oReg.SetValue("ReuseClientSockets", bReuseClientSockets);
                Utilities.SetRegistryString(oReg, "FiddlerBypass", sHostsThatBypassFiddler);
                oReg.SetValue("ReportHTTPErrors", bReportHTTPErrors);
                oReg.SetValue("UseGateway", bForwardToGateway);
                oReg.SetValue("CaptureCONNECT", bCaptureCONNECT);
                oReg.SetValue("CaptureFTP", bCaptureFTP);
                oReg.SetValue("EnableIPv6", bEnableIPv6);
                oReg.SetValue("BreakOnImages", bBreakOnImages);
                oReg.SetValue("MapSocketToProcess", bMapSocketToProcess);
                oReg.SetValue("UseAESForSaz", bUseAESForSAZ);
                oReg.SetValue("AutoStreamAudioVideo", bStreamAudioVideo);
                oReg.SetValue("CaptureHTTPS", bMITM_HTTPS);
                oReg.SetValue("IgnoreServerCertErrors", bIgnoreServerCertErrors);
                oReg.SetValue("CheckForUpdates", bVersionCheck);
                oReg.SetValue("HookAllConnections", bHookAllConnections);
                oReg.SetValue("HookWithPAC", bHookWithPAC);
                oReg.SetValue("ShowProcessFilter", (int)iShowProcessFilter);
                oReg.SetValue("AutoReloadScript", bAutoLoadScript);
                oReg.SetValue("HideOnMinimize", bHideOnMinimize);
                oReg.SetValue("AlwaysShowTrayIcon", bAlwaysShowTrayIcon);
                if (!bUsingPortOverride)
                {
                    oReg.SetValue("ListenPort", m_ListenPort);
                }
                oReg.SetValue("HotkeyMod", iHotkeyMod);
                oReg.SetValue("Hotkey", iHotkey);
                oReg.SetValue("CheckForISA", m_bCheckForISA);
                Utilities.SetRegistryString(oReg, "ScriptReferences", m_sAdditionalScriptReferences);
                Utilities.SetRegistryString(oReg, "JSEditor", m_JSEditor);
            }
        }
Esempio n. 12
0
        internal static void RetrieveFormSettings(frmViewer f)
        {
            if (Utilities.GetAsyncKeyState(0x10) < 0)
            {
                FiddlerApplication._frmSplash.Visible = false;
                if (DialogResult.Yes == MessageBox.Show("SHIFT Key is down. Start with default form layout?", "Safe mode", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                {
                    bRevertToDefaultLayout = true;
                    FiddlerApplication._frmSplash.Visible = true;
                    return;
                }
                FiddlerApplication._frmSplash.Visible = true;
            }
            try
            {
                RegistryKey oReg = Registry.CurrentUser.OpenSubKey(GetRegPath("UI"));
                if (oReg != null)
                {
                    bStackedLayout                = Utilities.GetRegistryBool(oReg, "StackedLayout", false);
                    bAutoScroll                   = Utilities.GetRegistryBool(oReg, "AutoScroll", bSmartScroll);
                    bSearchUnmarkOldHits          = Utilities.GetRegistryBool(oReg, "SearchUnmarkOldHits", bSearchUnmarkOldHits);
                    bSmartScroll                  = Utilities.GetRegistryBool(oReg, "SmartScroll", bSmartScroll);
                    bResetCounterOnClear          = Utilities.GetRegistryBool(oReg, "ResetCounterOnClear", bResetCounterOnClear);
                    f.miSessionListScroll.Checked = bAutoScroll;

                    f.Bounds             = new Rectangle(Utilities.GetRegistryInt(oReg, f.Name + "_Left", f.Left), Utilities.GetRegistryInt(oReg, f.Name + "_Top", f.Top), Utilities.GetRegistryInt(oReg, f.Name + "_Width", f.Width), Utilities.GetRegistryInt(oReg, f.Name + "_Height", f.Height));
                    f.pnlSessions.Width  = (int)oReg.GetValue("pnlSessions_Width", f.pnlSessions.Width);
                    f.tabsRequest.Height = (int)oReg.GetValue("tabsRequest_Height", f.tabsRequest.Height);
                }
                new Point(f.Left, f.Top);
                Screen    screen    = Screen.FromRectangle(f.DesktopBounds);
                Rectangle rectangle = Rectangle.Intersect(f.DesktopBounds, screen.WorkingArea);
                if (rectangle.IsEmpty || ((rectangle.Width * rectangle.Height) < ((0.2 * f.Width) * f.Height)))
                {
                    f.SetDesktopLocation(screen.WorkingArea.Left + 20, screen.WorkingArea.Top + 20);
                }
                if (oReg != null)
                {
                    FormWindowState state = (FormWindowState)oReg.GetValue(f.Name + "_WState", f.WindowState);
                    if (state != FormWindowState.Minimized)
                    {
                        f.WindowState = state;
                    }
                    if (f.pnlSessions.Width > (f.Width - 50))
                    {
                        f.pnlSessions.Width = f.Width - 0x2d;
                    }
                    if (f.tabsRequest.Height > (f.Height - 250))
                    {
                        f.tabsRequest.Height = f.Height - 0xf5;
                    }
                    if (f.pnlSessions.Width < 0x19)
                    {
                        f.pnlSessions.Width = 0x19;
                    }
                    if (f.tabsRequest.Height < 0x19)
                    {
                        f.tabsRequest.Height = 0x19;
                    }
                    string[] strArray = null;
                    string   str      = (string)oReg.GetValue("lvSessions_widths");
                    if (str != null)
                    {
                        strArray = str.Split(new char[] { ',' });
                        if ((strArray != null) && (strArray.Length < f.lvSessions.Columns.Count))
                        {
                            strArray = null;
                        }
                    }
                    str = (string)oReg.GetValue("lvSessions_order");
                    if (str != null)
                    {
                        string[] strArray2 = str.Split(new char[] { ',' });
                        int[]    numArray  = new int[strArray2.Length];
                        for (int i = 0; i < strArray2.Length; i++)
                        {
                            numArray[i] = int.Parse(strArray2[i]);
                        }
                        if (numArray.Length >= f.lvSessions.Columns.Count)
                        {
                            for (int j = 0; j < f.lvSessions.Columns.Count; j++)
                            {
                                Utilities.LV_COLUMN lParam = new Utilities.LV_COLUMN {
                                    mask   = 0x20,
                                    iOrder = numArray[j]
                                };
                                Utilities.SendLVMessage(f.lvSessions.Handle, 0x1060, (IntPtr)j, ref lParam);
                                if (strArray != null)
                                {
                                    f.lvSessions.Columns[j].Width = int.Parse(strArray[j]);
                                }
                            }
                        }
                    }
                    oReg.Close();
                }
                if (bStackedLayout)
                {
                    f.actToggleStackedLayout(true);
                }
            }
            catch (Exception)
            {
            }
        }