Inheritance: BasePage
Exemplo n.º 1
0
        public async Task <ActionResult> Edit(ReportView view)
        {
            if (!ModelState.IsValid)
            {
                return(View(view));
            }
            const string folder = "~/Content/Logos";

            var pic = view.Imagen;

            if (view.ImageFile != null)
            {
                pic = Files.UploadPhoto(view.ImageFile, folder, "");
                pic = string.Format("{0}/{1}", folder, pic);
            }

            var report = ToReport(view);

            report.Imagen = pic;

            _db.Entry(report).State = EntityState.Modified;
            await _db.SaveChangesAsync();

            // return RedirectToAction($"Details/{report.UserId}");
            return(RedirectToAction($"Details/{report.AuthorId}"));
            //ViewBag.UserId = new SelectList(_db.Users, "UserId", "Code", view.UserId);
        }
Exemplo n.º 2
0
        private void WiseSalesReportbuttonbutton_Click(object sender, EventArgs e)
        {
            ReportView      f2 = new ReportView();
            TableLogOnInfos reportLogonInfos = new TableLogOnInfos();
            TableLogOnInfo  reportLogonInfo  = new TableLogOnInfo();
            ConnectionInfo  reportConInfo    = new ConnectionInfo();
            Tables          tables           = default(Tables);
            //	Table table = default(Table);
            var with1 = reportConInfo;

            with1.ServerName   = "tcp:KyotoServer,49172";
            with1.DatabaseName = "ProductNRelatedDB";
            with1.UserID       = "sa";
            with1.Password     = "******";
            CompanyWiseSalesReport sr = new CompanyWiseSalesReport();

            tables = sr.Database.Tables;
            foreach (Table table in tables)
            {
                reportLogonInfo = table.LogOnInfo;
                reportLogonInfo.ConnectionInfo = reportConInfo;
                table.ApplyLogOnInfo(reportLogonInfo);
            }
            f2.crystalReportViewer1.ReportSource = sr;
            this.Visible = false;
            f2.ShowDialog();
            this.Visible = true;
        }
Exemplo n.º 3
0
        public async Task <ActionResult> Create(int id)
        {
            //int userId = 0;
            // var manager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()));
            //  var currentUser = manager.FindById(User.Identity.GetUserId());
            // id =   UsersHelper.GetUserId(currentUser.Email);
            //   userId = UsersHelper.GetUserId(currentUser.Email);
            // ViewBag.UserId = new SelectList(_db.Users, "UserId", "Code", id);
            //var view = new ReportView { UserId = id, AuthorId=Convert.ToInt32(TempData["AuthorID"]) };
            var autorid = await GetAuthorId();

            var view = new ReportView {
                AuthorId = autorid
            };

            return(View(view));

            //var patient = await _db.Patients.FindAsync(id);

            //if (patient == null)
            //{
            //    return View("Error");
            //}
            //ViewBag.PatientId = new SelectList(_db.Patients, "PatientId", "PatientId");
            //var view = new Report { AuthorId = patient.PatientId, };

            //return View(view);
        }
Exemplo n.º 4
0
        private void show_btn_Click(object sender, EventArgs e)
        {
            if (!CBMyKitchen.Checked)
            {
                Where  = "";
                Filter = "";
                uC_TVKitchens1.Kitchen_Checked(ref f, ref Where);
            }
            else
            {
                Where  = " Restaurant_ID IN (1) AND Kitchen_ID IN (1)";
                Filter = "Kitchen: My kitchen";
            }

            if (TxtItemCode.Text.ToString() != "")
            {
                Where += " AND ItemID = '" + TxtItemCode.Text.ToString() + "'";
            }

            ReportView Rec = new ReportView();

            Rec.Rpt = new CR_InventoryStats();

            DataTable dt = Classes.RetrieveData("*", Where, "InventoryStats");

            Rec.Rpt.SetDataSource(dt);
            Rec.Rpt.SetParameterValue("Filter", Filter);
            Rec.Show();
        }
Exemplo n.º 5
0
        private async Task MakeAReportExecute()
        {
            ReportSettings repSettings = new ReportSettings();

            repSettings.TerminalId    = SelectedTerminal;
            repSettings.StartDateTime = From;
            repSettings.EndDateTime   = To;
            foreach (var propertySetting in EnabledReportProperties)
            {
                if (propertySetting.Enabled)
                {
                    repSettings.Properties.Add(propertySetting.ReportProperty);
                }
            }

            Window wnd = new Window();

            wnd.WindowStyle = WindowStyle.ToolWindow;
            wnd.Content     = new BusyIndicator()
            {
                IsBusy = true
            };
            wnd.SizeToContent = SizeToContent.WidthAndHeight;
            wnd.Show();

            IsWaiting = true;
            var res = ReportDto.Unwrap(await _reportsService.BuildReport(ReportSettingsDto.Wrap(repSettings)));

            IsWaiting = false;

            ReportView z = new ReportView();

            z.DataContext = new ReportViewModel(res);
            wnd.Content   = z;
        }
Exemplo n.º 6
0
        public static void generateInvoice()
        {
            int idx = idxH_Trans;
            H_Trans_ItemModel hti = new H_Trans_ItemModel();
            DataRow           row = hti.Table.Select($"ID ='{list_htrans[idx].ID}'").FirstOrDefault();

            if (row["STATUS"].ToString() == "P")
            {
                CustomerInvoice customerInvoice = new CustomerInvoice();
                ReportView      rv = new ReportView(customerInvoice);

                rv.setParam("kodeH_Trans", row["KODE"].ToString());
                if (row["ID_PROMO"].ToString() == "")
                {
                    rv.setParam("kodePromo", "-");
                }
                else
                {
                    PromoModel pm       = new PromoModel();
                    DataRow    rowPromo = pm.Table.Select($"ID = '{row["ID_PROMO"]}'").First();
                    rv.setParam("kodePromo", rowPromo["KODE"].ToString());
                }
                string path = (ImageHelper.getDebugPath() + "\\Resource\\Items\\");
                rv.setParam("imagePath", path);
                rv.ShowDialog();
            }
            else
            {
                MessageBox.Show("Transaksi yang belum dibayar!");
            }
        }
Exemplo n.º 7
0
        private void ShowBtn_Click(object sender, EventArgs e)
        {
            if (!CBMyKitchen.Checked)
            {
                Where  = "";
                Filter = "";
                uC_TVKitchens1.Kitchen_Checked(ref f, ref Where);
            }
            else
            {
                Where  = " Restaurant_ID IN (1) AND Kitchen_ID IN (1)";
                Filter = "Kitchen: My kitchen";
            }

            Where += "And Receiving_Date between '" + Convert.ToDateTime(dtp_from.Value).ToString(Classes.sysDateTimeFormat) + "' AND '" + Convert.ToDateTime(dtp_to.Value).ToString(Classes.sysDateTimeFormat) + "'";

            DataTable  dt  = Classes.RetrieveData("*", Where, "ReceiveOrderView");
            ReportView Rec = new ReportView();

            Rec.Rpt = new CR_ReceiveOrder();
            Rec.Rpt.SetDataSource(dt);
            Rec.Rpt.SetParameterValue("Rpt_Fdate", dtp_from.Value);
            Rec.Rpt.SetParameterValue("Rpt_Tdate", dtp_to.Value);
            Rec.Rpt.SetParameterValue("Filter", Filter);

            Rec.Show();
        }
Exemplo n.º 8
0
 private void cboDelivered_warehouse_SelectedValueChanged(object sender, EventArgs e)
 {
     if (FormEvents == 1 || FormEvents == 2)
     {
         Int64 warehouseId = -1;
         if (cboDelivered_warehouse.SelectedValue != null && (Int64)cboDelivered_warehouse.SelectedValue != Int64.MinValue)
         {
             warehouseId = (Int64)cboDelivered_warehouse.SelectedValue;
         }
         var dtReport = ReportView.reportFinal(warehouseId, string.Empty, DateTime.MinValue, DateTime.MinValue);
         dtItem.Clear();
         dtItem.Merge(dtReport);
         dtItem.AcceptChanges();
     }
     else
     {
         InventoryEntities invEntities = new InventoryEntities();
         List <item>       listI       = new List <item>();
         var resultI = (from i in invEntities.items orderby i.item_code select i);
         listI.AddRange(new item[] { new item {
                                         item_id = Int64.MinValue, item_code = "<Select a subject>", item_name = "<Select a subject>"
                                     } });
         foreach (item item in resultI)
         {
             listI.Add(item);
         }
         DataTable tblResultI = Utils.ConvertToDataTable(listI);
         dtItem.Clear();
         dtItem.Merge(tblResultI);
         dtItem.AcceptChanges();
     }
 }
Exemplo n.º 9
0
 private static Report ToReport(ReportView view)
 {
     if (view == null)
     {
         throw new ArgumentNullException(nameof(view));
     }
     return(new Report()
     {
         MainHeader = view.MainHeader,
         ReportId = view.ReportId,
         Header1 = view.Header1,
         Header2 = view.Header2,
         Header3 = view.Header3,
         Description = view.Description,
         MainFooter = view.MainFooter,
         Footer1 = view.Footer1,
         Footer2 = view.Footer2,
         Footer3 = view.Footer3,
         Width = view.Width,
         Heigh = view.Heigh,
         Imagen = view.Imagen,
         AuthorId = view.AuthorId,
         //  UserId = view.UserId
     });
 }
Exemplo n.º 10
0
 public static void SaveXmlRead(string tempSavePath, string serialNo, ref ReportView report, ref List<string> image)
 {
     string[] files = Directory.GetFiles(tempSavePath, serialNo + "*.xml", SearchOption.TopDirectoryOnly);
     if (files.Length > 0)
     {
         ArrayList arrayList = new ArrayList();
         string[] array = files;
         foreach (string value in array)
         {
             arrayList.Add(value);
         }
         arrayList.Sort();
         string filename = (string)arrayList[arrayList.Count - 1];
         Dictionary<string, string> dictionary = new Dictionary<string, string>();
         List<string> list = new List<string>();
         XmlDocument xmlDocument = new XmlDocument();
         xmlDocument.Load(filename);
         XmlNode xmlNode = xmlDocument.SelectSingleNode("data/report");
         foreach (XmlNode childNode in xmlNode.ChildNodes)
         {
             if (childNode.NodeType != XmlNodeType.Comment)
             {
                 string localName = childNode.LocalName;
                 string innerText = childNode.InnerText;
                 if (dictionary.ContainsKey(localName))
                 {
                     Dictionary<string, string> dictionary2;
                     string key;
                     (dictionary2 = dictionary)[key = localName] = dictionary2[key] + "," + innerText;
                 }
                 else
                 {
                     dictionary.Add(localName, innerText);
                 }
             }
         }
         XmlNode xmlNode3 = xmlDocument.SelectSingleNode("data/image");
         foreach (XmlNode childNode2 in xmlNode3.ChildNodes)
         {
             if (childNode2.NodeType != XmlNodeType.Comment)
             {
                 string innerText2 = childNode2.InnerText;
                 list.Add(innerText2);
             }
         }
         if (dictionary.ContainsKey("Finding"))
         {
             report.Finding = dictionary["Finding"];
         }
         if (dictionary.ContainsKey("Diagnosing"))
         {
             report.Diagnosing = dictionary["Diagnosing"];
         }
         image.Clear();
         foreach (string item in list)
         {
             image.Add(item);
         }
     }
 }
