Пример #1
0
        public App()
        {
#if RELEASE
            if (!ApplicationDeployment.IsNetworkDeployed)
            {
                // this application was started up from the exe that isnt good.
                // restart application through clickonce.
                string   clickOnceApplication = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu) + "\\Programs\\Bend\\Bend\\Bend.appref-ms";
                string[] commandLineArgs      = Environment.GetCommandLineArgs();
                string   argument;
                if (commandLineArgs.Length > 1)
                {
                    if (System.IO.Path.IsPathRooted(commandLineArgs[1]))
                    {
                        argument = commandLineArgs[1];
                    }
                    else
                    {
                        argument = Environment.CurrentDirectory + "\\" + commandLineArgs[1];
                    }
                }
                else
                {
                    argument = "";
                }
                System.Diagnostics.Process.Start(clickOnceApplication, argument);
                this.Shutdown();
            }
#endif
            ICLRRuntimeInfo runtimeInfo = (ICLRRuntimeInfo)RuntimeEnvironment.GetRuntimeInterfaceAsObject(Guid.Empty, typeof(ICLRRuntimeInfo).GUID);
            runtimeInfo.BindAsLegacyV2Runtime();
        }
 private void aftermost()
 {
     try
     {
         ICLRRuntimeInfo rtInfo = (ICLRRuntimeInfo)RuntimeEnvironment.GetRuntimeInterfaceAsObject(Guid.Empty, typeof(ICLRRuntimeInfo).GUID);
         rtInfo.BindAsLegacyV2Runtime();
         string         path   = Directory.GetCurrentDirectory();
         var            a      = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
         ReportDocument report = new ReportDocument();
         report.Load(a + @"/CrystalReport4.rpt");
         CustomerLedgerDataSet ds  = new CustomerLedgerDataSet();
         DataTable             dt1 = ds.BillProduct;
         DataTable             dt2 = ds.Customer;
         foreach (var item in customer.CustomerCollection)
         {
             dt2.Rows.Add(item.Customerid, item.CustomerName, item.CustomerLocation, item.Customerbalance, item.CustomerLastTally, item.Customerphone);
         }
         report.SetDataSource(ds);
         crystalReportsViewer2.ViewerCore.ReportSource = report;
     }
     catch (Exception e1)
     {
         Debug.WriteLine(e1.Message);
     }
 }
Пример #3
0
        public static void UseLegacy()
        {
            ICLRRuntimeInfo clrRuntimeInfo =
                (ICLRRuntimeInfo)RuntimeEnvironment.GetRuntimeInterfaceAsObject(
                    Guid.Empty,
                    typeof(ICLRRuntimeInfo).GUID);

            clrRuntimeInfo.BindAsLegacyV2Runtime();
        }
Пример #4
0
 static void TryGetRuntimePolicy(ICLRRuntimeInfo clrRuntimeInfo) {
     try {
         clrRuntimeInfo.BindAsLegacyV2Runtime();
         LegacyV2RuntimeEnabledSuccessfully = true;
     } catch (COMException) {
         // This occurs with an HRESULT meaning 
         // "A different runtime was already bound to the legacy CLR version 2 activation policy."
         LegacyV2RuntimeEnabledSuccessfully = false;
     }
 }
Пример #5
0
 static void TryGetRuntimePolicy(ICLRRuntimeInfo clrRuntimeInfo)
 {
     try {
         clrRuntimeInfo.BindAsLegacyV2Runtime();
         LegacyV2RuntimeEnabledSuccessfully = true;
     } catch (COMException) {
         // This occurs with an HRESULT meaning
         // "A different runtime was already bound to the legacy CLR version 2 activation policy."
         LegacyV2RuntimeEnabledSuccessfully = false;
     }
 }
Пример #6
0
        private void POS_Product()
        {
            webHandler.POS_Get_ProductAsync();
            webHandler.POS_Get_ProductCompleted += (x, y) =>
            {
                var result = y.Result;
                product.ProductsCollection = new ObservableCollection <ProductsModel>();
                string[] arr = result.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                foreach (var item in arr)
                {
                    string[] arg = item.Split(new string[] { "---" }, StringSplitOptions.None);
                    product.ProductsCollection.Add(new ProductsModel()
                    {
                        Productid           = arg[0],
                        ProductName         = arg[1],
                        ProductCatagoryid   = arg[2],
                        ProductCatagoryDesc = arg[3],
                        ProductPrice        = arg[4],
                        ProductStatusid     = arg[5],
                        ProductStatusDesc   = arg[6],
                        ProductQuantity     = arg[7],
                        ProductDesc         = arg[8],
                        ProductBuyingPrice  = arg[9],
                        ProductProfit       = arg[10],
                    });
                }
                try
                {
                    ICLRRuntimeInfo rtInfo = (ICLRRuntimeInfo)RuntimeEnvironment.GetRuntimeInterfaceAsObject(Guid.Empty, typeof(ICLRRuntimeInfo).GUID);
                    rtInfo.BindAsLegacyV2Runtime();
                    report.Load("../../CrystalReport1.rpt");
                    report.SetDataSource(from c in product.ProductsCollection
                                         select new { c.Productid, c.ProductName, c.ProductCatagoryDesc, c.ProductPrice, c.ProductStatusDesc, c.ProductBuyingPrice, c.ProductQuantity });
                    crystalReportsViewer1.ViewerCore.ReportSource = report;
                }
                catch (Exception e1)
                {
                    Debug.WriteLine("Kush hua hai ");
                    Debug.WriteLine(e1.Message);
                }


                //ReportDocument report2 = new ReportDocument();
                //report2.Load("../../CrystalReport2.rpt");

                //report2.SetDataSource(from c in product.ProductsCollection
                //                     select new { c.Productid, c.ProductName, c.ProductCatagoryDesc, c.ProductPrice, c.ProductStatusDesc, c.ProductBuyingPrice, c.ProductQuantity });
                //crystalReportsViewer2.ViewerCore.ReportSource = report2;
            };
        }
