Exemplo n.º 1
0
        public bool ShowDialog(Handling handling, string DrawingGroupName)
        {
            List <DrawingsName> DrawingInDrawingGroupName = Repository.GetDrawingInGroupName(DrawingGroupName);

            _drawingInDrawingGroupName = DrawingInDrawingGroupName;
            _drawingGroupName          = DrawingGroupName;
            Transaction transaction = new Transaction(_document);
            bool        isSuccess   = Pull(ref handling);

            if (isSuccess == true)
            {
                MainViewModel mainViewModel = new MainViewModel(_document, _categoryName);
                mainViewModel.SetDataVM(ListObjBelowLocal, ListObjHasSynch, ListObjOnStack, GroupDrawings);
                mainView view = new mainView();
                view.DataContext = mainViewModel;

                view.ShowDialog();
                // Xu ly local
                //Push server
                if (mainViewModel.DialogResult == DialogResultType.Ok)
                {
                    if (!IsTimeOut.Invoke())
                    {
                        Push(handling);
                        if (PushServerInvoke != null && PushServerInvoke.Invoke())
                        {
                            _document.Save();
                            Utils.MessageInfor(Define.Ok);
                        }
                        else
                        {
                            // Rollback Local
                        }
                    }
                    else
                    {
                        Utils.MessageError(Define.TimeOut);
                    }
                }
                else
                {
                    ReleaseAuthen.Invoke();
                }
                return(true);
            }
            else
            {
                Utils.MessageWarning(Define.MissingFamilyInstance);
                return(false);
            }
        }
Exemplo n.º 2
0
        private void SVP_plugin_v3_Load(object sender, EventArgs e)
        {
            if (this.ParentForm != null)
            {
                mv = (mainView)Application.OpenForms[0];                          //--this links mv property to signalplant application
            }
            numFreq1.Maximum = System.Convert.ToDecimal(mainView.sampleFrequency / 2);
            numFreq2.Maximum = System.Convert.ToDecimal(mainView.sampleFrequency / 2);
            numOrder.Enabled = true;
            numFreq1.Enabled = true;
            numFreq2.Enabled = false;
            label9.Text      = Get_CUDA_DriversDirectory();
            if (label9.Text == "No CUDA drivers found.")
            {
                label9.BackColor = Color.Red;
                MessageBox.Show("No CUDA drivers found.");
                cudaOK = false;
            }
            int deviceCount = CudaContext.GetDeviceCount();
            List <CudaDeviceProperties> result = new List <CudaDeviceProperties>(deviceCount);

            for (int i = 0; i < deviceCount; i++)
            {
                result.Add(CudaContext.GetDeviceInfo(i));
            }
            label1.Text = result[0].DeviceName;
            label2.Text = (result[0].TotalGlobalMemory / (1024 * 1024)).ToString() + " MB";
            label3.Text = (result[0].ClockRate / 1000).ToString() + " MHz";
            if (result[0].ComputeCapability.Major >= 3)
            {
                label4.Text = (result[0].ComputeCapability).ToString();
            }
            else
            {
                label4.Text      = (result[0].ComputeCapability).ToString() + ". GPU Compute capability not supported.";
                label4.BackColor = Color.Red;
                MessageBox.Show("GPU Compute capability not supported. Compute capability 3.0 or greater is supported.");
                cudaOK = false;
            }

            label10.Visible = false;
            if (cudaOK == false)
            {
                this.Enabled = false;
            }
            refrControls();
        }