Exemplo n.º 11
0
        public static ReportView ConvertToView(ReportModel report)
        {
            var reportView = new ReportView
            {
                Id             = report.Id,
                Content        = report.Content,
                Title          = report.Title,
                ReportCategory = report.ReportCategory,
                User           = report.User,
                Spider         = report.Spider,
                Views          = report.Views,
                AddDate        = report.AddDate
            };

            if (report.ReportImage == null)
            {
                reportView.ImageUrl = "https://res.cloudinary.com/dyytlulq9/image/upload/v1609687626/logo_dirysy.png";
            }
            else
            {
                reportView.ImageUrl = report.ReportImage.Url;
            }

            return(reportView);
        }
Exemplo n.º 12
0
        public void reportcall()
        {
            ReportView rv = new ReportView();
            ReportSet  ds = new ReportSet();

            foreach (ReportContainerClass rc in GPData.reportlist)
            {
                if (rc.soptype == 4)
                {
                    valuecontainer  = (rc.quantity - (rc.quantity * 2));
                    valuecontainer2 = (rc.price - (rc.price * 2));
                }
                else
                {
                    valuecontainer  = rc.quantity;
                    valuecontainer2 = rc.price;
                }
                DataRow cRow = ds.ReportViewer.NewRow();
                cRow["SOPNUMBER"]       = rc.sopnumber;
                cRow["ITEMNUMBER"]      = rc.itemnumber;
                cRow["ITEMDESCRIPTION"] = rc.itemDescription;
                cRow["CUSTOMERNAME"]    = rc.custname;
                cRow["QUANTITY"]        = valuecontainer;
                cRow["DOCDATE"]         = rc.docdate;
                cRow["PRICE"]           = valuecontainer2;
                ds.ReportViewer.Rows.Add(cRow);
            }
            rv.DataDefinition.FormulaFields["startDate"].Text = "\"" + date1 + "\"";
            rv.DataDefinition.FormulaFields["End Date"].Text  = "\"" + date2 + "\"";
            rv.DataDefinition.FormulaFields["Customer"].Text  = "\"" + customer + "\"";
            rv.SetDataSource(ds);
            crystalReportViewer1.ReportSource = rv;
            crystalReportViewer1.Refresh();
        }
Exemplo n.º 13
0
        private void InitializeViews()
        {
            _browserView   = new BrowserView();
            _dataViewModel = new DataViewModel();
            _dataViewModel.ReportSelectionChanged += OnReportSelectionChanged;
            _dataView = new DataView
            {
                DataContext = _dataViewModel
            };

            _reportViewModel = new ReportViewModel(_browserView, _dataViewModel, _dataView, GetSelectedProject());
            _reportView      = new ReportView
            {
                DataContext = _reportViewModel
            };

            var reports = _reportsController.GetReports(true).Result;

            _reportsNavigationViewModel = new ReportsNavigationViewModel(reports, GetSettings(), _pathInfo, GetSelectedProject());
            _reportsNavigationViewModel.ReportSelectionChanged += OnReportSelectionChanged;
            _reportsNavigationViewModel.ReportViewModel         = _reportViewModel;
            _reportsNavigationViewModel.SelectedProject         = _reportsController?.Project;
            _reportsNavigationViewModel.ProjectLocalFolder      = _reportsController?.ProjectLocalFolder;
            _reportsNavigationView.DataContext = _reportsNavigationViewModel;
        }
Exemplo n.º 14
0
        public DataTemplate ExtractReportFooter(ReportView reportView)
        {
            ResourceDictionary resourceDictionary = reportView.Resources;
            DataTemplate       footerTemplate     = resourceDictionary["ReportFooterDataTemplate"] as DataTemplate;

            return(footerTemplate);
        }
        private void InitializeViews()
        {
            _browserView   = new BrowserView();
            _dataViewModel = new DataViewModel();
            _dataViewModel.ReportSelectionChanged += OnReportSelectionChanged;
            _dataView = new DataView
            {
                DataContext = _dataViewModel
            };

            _reportViewModel = new ReportViewModel(_browserView, _dataViewModel, _dataView);
            _reportView      = new ReportView
            {
                DataContext = _reportViewModel
            };

            var reports = ReportsController.GetReports(false).Result;

            _reportsNavigationViewModel = new ReportsNavigationViewModel(reports, GetSettings(), _pathInfo);
            _reportsNavigationViewModel.ReportSelectionChanged += OnReportSelectionChanged;
            _reportsNavigationViewModel.ReportViewModel         = _reportViewModel;
            _reportsNavigationViewModel.ProjectLocalFolder      = ReportsController.GetProjectLocalFolder();

            _reportsNavigationView = new ReportsNavigationView(_reportsNavigationViewModel);
            _reportsNavigationViewModel.ReportsNavigationView = _reportsNavigationView;

            _reportViewControl.UpdateViewModel(_reportView);
            _reportsNavigationViewControl.UpdateViewModel(_reportsNavigationView);
        }
Exemplo n.º 16
0
        public override void update()
        {
            List<CswNbtView> ReportViews = _CswNbtSchemaModTrnsctn.restoreViews( "Reports" );
            foreach( CswNbtView ReportView in ReportViews )
            {
                if( ReportView.Visibility != CswEnumNbtViewVisibility.Property )
                {
                    ReportView.Root.ChildRelationships.Clear();
                    CswNbtMetaDataObjectClass ReportGroupOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ReportGroupClass );
                    CswNbtViewRelationship ReportGroupVR = ReportView.AddViewRelationship( ReportGroupOC, IncludeDefaultFilters: false );
                    CswNbtMetaDataObjectClass ReportOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ReportClass );
                    CswNbtMetaDataObjectClassProp ReportGroupOCP = ReportOC.getObjectClassProp( CswNbtObjClassReport.PropertyName.ReportGroup );
                    ReportView.AddViewRelationship( ReportGroupVR, CswEnumNbtViewPropOwnerType.Second, ReportGroupOCP, false );
                    ReportView.save();
                }
            }

            List<CswNbtView> MailReportViews = _CswNbtSchemaModTrnsctn.restoreViews( "Mail Reports" );
            foreach( CswNbtView MailReportView in MailReportViews )
            {
                _updateMailReportView( MailReportView );
            }

            List<CswNbtView> MailReportFEViews = _CswNbtSchemaModTrnsctn.restoreViews( "Mail Reports (FE)" );
            foreach( CswNbtView MailReportView in MailReportFEViews )
            {
                _updateMailReportView( MailReportView );
            }

            List<CswNbtView> MailReportIMCSViews = _CswNbtSchemaModTrnsctn.restoreViews( "Mail Reports (IMCS)" );
            foreach( CswNbtView MailReportView in MailReportIMCSViews )
            {
                _updateMailReportView( MailReportView );
            }
        } // update()
Exemplo n.º 17
0
        }           //Done swap From To Types of Date

        private void show_btn_Click(object sender, EventArgs e)
        {
            if (!CBMyKitchen.Checked)
            {
                Where  = "";
                Filter = "";
                UC_TVKitchens2.Kitchen_Checked(ref f, ref Where);
            }
            else
            {
                Where  = " Restaurant_ID IN (1) AND Kitchen_ID IN (1)";
                Filter = "Kitchen: My kitchen";
            }

            if (BtnCreateDate.Checked == true)
            {
                Where  += "And Create_Date between '" + Convert.ToDateTime(dtp_from.Value).ToString(Classes.sysDateTimeFormat) + "' AND '" + Convert.ToDateTime(dtp_to.Value).ToString(Classes.sysDateTimeFormat) + "'";
                Filter += " \n" + "Date : Create_Date";
            }
            else if (BtnDeliveryDate.Checked == true)
            {
                Where  += "And Delivery_Date between '" + Convert.ToDateTime(dtp_from.Value).ToString(Classes.sysDateTimeFormat) + "' AND '" + Convert.ToDateTime(dtp_to.Value).ToString(Classes.sysDateTimeFormat) + "'";
                Filter += " \n" + "Date : Delivery_Date";
            }
            DataTable  dt  = Classes.RetrieveData("*", Where, "POView");
            ReportView Rec = new ReportView();

            Rec.Rpt = new CR_PO();
            Rec.Rpt.SetDataSource(dt);
            Rec.Rpt.SetParameterValue("Rpt_Fdate", dtp_from.Value);
            Rec.Rpt.SetParameterValue("Rpt_Tdate", dtp_to.Value);
            Rec.Rpt.SetParameterValue("Filter", Filter);
            Rec.Show();
        }
Exemplo n.º 18
0
        public void reportcall()
        {
            ReportView rv = new ReportView();
            ReportSet ds = new ReportSet();

            foreach (ReportContainerClass rc in GPData.reportlist)
            {
                if (rc.soptype == 4)
                {
                    valuecontainer = (rc.quantity - (rc.quantity * 2));
                    valuecontainer2 = (rc.price - (rc.price * 2));
                }
                else
                {
                    valuecontainer = rc.quantity;
                    valuecontainer2 = rc.price;
                }
                DataRow cRow = ds.ReportViewer.NewRow();
                cRow["SOPNUMBER"] = rc.sopnumber;
                cRow["ITEMNUMBER"] = rc.itemnumber;
                cRow["ITEMDESCRIPTION"] = rc.itemDescription;
                cRow["CUSTOMERNAME"] = rc.custname;
                cRow["QUANTITY"] = valuecontainer;
                cRow["DOCDATE"] = rc.docdate;
                cRow["PRICE"] = valuecontainer2;
                ds.ReportViewer.Rows.Add(cRow);

            }
            rv.DataDefinition.FormulaFields["startDate"].Text = "\"" + date1 + "\"";
            rv.DataDefinition.FormulaFields["End Date"].Text = "\"" + date2 + "\"";
            rv.DataDefinition.FormulaFields["Customer"].Text = "\"" + customer + "\"";
            rv.SetDataSource(ds);
            crystalReportViewer1.ReportSource = rv;
            crystalReportViewer1.Refresh();
        }