Пример #7
0
    static RuntimePolicyHelper()
    {
        ICLRRuntimeInfo runtimeInterfaceAsObject = (ICLRRuntimeInfo)RuntimeEnvironment.GetRuntimeInterfaceAsObject(Guid.Empty, typeof(ICLRRuntimeInfo).GUID);

        try
        {
            runtimeInterfaceAsObject.BindAsLegacyV2Runtime();
            LegacyV2RuntimeEnabledSuccessfully = true;
        }
        catch (COMException exception)
        {
            Console.WriteLine(exception.Message);
            LegacyV2RuntimeEnabledSuccessfully = false;
        }
    }
Пример #8
0
 private void aftermost()
 {
     try
     {
         ICLRRuntimeInfo rtInfo = (ICLRRuntimeInfo)RuntimeEnvironment.GetRuntimeInterfaceAsObject(Guid.Empty, typeof(ICLRRuntimeInfo).GUID);
         rtInfo.BindAsLegacyV2Runtime();
         report.Load("../../CrystalReport2.rpt");
         report.SetDataSource(from c in product.SaleReportCollection
                              select new { c.Billid, c.Current_DateTime, c.Employee_Name, c.Product_id, c.Product_Name, c.Product_Quantity, c.Optionid, c.Optionname, c.OptionQty, c.Total, DFS, DTS, new LoggedInEmployeeModel().FullName });
         crystalReportsViewer2.ViewerCore.ReportSource = report;
     }
     catch (Exception e1)
     {
         Debug.WriteLine("Kush hua hai ");
         Debug.WriteLine(e1.Message);
     }
 }
Пример #9
0
        //private static void IncludeLibrariesInBuildButNotUsedInCode()
        //{
        //    Parser_OnlyToIncludeBatchParserDLL = new ManagedBatchParser.Parser();
        //    Parser_OnlyToIncludeBatchParserDLL = null;
        //    XMLAClient_OnlyToIncludeDLL = new XmlaClient();
        //    XMLAClient_OnlyToIncludeDLL = null;
        //    Culture_OnlyToIncludeDLL = new Culture();
        //    Culture_OnlyToIncludeDLL = null;
        //}

        static RuntimePolicyHelper()
        {
            ICLRRuntimeInfo clrRuntimeInfo =
                (ICLRRuntimeInfo)RuntimeEnvironment.GetRuntimeInterfaceAsObject(
                    Guid.Empty,
                    typeof(ICLRRuntimeInfo).GUID);

            try {
                clrRuntimeInfo.BindAsLegacyV2Runtime();
                LegacyV2RuntimeEnabledSuccessfully = true;
            }
            catch (COMException) {
                // This occurs with an HRESULT meaning
                // "A different runtime was already bound to the legacy CLR version 2 activation policy."
                LegacyV2RuntimeEnabledSuccessfully = false;
            }
        }
Пример #10
0
        private async void aftermost()
        {
            try
            {
                ICLRRuntimeInfo rtInfo = (ICLRRuntimeInfo)RuntimeEnvironment.GetRuntimeInterfaceAsObject(Guid.Empty, typeof(ICLRRuntimeInfo).GUID);
                rtInfo.BindAsLegacyV2Runtime();

                var            a      = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
                ReportDocument report = new ReportDocument();
                report.Load(a + @"/CrystalReport3.rpt");


                CustomerLedgerDataSet ds  = new CustomerLedgerDataSet();
                DataTable             dt1 = ds.BillProduct;
                DataTable             dt2 = ds.Customer;

                // assume columns have been created
                foreach (var c in billProductModel.BillCollection)
                {
                    dt1.Rows.Add(c.DateTime, c.Billid, c.Quantity, c.ProductName, c.Rate, c.TotalAmount, c.Status, c.Balance);
                }

                dt2.Rows.Add(selectedCustomer.Customerid, selectedCustomer.CustomerName, selectedCustomer.CustomerLocation, selectedCustomer.Customerbalance, selectedCustomer.CustomerLastTally, selectedCustomer.Customerphone);

                report.SetDataSource(ds);

                crystalReportsViewer2.ViewerCore.ReportSource = report;
            }
            catch (Exception e1)
            {
                var win  = (MetroWindow)Application.Current.MainWindow;
                var res1 = await win.ShowMessageAsync(" source: " + e1.Source, e1.Message + "  ||   " + e1.StackTrace +
                                                      MessageDialogStyle.Affirmative);

                Debug.WriteLine(e1.Message);
            }
        }