Exemplo n.º 19
0
        public async Task <ActionResult> SendEmail(EmailFormModel emailModel, ReportView ReportModel)
        {
            if (ModelState.IsValid)
            {
                var body    = "<p>11/28/2016</p><p>Dear Council Person,</p><p>Following are concerns submitted by citizens on citizenconnect.com.</p><p> For the week of November 28 - December 4: </p><p>- There have been 14 reported incidents of street light outtages. Please click *here* to view the location.</p><p>- There have been 19 reports of potholes. Please click *here* to view the location.</p><p></p><p>Thank you for prompt attention to these concerns. We apprecite the time and effort each of you take in making Cleveland a great place to live.</p><p></p><p>Sincerely,</p><p>Citizen Connect Administration</p>";
                var message = new MailMessage();
                message.Bcc.Add(new MailAddress("*****@*****.**"));     // replace with valid value
                message.Bcc.Add(new MailAddress("*****@*****.**"));
                message.From       = new MailAddress("*****@*****.**"); // replace with valid value
                message.Subject    = "Weekly Reports From Citizen Connect";
                message.Body       = string.Format(body);
                message.IsBodyHtml = true;
                using (var smtp = new SmtpClient())
                {
                    var credential = new NetworkCredential
                    {
                        UserName = "******", // replace with valid value
                        Password = "******"                   // replace with valid value
                    };
                    smtp.Credentials = credential;
                    smtp.Host        = "smtp.gmail.com";
                    smtp.Port        = 587;
                    smtp.EnableSsl   = true;
                    await smtp.SendMailAsync(message);

                    return(RedirectToAction("Sent"));
                }
            }
            return(View(emailModel));
        }
        public static void ElementFactory(Report report, ReportView reportView)
        {
            #region Get various Report sections
            //Get the "ReportSection element"
            //ReportSectionElement contains the ReportHeader, ReportPageHeader, ReportDetails. ReportPageFooter, ReportFooter sections.
            var mainReportSection = report.Elements.OfType <ReportSection>().FirstOrDefault();

            //Get the ReportHeader
            var reportHeader = mainReportSection?.Elements.OfType <ReportHeader>().FirstOrDefault();

            //Get the ReportHeader
            var reportPageHeader = mainReportSection?.Elements.OfType <ReportPageHeader>().FirstOrDefault();

            //Get the "ReportDetails" within the ReportSectionElement. ReportDetails is where "fields" are.
            var reportDetailsSection = mainReportSection?.Elements.OfType <ReportDetails>().FirstOrDefault();

            //Get the ReportPageFooter
            var reportPageFooter = mainReportSection?.Elements.OfType <ReportPageFooter>().FirstOrDefault();

            //Get the ReportFooter
            var reportFooter = mainReportSection?.Elements.OfType <ReportFooter>().FirstOrDefault();
            #endregion

            #region Select elements
            //ReportDetailsSection contains the "Fields"
            var elements = reportDetailsSection.GetElementsAsFlattenedList();
            reportDetailsSection.SelectElements(elements);
            #endregion

            #region Select all elements
            //Select all elements in the Report Footer.
            ReportPageFooter pageFooterSection = report.Elements.OfType <ReportSection>().FirstOrDefault().Elements.OfType <ReportPageFooter>().FirstOrDefault();
            pageFooterSection.SelectAllElements();
            #endregion

            #region Get selected elements
            IReadOnlyList <Element> selectedElements = report.GetSelectedElements();
            //Can also use the active ReportView
            IReadOnlyList <Element> selectedElementsFromView = ReportView.Active.GetSelectedElements();
            #endregion

            #region Zoom to selected elements
            QueuedTask.Run(() => reportView.ZoomToSelectedElements());
            #endregion Zoom to selected elements

            #region Clear element selection
            reportView.ClearElementSelection();
            #endregion

            #region Find specific elements in the report based on their Name.
            var reportElementsToFind = new List <string> {
                "ReportText1", "ReportText2"
            };
            var textReportElements = report.FindElements(reportElementsToFind);
            #endregion

            #region Delete Elements
            report.DeleteElements(textReportElements);
            #endregion
        }
Exemplo n.º 21
0
 private void B_Print_Click(object sender, EventArgs e)
 {
     ReportView.PageSettings.Margins = new Margins(0, 0, 0, 0);
     //ReportView.PageSettings.PrinterSettings. = new Margins(0, 0, 0, 0);
     ReportView.ShowPageSetupDialog();
     ReportView.ShowPrintDialog();
 }
Exemplo n.º 22
0
        void PrintReport()
        {
            ReportView.ShowPageSetupDialog();
            ReportView.ShowPrintDialog();

            /*
             * bool ret = ReadSrcData();
             * if (ret == true)
             * {
             *  ReportView.ShowPageSetupDialog();
             *  ReportView.ShowPrintDialog();
             * }
             * else
             * {
             *
             *  if (_isLoaded)
             *  {
             *      Close();
             *  }
             *  else
             *  {
             *      _closeOnStart = true;
             *  }
             * }
             */
        }
Exemplo n.º 23
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="report"></param>
 /// <param name="view"></param>
 /// <returns></returns>
 public bool UpdateReport(ReportTab report, ReportView view)
 {
     SqlParameter[] para =
     {
         new SqlParameter("@reportname",     SqlDbType.VarChar,    200),
         new SqlParameter("@bigtypeid",      SqlDbType.Int,          4),
         new SqlParameter("@smalltypeid",    SqlDbType.Int,          4),
         new SqlParameter("@price",          SqlDbType.VarChar,    200),
         new SqlParameter("@explain",        SqlDbType.NVarChar,  1000),
         new SqlParameter("@effectivedata",  SqlDbType.VarChar,     50),
         new SqlParameter("@invaliddata",    SqlDbType.VarChar,     50),
         new SqlParameter("@charges",        SqlDbType.Int,          4),
         new SqlParameter("@createdate",     SqlDbType.DateTime),
         new SqlParameter("@FormID",         SqlDbType.Int,          4),
         new SqlParameter("@Html",           SqlDbType.VarChar,    200),
         new SqlParameter("@auditid",        SqlDbType.Int,          4),
         new SqlParameter("@recommendID",    SqlDbType.Int,          4),
         new SqlParameter("@paytype",        SqlDbType.VarChar,    200),
         new SqlParameter("@Chartcount",     SqlDbType.Int,          4),
         new SqlParameter("@pagecount",      SqlDbType.Int,          4),
         new SqlParameter("@writing",        SqlDbType.VarChar,    200),
         new SqlParameter("@Publishingdate", SqlDbType.VarChar,     50),
         new SqlParameter("@message",        SqlDbType.NText),
         new SqlParameter("@Title",          SqlDbType.VarChar,    100),
         new SqlParameter("@keywords",       SqlDbType.VarChar,    100),
         new SqlParameter("@description",    SqlDbType.VarChar,    200),
         new SqlParameter("@OverTime",       SqlDbType.NVarChar,   150),
         new SqlParameter("@clickId",        SqlDbType.Int,          4),
         new SqlParameter("@flag",           SqlDbType.VarChar,     50),
         new SqlParameter("@IdEntity",       SqlDbType.Int, 4)
     };
     para[0].Value  = report.Reportname;
     para[1].Value  = report.Bigtypeid;
     para[2].Value  = report.Smalltypeid;
     para[3].Value  = report.Price;
     para[4].Value  = report.Explain;
     para[5].Value  = report.Effectivedata;
     para[6].Value  = report.Invaliddata;
     para[7].Value  = report.Charges;
     para[8].Value  = report.Createdate;
     para[9].Value  = report.FormID;
     para[10].Value = report.Html;
     para[11].Value = report.Auditid;
     para[12].Value = report.RecommendID;
     para[13].Value = view.Paytype;
     para[14].Value = view.Chartcount;
     para[15].Value = view.Pagecount;
     para[16].Value = view.Writing;
     para[17].Value = view.Publishingdate;
     para[18].Value = view.Message;
     para[19].Value = view.Title;
     para[20].Value = view.Keywords;
     para[21].Value = view.Description;
     para[22].Value = report.OverTime;
     para[23].Value = report.ClickId;
     para[24].Value = "UpdateManage";
     para[25].Value = report.ReportID;
     return(DBHelper.RunProcLob("ReportTab_insert", para));
 }
Exemplo n.º 24
0
        /// <summary>
        /// Attach inherited class additional presenters is needed
        /// </summary>
        public void AttachExtraPresenters(CLEMPresenter clemPresenter)
        {
            //UI Results
            try
            {
                ActivityLedgerGridView ledgerView = new ActivityLedgerGridView(clemPresenter.View as ViewBase);
                ReportView             rv         = new ReportView(clemPresenter.View as ViewBase);
                ViewBase reportView = new ViewBase(rv, "ApsimNG.Resources.Glade.DataStoreView.glade");

                Model report = clemPresenter.Model as Model;

                Simulations simulations = report.FindAncestor <Simulations>();
                if (simulations != null)
                {
                    dataStore = simulations.FindChild <IDataStore>();
                }

                DataStorePresenter          dataStorePresenter    = new DataStorePresenter();
                ActivityLedgerGridPresenter activityGridPresenter = new ActivityLedgerGridPresenter();
                Simulation simulation = report.FindAncestor <Simulation>();
                Zone       paddock    = report.FindAncestor <Zone>();

                if (paddock != null)
                {
                    dataStorePresenter.ZoneFilter = paddock;
                }

                if (simulation != null)
                {
                    if (simulation.Parent is Experiment)
                    {
                        dataStorePresenter.ExperimentFilter = simulation.Parent as Experiment;
                    }
                    else
                    {
                        dataStorePresenter.SimulationFilter = simulation;
                    }
                }

                dataStorePresenter.Attach(dataStore, reportView, clemPresenter.ExplorerPresenter);
                activityGridPresenter.CreateHtml     = (clemPresenter.Model as ReportActivitiesPerformed).CreateHTML;
                activityGridPresenter.ModelReport    = report as Report;
                activityGridPresenter.ModelName      = report.Name;
                activityGridPresenter.SimulationName = simulation.Name;
                activityGridPresenter.ZoneName       = paddock.Name;
                activityGridPresenter.Attach(dataStore, ledgerView, clemPresenter.ExplorerPresenter);
                dataStorePresenter.tableDropDown.SelectedValue = report.Name;

                (clemPresenter.View as CLEMView).AddTabView("Display", ledgerView);
                clemPresenter.PresenterList.Add("Display", activityGridPresenter);

                (clemPresenter.View as CLEMView).AddTabView("Data", reportView);
                clemPresenter.PresenterList.Add("Data", dataStorePresenter);
            }
            catch (Exception err)
            {
                this.explorerPresenter.MainPresenter.ShowError(err);
            }
        }
Exemplo n.º 25
0
 public ActionResult Create(ReportView model)
 {
     if (model.Hyperlink == null)
     {
         model.Hyperlink = false;
     }
     return(formSubmit(model, "Create"));
 }
Exemplo n.º 26
0
        public ActionResult Delete(Guid ID)
        {
            ReportView model = new ReportView();

            model.ID = ID;

            return(formSubmit(model, "Delete"));
        }
Exemplo n.º 27
0
 void exportViewsTranslations(ExecutionLogInterface log, ReportView view, Repository repository, StringBuilder translations, string reportPath, string separator, string extraSeparators, int len)
 {
     translations.AppendFormat("ReportViewName{0}{1}{0}{2}{3}\r\n", separator, Helper.QuoteDouble(reportPath.Substring(len)), Helper.QuoteDouble(view.Name), extraSeparators);
     foreach (var child in view.Views)
     {
         exportViewsTranslations(log, child, repository, translations, reportPath, separator, extraSeparators, len);
     }
 }
Exemplo n.º 28
0
        public StackPanel ExtractReportStackPanel(ReportView reportView)
        {
            StackPanel reportStackPanel = reportView.ReportStackPanel;

            reportStackPanel.Orientation = Orientation.Vertical;

            return(reportStackPanel);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            ReportView reportView = db.ReportViews.Find(id);

            db.ReportViews.Remove(reportView);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 30
0
        public static ReportModel MergeViewWithModel(ReportModel model, ReportView view)
        {
            model.Content        = view.Content;
            model.Title          = view.Title;
            model.ReportCategory = view.ReportCategory;

            return(model);
        }
Exemplo n.º 31
0
        public new void Show()
        {
            ReportView.Navigate("about:blank");
            ReportView.Document.Write(_report.GetHtml());
            //ReportForm.InitRdlc();

            base.Show();
        }
        private void SaveReport(ReportView.CreateReport viewModel, CreateReport view)
        {
            // TODO add validation
            try
            {
                var timeInterval = new TimeInterval(viewModel.StartDate, viewModel.EndDate);
                var reportParameters = viewModel.ReportParameters;
                var filePath = viewModel.FilePath;

                if (reportParameters is ReportView.PersonReportParameters)
                {
                    var personParameters = reportParameters as ReportView.PersonReportParameters;
                    var persons = personParameters.ChoosenPersons;
                    var reports =
                        persons.Select(p => _reportGenerator.GenerateProfessorReport(p.Model, timeInterval))
                               .ToList();

                    var report = Report.Unify(reports);
                    _excelService.ExportReport(filePath, report);
                }
                else if (reportParameters is ReportView.CathedraReportParameters)
                {
                    var cathedraParameters = reportParameters as ReportView.CathedraReportParameters;
                    var cathedra = cathedraParameters.SelectedCathedra;
                    var report = _reportGenerator.GenerateCathedraReport(cathedra, timeInterval);
                    _excelService.ExportReport(filePath, report);
                }
                else
                {
                    var report = _reportGenerator.GenerateFacultyReport(timeInterval);
                    _excelService.ExportReport(filePath, report);
                }

                view.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ошибка при генерации отчёта. Проверьте введённые данные",
                                "Ошибка");
            }
        }
Exemplo n.º 33
0
	void DrawInfo()
	{

		GUILayout.BeginArea( screenRect , backStyle );

		Vector2 drag = getDrag(); 
		if( (drag.x != 0) && (downPos != Vector2.zero)  )
		{
			infoScrollPosition.x -= (drag.x - oldInfoDrag.x) ;
		}
		if( (drag.y != 0) && (downPos != Vector2.zero)  )
		{
			infoScrollPosition.y += (drag.y - oldInfoDrag.y) ;
		}
		oldInfoDrag = drag;

		GUI.skin = toolbarScrollerSkin ;
		infoScrollPosition = GUILayout.BeginScrollView( infoScrollPosition ) ;
		GUILayout.Space( size.x);
		GUILayout.BeginHorizontal();
		GUILayout.Space( size.x);
		GUILayout.Box( buildFromContent ,nonStyle ,  GUILayout.Width(size.x) , GUILayout.Height(size.y));
		GUILayout.Space( size.x);
		GUILayout.Label( buildDate , nonStyle, GUILayout.Height(size.y));
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();

		GUILayout.BeginHorizontal();
		GUILayout.Space( size.x);
		GUILayout.Box( systemInfoContent ,nonStyle ,  GUILayout.Width(size.x) , GUILayout.Height(size.y));
		GUILayout.Space( size.x);
		GUILayout.Label( deviceModel , nonStyle , GUILayout.Height(size.y));
		GUILayout.Space( size.x);
		GUILayout.Label( deviceType , nonStyle , GUILayout.Height(size.y));
		GUILayout.Space( size.x);
		GUILayout.Label( deviceName , nonStyle , GUILayout.Height(size.y));
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();

		GUILayout.BeginHorizontal();
		GUILayout.Space( size.x);
		GUILayout.Box( graphicsInfoContent ,nonStyle ,  GUILayout.Width(size.x) , GUILayout.Height(size.y));
		GUILayout.Space( size.x);
		GUILayout.Label( SystemInfo.graphicsDeviceName , nonStyle , GUILayout.Height(size.y));
		GUILayout.Space( size.x);
		GUILayout.Label( graphicsMemorySize , nonStyle , GUILayout.Height(size.y));
		#if !USE_OLD_UNITY
		GUILayout.Space( size.x);
		GUILayout.Label( maxTextureSize , nonStyle , GUILayout.Height(size.y));
		#endif
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();

		GUILayout.BeginHorizontal();
		GUILayout.Space( size.x);
		GUILayout.Space( size.x);
		GUILayout.Space( size.x);
		GUILayout.Label( "Screen Width " + Screen.width, nonStyle , GUILayout.Height(size.y));
		GUILayout.Space( size.x);
		GUILayout.Label(  "Screen Height " + Screen.height ,nonStyle , GUILayout.Height(size.y)); 
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();

		GUILayout.BeginHorizontal();
		GUILayout.Space( size.x);
		GUILayout.Box( showMemoryContent ,nonStyle ,  GUILayout.Width(size.x) , GUILayout.Height(size.y));
		GUILayout.Space( size.x);
		GUILayout.Label( systemMemorySize + " mb" , nonStyle , GUILayout.Height(size.y));
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();

		GUILayout.BeginHorizontal();
		GUILayout.Space( size.x);
		GUILayout.Space( size.x);
		GUILayout.Space( size.x);
		GUILayout.Label( "Mem Usage Of Logs " + logsMemUsage.ToString("0.000")  + " mb", nonStyle , GUILayout.Height(size.y));
		GUILayout.Space( size.x);
		//GUILayout.Label( "Mem Usage Of Graph " + graphMemUsage.ToString("0.000")  + " mb", nonStyle , GUILayout.Height(size.y));
		//GUILayout.Space( size.x);
		GUILayout.Label( "GC Memory " + gcTotalMemory.ToString("0.000") + " mb",nonStyle , GUILayout.Height(size.y));
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();

		GUILayout.BeginHorizontal();
		GUILayout.Space( size.x);
		GUILayout.Box( softwareContent ,nonStyle ,  GUILayout.Width(size.x) , GUILayout.Height(size.y));
		GUILayout.Space( size.x);
		GUILayout.Label( SystemInfo.operatingSystem , nonStyle , GUILayout.Height(size.y));
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();



		GUILayout.BeginHorizontal();
		GUILayout.Space( size.x);
		GUILayout.Box( dateContent ,nonStyle ,  GUILayout.Width(size.x) , GUILayout.Height(size.y));
		GUILayout.Space( size.x);
		GUILayout.Label( System.DateTime.Now.ToString() , nonStyle , GUILayout.Height(size.y));
		GUILayout.Label( " - Application Started At " +  logDate , nonStyle , GUILayout.Height(size.y));
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();

		GUILayout.BeginHorizontal();
		GUILayout.Space( size.x);
		GUILayout.Box( showTimeContent ,nonStyle ,  GUILayout.Width(size.x) , GUILayout.Height(size.y));
		GUILayout.Space( size.x);
		GUILayout.Label( Time.realtimeSinceStartup.ToString("000") , nonStyle , GUILayout.Height(size.y));
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();

		GUILayout.BeginHorizontal();
		GUILayout.Space( size.x);
		GUILayout.Box( showFpsContent ,nonStyle ,  GUILayout.Width(size.x) , GUILayout.Height(size.y));
		GUILayout.Space( size.x);
		GUILayout.Label( fpsText , nonStyle , GUILayout.Height(size.y));
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();

		GUILayout.BeginHorizontal();
		GUILayout.Space( size.x);
		GUILayout.Box( userContent ,nonStyle ,  GUILayout.Width(size.x) , GUILayout.Height(size.y));
		GUILayout.Space( size.x);
		GUILayout.Label( UserData , nonStyle , GUILayout.Height(size.y));
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();

		GUILayout.BeginHorizontal();
		GUILayout.Space( size.x);
		GUILayout.Box( showSceneContent ,nonStyle ,  GUILayout.Width(size.x) , GUILayout.Height(size.y));
		GUILayout.Space( size.x);
		GUILayout.Label( currentScene , nonStyle , GUILayout.Height(size.y));
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();

		GUILayout.BeginHorizontal();
		GUILayout.Space( size.x);
		GUILayout.Box( showSceneContent ,nonStyle ,  GUILayout.Width(size.x) , GUILayout.Height(size.y));
		GUILayout.Space( size.x);
		GUILayout.Label( "Unity Version = " +Application.unityVersion , nonStyle , GUILayout.Height(size.y));
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();

		/*GUILayout.BeginHorizontal();
		GUILayout.Space( size.x);
		GUILayout.Box( graphContent ,nonStyle ,  GUILayout.Width(size.x) , GUILayout.Height(size.y));
		GUILayout.Space( size.x);
		GUILayout.Label( "frame " + samples.Count , nonStyle , GUILayout.Height(size.y));
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();*/

		drawInfo_enableDisableToolBarButtons();

		GUILayout.FlexibleSpace();

		GUILayout.BeginHorizontal();
		GUILayout.Space( size.x);
		GUILayout.Label( "Size = "  + size.x.ToString("0.0") , nonStyle , GUILayout.Height(size.y));
		GUILayout.Space( size.x);
		float _size = GUILayout.HorizontalSlider( size.x , 16 , 64 ,sliderBackStyle,sliderThumbStyle, GUILayout.Width( Screen.width * 0.5f) ) ;
		if( size.x != _size )
		{
			size.x = size.y = _size;
			initializeStyle();
		}
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();

		GUILayout.BeginHorizontal();
		GUILayout.Space( size.x);
		if( GUILayout.Button( backContent ,barStyle ,  GUILayout.Width(size.x*2) , GUILayout.Height(size.y*2)))
		{
			currentView = ReportView.Logs ;
		}
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();



		GUILayout.EndScrollView();

		GUILayout.EndArea();
	}
Exemplo n.º 34
0
	public void Initialize()
	{
		if( !created )
		{
			try{
				gameObject.SendMessage( "OnPreStart" );
			}
			catch( System.Exception e ){
				Debug.LogException( e );
			}
			scenes = new string[ Application.levelCount ];
			currentScene = Application.loadedLevelName;
			DontDestroyOnLoad( gameObject );
#if USE_OLD_UNITY
			Application.RegisterLogCallback (new Application.LogCallback (CaptureLog));
			Application.RegisterLogCallbackThreaded (new Application.LogCallback (CaptureLogThread));
#else
			Application.logMessageReceived += CaptureLog ;
			Application.logMessageReceivedThreaded += CaptureLogThread ;
#endif
			created = true ;
			//addSample();
		}
		else 
		{
			Debug.LogWarning("tow manager is exists delete the second");
			DestroyImmediate( gameObject ,true);
			return;
		}


		//initialize gui and styles for gui porpose

		clearContent 	= new GUIContent("",images.clearImage,"Clear logs");
		collapseContent = new GUIContent("",images.collapseImage,"Collapse logs");
		clearOnNewSceneContent = new GUIContent("",images.clearOnNewSceneImage,"Clear logs on new scene loaded");
		showTimeContent = new GUIContent("",images.showTimeImage,"Show Hide Time");
		showSceneContent = new GUIContent("",images.showSceneImage,"Show Hide Scene");
		showMemoryContent = new GUIContent("",images.showMemoryImage,"Show Hide Memory");
		softwareContent = new GUIContent("",images.softwareImage,"Software");
		dateContent = new GUIContent("",images.dateImage,"Date");
		showFpsContent = new GUIContent("",images.showFpsImage,"Show Hide fps");
		graphContent = new GUIContent("",images.showGraphImage,"Show Graph");
		infoContent = new GUIContent("",images.infoImage,"Information about application");
		searchContent = new GUIContent("",images.searchImage,"Search for logs");
		closeContent = new GUIContent("",images.closeImage,"Hide logs");
		userContent = new GUIContent("",images.userImage,"User");

		buildFromContent = new GUIContent("",images.buildFromImage,"Build From");
		systemInfoContent = new GUIContent("",images.systemInfoImage,"System Info");
		graphicsInfoContent = new GUIContent("",images.graphicsInfoImage,"Graphics Info");
		backContent = new GUIContent("",images.backImage,"Back");

		cameraContent = new GUIContent("",images.cameraImage,"Select Photo");



		//snapshotContent = new GUIContent("",images.cameraImage,"show or hide logs");
		logContent 	= new GUIContent("",images.logImage,"show or hide logs");
		warningContent = new GUIContent("",images.warningImage,"show or hide warnings");
		errorContent = new GUIContent("",images.errorImage,"show or hide errors");


		currentView = (ReportView)PlayerPrefs.GetInt( "Reporter_currentView" , 1);
		show 		= (PlayerPrefs.GetInt( "Reporter_show" )==1)?true:false;
		collapse 	= (PlayerPrefs.GetInt( "Reporter_collapse" )==1)?true:false;
		clearOnNewSceneLoaded = (PlayerPrefs.GetInt( "Reporter_clearOnNewSceneLoaded" )==1)?true:false;
		showTime 	= (PlayerPrefs.GetInt( "Reporter_showTime" )==1)?true:false;
		showScene 	= (PlayerPrefs.GetInt( "Reporter_showScene" )==1)?true:false;
		showMemory 	= (PlayerPrefs.GetInt( "Reporter_showMemory" )==1)?true:false;
		showFps 	= (PlayerPrefs.GetInt( "Reporter_showFps" )==1)?true:false;
		showGraph 	= (PlayerPrefs.GetInt( "Reporter_showGraph" )==1)?true:false;
		showLog 	= (PlayerPrefs.GetInt( "Reporter_showLog" ,1) ==1)?true:false;
		showWarning = (PlayerPrefs.GetInt( "Reporter_showWarning" ,1) ==1)?true:false;
		showError 	= (PlayerPrefs.GetInt( "Reporter_showError" ,1) ==1)?true:false;
		filterText  = PlayerPrefs.GetString("Reporter_filterText");
		size.x = size.y = PlayerPrefs.GetFloat( "Reporter_size" , 32 );


		showClearOnNewSceneLoadedButton 		= (PlayerPrefs.GetInt( "Reporter_showClearOnNewSceneLoadedButton" ,1)==1)?true:false;
		showTimeButton 		= (PlayerPrefs.GetInt( "Reporter_showTimeButton",1 )==1)?true:false;
		showSceneButton 	= (PlayerPrefs.GetInt( "Reporter_showSceneButton",1 )==1)?true:false;
		showMemButton 		= (PlayerPrefs.GetInt( "Reporter_showMemButton",1 )==1)?true:false;
		showFpsButton 		= (PlayerPrefs.GetInt( "Reporter_showFpsButton",1 )==1)?true:false;
		showSearchText 		= (PlayerPrefs.GetInt( "Reporter_showSearchText",1 )==1)?true:false;


		initializeStyle();

		Initialized = true ;

		if( show ){
			doShow();
		}

		deviceModel = SystemInfo.deviceModel.ToString() ;
		deviceType  = SystemInfo.deviceType.ToString() ;
		deviceName  = SystemInfo.deviceName.ToString() ;
		graphicsMemorySize = SystemInfo.graphicsMemorySize.ToString() ;
		#if !USE_OLD_UNITY
		maxTextureSize = SystemInfo.maxTextureSize.ToString() ;
		#endif
		systemMemorySize = SystemInfo.systemMemorySize.ToString() ; 

	}
Exemplo n.º 35
0
	void doShow(){
		show = true; 
		currentView = ReportView.Logs ;
		gameObject.AddComponent<ReporterGUI>();
		

		try{
			gameObject.SendMessage( "OnShowReporter");
		}
		catch(System.Exception e ){
			Debug.LogException( e );
		}
	}
Exemplo n.º 36
0
    void DrawInfo()
    {

        GUILayout.BeginArea(screenRect, backStyle);

        Vector2 drag = getDrag(); 
        if ((drag.x != 0) && (downPos != Vector2.zero))
        {
            infoScrollPosition.x -= (drag.x - oldInfoDrag.x);
        }
        if ((drag.y != 0) && (downPos != Vector2.zero))
        {
            infoScrollPosition.y += (drag.y - oldInfoDrag.y);
        }
        oldInfoDrag = drag;

        GUI.skin = toolbarScrollerSkin;
        infoScrollPosition = GUILayout.BeginScrollView(infoScrollPosition);
        GUILayout.Space(size.x);
        GUILayout.BeginHorizontal();
        GUILayout.Space(size.x);
        GUILayout.Box(buildFromContent, nonStyle, GUILayout.Width(size.x), GUILayout.Height(size.y));
        GUILayout.Space(size.x);
        GUILayout.Label(buildDate, nonStyle, GUILayout.Height(size.y));
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Space(size.x);
        GUILayout.Box(systemInfoContent, nonStyle, GUILayout.Width(size.x), GUILayout.Height(size.y));
        GUILayout.Space(size.x);
        GUILayout.Label(deviceModel, nonStyle, GUILayout.Height(size.y));
        GUILayout.Space(size.x);
        GUILayout.Label(deviceType, nonStyle, GUILayout.Height(size.y));
        GUILayout.Space(size.x);
        GUILayout.Label(deviceName, nonStyle, GUILayout.Height(size.y));
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Space(size.x);
        GUILayout.Box(graphicsInfoContent, nonStyle, GUILayout.Width(size.x), GUILayout.Height(size.y));
        GUILayout.Space(size.x);
        GUILayout.Label(SystemInfo.graphicsDeviceName, nonStyle, GUILayout.Height(size.y));
        GUILayout.Space(size.x);
        GUILayout.Label(graphicsMemorySize, nonStyle, GUILayout.Height(size.y));
        GUILayout.Space(size.x);
        GUILayout.Label(maxTextureSize, nonStyle, GUILayout.Height(size.y));
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Space(size.x);
        GUILayout.Space(size.x);
        GUILayout.Space(size.x);
        GUILayout.Label("Screen Width " + Screen.width, nonStyle, GUILayout.Height(size.y));
        GUILayout.Space(size.x);
        GUILayout.Label("Screen Height " + Screen.height, nonStyle, GUILayout.Height(size.y)); 
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Space(size.x);
        GUILayout.Box(showMemoryContent, nonStyle, GUILayout.Width(size.x), GUILayout.Height(size.y));
        GUILayout.Space(size.x);
        GUILayout.Label(systemMemorySize + " mb", nonStyle, GUILayout.Height(size.y));
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Space(size.x);
        GUILayout.Space(size.x);
        GUILayout.Space(size.x);
        GUILayout.Label("Mem Usage Of Logs " + logsMemUsage.ToString("0.000") + " mb", nonStyle, GUILayout.Height(size.y));
        GUILayout.Space(size.x);
        GUILayout.Label("Mem Usage Of Graph " + graphMemUsage.ToString("0.000") + " mb", nonStyle, GUILayout.Height(size.y));
        GUILayout.Space(size.x);
        GUILayout.Label("GC Memory " + gcTotalMemory.ToString("0.000") + " mb", nonStyle, GUILayout.Height(size.y));
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Space(size.x);
        GUILayout.Box(softwareContent, nonStyle, GUILayout.Width(size.x), GUILayout.Height(size.y));
        GUILayout.Space(size.x);
        GUILayout.Label(SystemInfo.operatingSystem, nonStyle, GUILayout.Height(size.y));
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Space(size.x);
        GUILayout.Box(dateContent, nonStyle, GUILayout.Width(size.x), GUILayout.Height(size.y));
        GUILayout.Space(size.x);
        GUILayout.Label(System.DateTime.Now.ToString(), nonStyle, GUILayout.Height(size.y));
        GUILayout.Label(" - Application Started At " + logDate, nonStyle, GUILayout.Height(size.y));
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Space(size.x);
        GUILayout.Box(showTimeContent, nonStyle, GUILayout.Width(size.x), GUILayout.Height(size.y));
        GUILayout.Space(size.x);
        GUILayout.Label(Time.realtimeSinceStartup.ToString("000"), nonStyle, GUILayout.Height(size.y));
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Space(size.x);
        GUILayout.Box(showFpsContent, nonStyle, GUILayout.Width(size.x), GUILayout.Height(size.y));
        GUILayout.Space(size.x);
        GUILayout.Label(fpsText, nonStyle, GUILayout.Height(size.y));
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

    
        GUILayout.BeginHorizontal();
        GUILayout.Space(size.x);
        GUILayout.Box(userContent, nonStyle, GUILayout.Width(size.x), GUILayout.Height(size.y));
        GUILayout.Space(size.x);
        GUILayout.Label(UserData, nonStyle, GUILayout.Height(size.y));
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();       
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Space(size.x);
        GUILayout.Box(showSceneContent, nonStyle, GUILayout.Width(size.x), GUILayout.Height(size.y));
        GUILayout.Space(size.x);
        GUILayout.Label(currentScene, nonStyle, GUILayout.Height(size.y));
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        #if (UNITY_IPHONE || UNITY_ANDROID)
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Play Movie",GUILayout.Height(60)))
        {
            Handheld.PlayFullScreenMovie("Mov/CG.mp4");            
        }
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        #endif
        
		GUILayout.BeginHorizontal();
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();

        /*GUILayout.BeginHorizontal();
        GUILayout.Space( size.x);
        GUILayout.Box( graphContent ,nonStyle ,  GUILayout.Width(size.x) , GUILayout.Height(size.y));
        GUILayout.Space( size.x);
        GUILayout.Label( "frame " + samples.Count , nonStyle , GUILayout.Height(size.y));
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();*/

        GUILayout.FlexibleSpace();
        GUILayout.BeginHorizontal();
        GUILayout.Space(size.x);
        if (GUILayout.Button(backContent, barStyle, GUILayout.Width(size.x * 2), GUILayout.Height(size.y * 2)))
        {
            currentView = ReportView.Logs;
        }
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.EndScrollView();

        GUILayout.EndArea();
    }
Exemplo n.º 37
0
    public void Initialize()
    {
        if( !created )
        {
            try{
                gameObject.SendMessage( "OnPreStart" );
            }
            catch( System.Exception e ){
                Debug.LogException( e );
            }
            scenes = new string[ Application.levelCount ];
            currentScene = Application.loadedLevelName;
            DontDestroyOnLoad( gameObject );
            Application.RegisterLogCallback (new Application.LogCallback (CaptureLog));
            created = true ;
            //addSample();
        }
        else
        {
            Debug.LogWarning("tow manager is exists delete the second");
            DestroyImmediate( gameObject ,true);
            return;
        }

        int paddingX = (int)(size.x*0.2f) ;
        int paddingY = (int)(size.y*0.2f) ;
        //initialize gui and styles for gui porpose

        clearContent 	= new GUIContent("",getImage("clear",size.x,size.y),"Clear logs");
        collapseContent = new GUIContent("",getImage("collapse",size.x,size.y),"Collapse logs");
        clearOnNewSceneContent = new GUIContent("",getImage("clearOnSceneLoaded",size.x,size.y),"Clear logs on new scene loaded");
        showTimeContent = new GUIContent("",getImage("timer_1",size.x,size.y),"Show Hide Time");
        showSceneContent = new GUIContent("",getImage("UnityIcon",size.x,size.y),"Show Hide Scene");
        showMemoryContent = new GUIContent("",getImage("memory",size.x,size.y),"Show Hide Memory");
        softwareContent = new GUIContent("",getImage("software",size.x,size.y),"Software");
        dateContent = new GUIContent("",getImage("date",size.x,size.y),"Date");
        showFpsContent = new GUIContent("",getImage("fps",size.x,size.y),"Show Hide fps");
        graphContent = new GUIContent("",getImage("chart",size.x,size.y),"Show Graph");
        infoContent = new GUIContent("",getImage("info",size.x,size.y),"Information about application");
        closeContent = new GUIContent("",getImage("close",size.x,size.y),"Hide logs");
        userContent = new GUIContent("",getImage("user",size.x,size.y),"User");

        buildFromContent = new GUIContent("",getImage("buildFrom",size.x,size.y),"Build From");
        systemInfoContent = new GUIContent("",getImage("ComputerIcon",size.x,size.y),"System Info");
        graphicsInfoContent = new GUIContent("",getImage("graphicCard",size.x,size.y),"Graphics Info");
        backContent = new GUIContent("",getImage("back",size.x,size.y),"Back");

        cameraContent = new GUIContent("",getImage("camera",size.x,size.y),"Select Photo");

        logIcon 	= getImage("log_icon" ,size.x,size.y);
        warningIcon = getImage("warning_icon" ,size.x,size.y);
        errorIcon 	= getImage("error_icon" ,size.x,size.y);

        //snapshotContent = new GUIContent("",getImage("camera" ,size.x,size.y),"show or hide logs");
        logContent 	= new GUIContent("",logIcon,"show or hide logs");
        warningContent = new GUIContent("",warningIcon,"show or hide warnings");
        errorContent = new GUIContent("",errorIcon,"show or hide errors");

        nonStyle = new GUIStyle();
        nonStyle.clipping = TextClipping.Clip;
        nonStyle.border = new RectOffset(0,0,0,0);
        nonStyle.normal.background = null ;
        nonStyle.fontSize = (int)(size.y /2 );
        nonStyle.alignment = TextAnchor.MiddleCenter ;

        lowerLeftFontStyle = new GUIStyle();
        lowerLeftFontStyle.clipping = TextClipping.Clip;
        lowerLeftFontStyle.border = new RectOffset(0,0,0,0);
        lowerLeftFontStyle.normal.background = null ;
        lowerLeftFontStyle.fontSize = (int)(size.y /2 );
        lowerLeftFontStyle.fontStyle = FontStyle.Bold ;
        lowerLeftFontStyle.alignment = TextAnchor.LowerLeft ;

        barStyle = new GUIStyle();
        barStyle.border = new RectOffset(1,1,1,1);
        barStyle.normal.background = getImage("bar" , size.x , size.y) ;
        barStyle.active.background = getImage("button_active" , size.x , size.y ) ;
        barStyle.alignment = TextAnchor.MiddleCenter ;
        barStyle.margin = new RectOffset(1,1,1,1);

        //barStyle.padding = new RectOffset(paddingX,paddingX,paddingY,paddingY);
        //barStyle.wordWrap = true ;
        barStyle.clipping = TextClipping.Clip;
        barStyle.fontSize = (int)(size.y /2 );

        buttonActiveStyle = new GUIStyle();
        buttonActiveStyle.border = new RectOffset(1,1,1,1);
        buttonActiveStyle.normal.background = getImage("button_active" ,32,32);
        buttonActiveStyle.alignment = TextAnchor.MiddleCenter ;
        buttonActiveStyle.margin = new RectOffset(1,1,1,1);
        //buttonActiveStyle.padding = new RectOffset(4,4,4,4);
        buttonActiveStyle.fontSize = (int)(size.y /2 );

        backStyle = new GUIStyle();
        backStyle.normal.background = getImage("even_log" ,16,16);
        backStyle.clipping = TextClipping.Clip ;
        backStyle.fontSize = (int)(size.y /2 );

        evenLogStyle = new GUIStyle();
        evenLogStyle.normal.background = getImage("even_log" ,16,16);
        evenLogStyle.fixedHeight = size.y ;
        evenLogStyle.clipping = TextClipping.Clip ;
        evenLogStyle.alignment = TextAnchor.UpperLeft ;
        evenLogStyle.imagePosition = ImagePosition.ImageLeft ;
        evenLogStyle.fontSize = (int)(size.y /2 );
        //evenLogStyle.wordWrap = true;

        oddLogStyle = new GUIStyle();
        oddLogStyle.normal.background = getImage("odd_log" ,16,16);
        oddLogStyle.fixedHeight = size.y ;
        oddLogStyle.clipping = TextClipping.Clip ;
        oddLogStyle.alignment = TextAnchor.UpperLeft ;
        oddLogStyle.imagePosition = ImagePosition.ImageLeft ;
        oddLogStyle.fontSize = (int)(size.y /2 );
        //oddLogStyle.wordWrap = true ;

        logButtonStyle = new GUIStyle();
        //logButtonStyle.wordWrap = true;
        logButtonStyle.fixedHeight = size.y ;
        logButtonStyle.clipping = TextClipping.Clip ;
        logButtonStyle.alignment = TextAnchor.UpperLeft ;
        //logButtonStyle.imagePosition = ImagePosition.ImageLeft ;
        //logButtonStyle.wordWrap = true;
        logButtonStyle.fontSize = (int)(size.y /2 );
        logButtonStyle.padding = new RectOffset(paddingX,paddingX,paddingY,paddingY);

        selectedLogStyle = new GUIStyle();
        selectedLogStyle.normal.background = getImage("selected" ,16,16);
        selectedLogStyle.fixedHeight = size.y ;
        selectedLogStyle.clipping = TextClipping.Clip ;
        selectedLogStyle.alignment = TextAnchor.UpperLeft ;
        selectedLogStyle.normal.textColor = Color.white ;
        //selectedLogStyle.wordWrap = true;
        selectedLogStyle.fontSize = (int)(size.y /2 );

        selectedLogFontStyle = new GUIStyle();
        selectedLogFontStyle.normal.background = getImage("selected" ,16,16);
        selectedLogFontStyle.fixedHeight = size.y ;
        selectedLogFontStyle.clipping = TextClipping.Clip ;
        selectedLogFontStyle.alignment = TextAnchor.UpperLeft ;
        selectedLogFontStyle.normal.textColor = Color.white ;
        //selectedLogStyle.wordWrap = true;
        selectedLogFontStyle.fontSize = (int)(size.y /2 );
        selectedLogFontStyle.padding = new RectOffset(paddingX,paddingX,paddingY,paddingY);

        stackLabelStyle = new GUIStyle();
        stackLabelStyle.wordWrap = true ;
        stackLabelStyle.fontSize = (int)(size.y /2 );
        stackLabelStyle.padding = new RectOffset(paddingX,paddingX,paddingY,paddingY);

        scrollerStyle = new GUIStyle();
        scrollerStyle.normal.background =  getImage("bar" ,size.x,size.y);

        GUISkin skin = Resources.Load("reporterScrollerSkin",typeof(GUISkin)) as GUISkin ;

        toolbarScrollerSkin = (GUISkin)GameObject.Instantiate( skin );
        toolbarScrollerSkin.verticalScrollbar.fixedWidth = 0f ;
        toolbarScrollerSkin.horizontalScrollbar.fixedHeight = 0f ;
        toolbarScrollerSkin.verticalScrollbarThumb.fixedWidth = 0f;
        toolbarScrollerSkin.horizontalScrollbarThumb.fixedHeight = 0f;

        logScrollerSkin = (GUISkin)GameObject.Instantiate( skin );
        logScrollerSkin.verticalScrollbar.fixedWidth = size.x * 2f ;
        logScrollerSkin.horizontalScrollbar.fixedHeight = 0f ;
        logScrollerSkin.verticalScrollbarThumb.fixedWidth = size.x * 2f;
        logScrollerSkin.horizontalScrollbarThumb.fixedHeight = 0f;

        graphScrollerSkin = (GUISkin)GameObject.Instantiate( skin );
        graphScrollerSkin.verticalScrollbar.fixedWidth = 0f ;
        graphScrollerSkin.horizontalScrollbar.fixedHeight = size.x * 2f ;
        graphScrollerSkin.verticalScrollbarThumb.fixedWidth = 0f;
        graphScrollerSkin.horizontalScrollbarThumb.fixedHeight = size.x * 2f;
        //inGameLogsScrollerSkin.verticalScrollbarThumb.fixedWidth = size.x * 2;
        //inGameLogsScrollerSkin.verticalScrollbar.fixedWidth = size.x * 2;

        currentView = (ReportView)PlayerPrefs.GetInt( "Reporter_currentView" , 1);
        show 		= (PlayerPrefs.GetInt( "Reporter_show" )==1)?true:false;
        collapse 	= (PlayerPrefs.GetInt( "Reporter_collapse" )==1)?true:false;
        clearOnNewSceneLoaded = (PlayerPrefs.GetInt( "Reporter_clearOnNewSceneLoaded" )==1)?true:false;
        showTime 	= (PlayerPrefs.GetInt( "Reporter_showTime" )==1)?true:false;
        showScene 	= (PlayerPrefs.GetInt( "Reporter_showScene" )==1)?true:false;
        showMemory 	= (PlayerPrefs.GetInt( "Reporter_showMemory" )==1)?true:false;
        showFps 	= (PlayerPrefs.GetInt( "Reporter_showFps" )==1)?true:false;
        showGraph 	= (PlayerPrefs.GetInt( "Reporter_showGraph" )==1)?true:false;
        showLog 	= (PlayerPrefs.GetInt( "Reporter_showLog" ,1) ==1)?true:false;
        showWarning = (PlayerPrefs.GetInt( "Reporter_showWarning" ,1) ==1)?true:false;
        showError 	= (PlayerPrefs.GetInt( "Reporter_showError" ,1) ==1)?true:false;

        Initialized = true ;

        if( show ){
            doShow();
        }

        deviceModel = SystemInfo.deviceModel.ToString() ;
        deviceType  = SystemInfo.deviceType.ToString() ;
        deviceName  = SystemInfo.deviceName.ToString() ;
        graphicsMemorySize = SystemInfo.graphicsMemorySize.ToString() ;
        maxTextureSize = SystemInfo.maxTextureSize.ToString() ;
        systemMemorySize = SystemInfo.systemMemorySize.ToString() ;
    }
Exemplo n.º 38
0
    void drawToolBar()
    {

        toolBarRect.x = 0f;
        toolBarRect.y = 0f;
        toolBarRect.width = Screen.width;
        toolBarRect.height = size.y * 2f;

        //toolbarScrollerSkin.verticalScrollbar.fixedWidth = 0f;
        //toolbarScrollerSkin.horizontalScrollbar.fixedHeight= 0f  ;

        GUI.skin = toolbarScrollerSkin;
        Vector2 drag = getDrag(); 
        if ((drag.x != 0) && (downPos != Vector2.zero) && (downPos.y > Screen.height - size.y * 2f))
        {
            toolbarScrollPosition.x -= (drag.x - toolbarOldDrag);
        }
        toolbarOldDrag = drag.x;
        GUILayout.BeginArea(toolBarRect);
        toolbarScrollPosition = GUILayout.BeginScrollView(toolbarScrollPosition);
        GUILayout.BeginHorizontal(barStyle);
        
        if (GUILayout.Button(clearContent, barStyle, GUILayout.Width(size.x * 2), GUILayout.Height(size.y * 2)))
        {
            clear();
        }
        if (GUILayout.Button(collapseContent, (collapse) ? buttonActiveStyle : barStyle, GUILayout.Width(size.x * 2), GUILayout.Height(size.y * 2)))
        {
            collapse = !collapse;
            calculateCurrentLog();
        }
        if (GUILayout.Button(clearOnNewSceneContent, (clearOnNewSceneLoaded) ? buttonActiveStyle : barStyle, GUILayout.Width(size.x * 2), GUILayout.Height(size.y * 2)))
        {
            clearOnNewSceneLoaded = !clearOnNewSceneLoaded;
        }
        
        if (GUILayout.Button(showTimeContent, (showTime) ? buttonActiveStyle : barStyle, GUILayout.Width(size.x * 2), GUILayout.Height(size.y * 2)))
        {
            showTime = !showTime;
        }
        tempRect = GUILayoutUtility.GetLastRect();
        GUI.Label(tempRect, Time.realtimeSinceStartup.ToString("0.0"), lowerLeftFontStyle);
        if (GUILayout.Button(showSceneContent, (showScene) ? buttonActiveStyle : barStyle, GUILayout.Width(size.x * 2), GUILayout.Height(size.y * 2)))
        {
            showScene = !showScene;
        }
        tempRect = GUILayoutUtility.GetLastRect();
        GUI.Label(tempRect, currentScene, lowerLeftFontStyle);
        if (GUILayout.Button(showMemoryContent, (showMemory) ? buttonActiveStyle : barStyle, GUILayout.Width(size.x * 2), GUILayout.Height(size.y * 2)))
        {
            showMemory = !showMemory;
        }
        tempRect = GUILayoutUtility.GetLastRect();
        GUI.Label(tempRect, gcTotalMemory.ToString("0.0"), lowerLeftFontStyle);
        
        if (GUILayout.Button(showFpsContent, (showFps) ? buttonActiveStyle : barStyle, GUILayout.Width(size.x * 2), GUILayout.Height(size.y * 2)))
        {
            showFps = !showFps;
        }
        tempRect = GUILayoutUtility.GetLastRect();
        GUI.Label(tempRect, fpsText, lowerLeftFontStyle);
        /*if( GUILayout.Button( graphContent , (showGraph)?buttonActiveStyle:barStyle , GUILayout.Width(size.x*2) ,GUILayout.Height(size.y*2)))
        {
            showGraph = !showGraph ;
        }
        tempRect = GUILayoutUtility.GetLastRect();
        GUI.Label( tempRect , samples.Count.ToString() , lowerLeftFontStyle );*/
        if (GUILayout.Button(infoContent, barStyle, GUILayout.Width(size.x * 2), GUILayout.Height(size.y * 2)))
        {
            currentView = ReportView.Info;
        }
        
        GUILayout.FlexibleSpace();
        
        
        string logsText = " ";
        if (collapse)
        {
            logsText += numOfCollapsedLogs;
        } else
        {
            logsText += numOfLogs;
        }
        string logsWarningText = " ";
        if (collapse)
        {
            logsWarningText += numOfCollapsedLogsWarning;
        } else
        {
            logsWarningText += numOfLogsWarning;
        }
        string logsErrorText = " ";
        if (collapse)
        {
            logsErrorText += numOfCollapsedLogsError;
        } else
        {
            logsErrorText += numOfLogsError;
        }
        
        GUILayout.BeginHorizontal((showLog) ? buttonActiveStyle : barStyle);
        if (GUILayout.Button(logContent, nonStyle, GUILayout.Width(size.x * 2), GUILayout.Height(size.y * 2)))
        {
            showLog = !showLog;
            calculateCurrentLog();
        }
        if (GUILayout.Button(logsText, nonStyle, GUILayout.Width(size.x * 2), GUILayout.Height(size.y * 2)))
        {
            showLog = !showLog;
            calculateCurrentLog();
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal((showWarning) ? buttonActiveStyle : barStyle);
        if (GUILayout.Button(warningContent, nonStyle, GUILayout.Width(size.x * 2), GUILayout.Height(size.y * 2)))
        {
            showWarning = !showWarning;
            calculateCurrentLog();
        }
        if (GUILayout.Button(logsWarningText, nonStyle, GUILayout.Width(size.x * 2), GUILayout.Height(size.y * 2)))
        {
            showWarning = !showWarning;
            calculateCurrentLog();
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal((showError) ? buttonActiveStyle : nonStyle);
        if (GUILayout.Button(errorContent, nonStyle, GUILayout.Width(size.x * 2), GUILayout.Height(size.y * 2)))
        {
            showError = !showError;
            calculateCurrentLog();
        }
        if (GUILayout.Button(logsErrorText, nonStyle, GUILayout.Width(size.x * 2), GUILayout.Height(size.y * 2)))
        {
            showError = !showError;
            calculateCurrentLog();
        }
        GUILayout.EndHorizontal();
        
        if (GUILayout.Button(closeContent, barStyle, GUILayout.Width(size.x * 2), GUILayout.Height(size.y * 2)))
        {
			Close();
        }
        
        
        GUILayout.EndHorizontal();
        
        GUILayout.EndScrollView();

        GUILayout.EndArea();
    }
Exemplo n.º 39
0
	void DrawReport()
	{
		screenRect.x = 0f ;
		screenRect.y = 0f ;
		screenRect.width = Screen.width ;
		screenRect.height = Screen.height  ;
		GUILayout.BeginArea( screenRect , backStyle );
		GUILayout.BeginVertical();
		GUILayout.FlexibleSpace();

		GUILayout.BeginHorizontal();
		GUILayout.FlexibleSpace();
		GUILayout.Box( cameraContent ,nonStyle ,  GUILayout.Width(size.x) , GUILayout.Height(size.y));
		GUILayout.FlexibleSpace();
		GUILayout.Label( "Select Photo" , nonStyle , GUILayout.Height(size.y));
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();

		GUILayout.BeginHorizontal();
		GUILayout.Label( "Comming Soon", nonStyle , GUILayout.Height(size.y));
		GUILayout.EndHorizontal();

		GUILayout.BeginHorizontal();
		GUILayout.FlexibleSpace();
		if( GUILayout.Button( backContent ,barStyle ,  GUILayout.Width(size.x) , GUILayout.Height(size.y)))
		{
			currentView = ReportView.Logs ;
		}
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();

		GUILayout.FlexibleSpace();
		GUILayout.EndVertical();
		GUILayout.EndArea();
	}
Exemplo n.º 40
0
	void drawToolBar(){

		toolBarRect.x = 0f ;
		toolBarRect.y = 0f ;
		toolBarRect.width = Screen.width ;
		toolBarRect.height = size.y * 2f ;

		//toolbarScrollerSkin.verticalScrollbar.fixedWidth = 0f;
		//toolbarScrollerSkin.horizontalScrollbar.fixedHeight= 0f  ;

		GUI.skin = toolbarScrollerSkin ;
		Vector2 drag = getDrag(); 
		if( (drag.x != 0) && (downPos != Vector2.zero) && (downPos.y > Screen.height - size.y * 2f) )
		{
			toolbarScrollPosition.x -= (drag.x - toolbarOldDrag) ;
		}
		toolbarOldDrag = drag.x ;
		GUILayout.BeginArea( toolBarRect );
		toolbarScrollPosition = GUILayout.BeginScrollView( toolbarScrollPosition   );
		GUILayout.BeginHorizontal(  barStyle );
		
		if( GUILayout.Button( clearContent,barStyle ,  GUILayout.Width(size.x*2) , GUILayout.Height(size.y*2)))
		{
			clear();
		}
		if( GUILayout.Button( collapseContent , (collapse)?buttonActiveStyle:barStyle, GUILayout.Width(size.x*2) , GUILayout.Height(size.y*2)))
		{
			collapse = !collapse ;
			calculateCurrentLog();
		}
		if( showClearOnNewSceneLoadedButton && GUILayout.Button( clearOnNewSceneContent , (clearOnNewSceneLoaded)?buttonActiveStyle:barStyle , GUILayout.Width(size.x*2) , GUILayout.Height(size.y*2)))
		{
			clearOnNewSceneLoaded = !clearOnNewSceneLoaded ;
		}
		
		if( showTimeButton && GUILayout.Button( showTimeContent , (showTime)?buttonActiveStyle:barStyle , GUILayout.Width(size.x*2) ,GUILayout.Height(size.y*2)))
		{
			showTime = !showTime ;
		}
		if( showSceneButton )
		{
			tempRect = GUILayoutUtility.GetLastRect();
			GUI.Label( tempRect , Time.realtimeSinceStartup.ToString("0.0") , lowerLeftFontStyle );
			if( GUILayout.Button( showSceneContent , (showScene)?buttonActiveStyle:barStyle , GUILayout.Width(size.x*2) ,GUILayout.Height(size.y*2)))
			{
				showScene = !showScene ;
			}
			tempRect = GUILayoutUtility.GetLastRect();
			GUI.Label( tempRect , currentScene , lowerLeftFontStyle );
		}
		if( showMemButton )
		{
			if( GUILayout.Button( showMemoryContent , (showMemory)?buttonActiveStyle:barStyle , GUILayout.Width(size.x*2) ,GUILayout.Height(size.y*2)))
			{
				showMemory = !showMemory ;
			}
			tempRect = GUILayoutUtility.GetLastRect();
			GUI.Label( tempRect , gcTotalMemory.ToString("0.0") , lowerLeftFontStyle );
		}
		if( showFpsButton )
		{
			if( GUILayout.Button( showFpsContent , (showFps)?buttonActiveStyle:barStyle , GUILayout.Width(size.x*2) ,GUILayout.Height(size.y*2)))
			{
				showFps = !showFps ;
			}
			tempRect = GUILayoutUtility.GetLastRect();
			GUI.Label( tempRect , fpsText , lowerLeftFontStyle );
		}
		/*if( GUILayout.Button( graphContent , (showGraph)?buttonActiveStyle:barStyle , GUILayout.Width(size.x*2) ,GUILayout.Height(size.y*2)))
		{
			showGraph = !showGraph ;
		}
		tempRect = GUILayoutUtility.GetLastRect();
		GUI.Label( tempRect , samples.Count.ToString() , lowerLeftFontStyle );*/

		if( showSearchText )
		{
			GUILayout.Box( searchContent,barStyle, GUILayout.Width(size.x*2) ,GUILayout.Height(size.y*2)); 
			tempRect = GUILayoutUtility.GetLastRect();
			string newFilterText = GUI.TextField( tempRect, filterText ,searchStyle);
			if( newFilterText != filterText )
			{
				filterText = newFilterText;
				calculateCurrentLog();
			}
		}

		if( GUILayout.Button( infoContent , barStyle , GUILayout.Width(size.x*2) ,GUILayout.Height(size.y*2)))
		{
			currentView = ReportView.Info ;
		}


		
		GUILayout.FlexibleSpace();
		
		
		string logsText = " " ;
		if( collapse ){
			logsText+= numOfCollapsedLogs ;
		}
		else {
			logsText+= numOfLogs ;
		}
		string logsWarningText = " " ;
		if( collapse ){
			logsWarningText+= numOfCollapsedLogsWarning ;
		}
		else {
			logsWarningText+= numOfLogsWarning ;
		}
		string logsErrorText = " " ;
		if( collapse ){
			logsErrorText+= numOfCollapsedLogsError ;
		}
		else {
			logsErrorText+= numOfLogsError ;
		}
		
		GUILayout.BeginHorizontal( (showLog)?buttonActiveStyle:barStyle );
		if(GUILayout.Button(logContent,nonStyle , GUILayout.Width(size.x*2),GUILayout.Height(size.y*2) ))
		{
			showLog = !showLog ;
			calculateCurrentLog();
		}
		if( GUILayout.Button( logsText ,nonStyle, GUILayout.Width(size.x*2) , GUILayout.Height(size.y*2)))
		{
			showLog = !showLog ;
			calculateCurrentLog();
		}
		GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal( (showWarning)?buttonActiveStyle:barStyle );
		if(GUILayout.Button(warningContent ,nonStyle, GUILayout.Width(size.x*2),GUILayout.Height(size.y*2) ))
		{
			showWarning = !showWarning ;
			calculateCurrentLog();
		}
		if( GUILayout.Button( logsWarningText,nonStyle, GUILayout.Width(size.x*2), GUILayout.Height(size.y*2)))
		{
			showWarning = !showWarning ;
			calculateCurrentLog();
		}
		GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal( (showError)?buttonActiveStyle:nonStyle );
		if(GUILayout.Button(errorContent ,nonStyle, GUILayout.Width(size.x*2),GUILayout.Height(size.y*2) ))
		{
			showError = !showError ;
			calculateCurrentLog();
		}
		if( GUILayout.Button( logsErrorText ,nonStyle, GUILayout.Width(size.x*2), GUILayout.Height(size.y*2)))
		{
			showError = !showError ;
			calculateCurrentLog();
		}
		GUILayout.EndHorizontal();
		
		if( GUILayout.Button(closeContent ,barStyle, GUILayout.Width(size.x*2) , GUILayout.Height(size.y*2)))
		{
			show = false;
			ReporterGUI gui = gameObject.GetComponent<ReporterGUI>();
			DestroyImmediate( gui );

			try{
				gameObject.SendMessage( "OnHideReporter" );
			}
			catch( System.Exception e ){
				Debug.LogException( e );
			}
		}
		
		
		GUILayout.EndHorizontal();
		
		GUILayout.EndScrollView();

		GUILayout.EndArea();
	}
        void OnEditReport(CaseListItem item, WorklistViewModel worklist)
        {
            try
            {
                MainViewModel viewModel = (MainViewModel)DataContext;

                // see what reading site type
                ReadingSiteType currentSiteType = GetReadingSiteType(item);
                if (currentSiteType == ReadingSiteType.undefined)
                {
                    MessageBox.Show("Current site is undefined from the case's acquisition site's reading list.", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }

                // check to see if the patient is restricted
                bool canProceed = CanUserViewPatientData(item.SiteCode, item.PatientICN);
                if (!canProceed)
                {
                    MessageBox.Show("You cannot view information on this patient.", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }

                // check to see if the patient is available at the local site
                // if the patient is not registered then always read only report
                bool patientRegistered = viewModel.DataSource.IsPatientRegisteredAtSite(UserContext.LocalSite.PrimarySiteStationNUmber, item.PatientICN);
                if (!patientRegistered)
                {
                    MessageBox.Show("This patient is not registered at this site. Report Editor will open as read only.", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                }

                // everything is readonly if it's the patient tab
                bool isPatientTab = viewModel.WorklistsViewModel.CurrentWorkList.Type == ExamListViewType.Patient ? true : false;
                bool isTotalReadOnly = !patientRegistered || isPatientTab;

                // lock the case to prevent other people from accessing the report
                PathologyCaseUpdateAttributeResultType locked = viewModel.DataSource.LockCaseForEditing(item.CaseURN, true);

                ReportView window;
                if (locked.BoolSuccess)
                {
                    // open the report normally
                    window = new ReportView(new ReportViewModel(viewModel.DataSource, item, isTotalReadOnly, currentSiteType));

                    ViewModelLocator.ContextManager.IsBusy = true;
                    window.ShowDialog();

                    // unlock the case once the user has closed the report GUI
                    locked = viewModel.DataSource.LockCaseForEditing(item.CaseURN, false);
                }
                else
                {
                    // some one else is editing the report
                    string message = String.Format("{0}. Do you want to open it as read only?", locked.ErrorMessage);
                    MessageBoxResult result = MessageBox.Show(message, "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No);
                    if (result == MessageBoxResult.Yes)
                    {
                        // open the report as read only
                        window = new ReportView(new ReportViewModel(viewModel.DataSource, item, true, currentSiteType));

                        ViewModelLocator.ContextManager.IsBusy = true;
                        window.ShowDialog();
                    }
                }
            }
            finally
            {
                ViewModelLocator.ContextManager.IsBusy = false;
            }
        }