Esempio n. 1
0
        private void btnChartMarket_Click(object sender, EventArgs e)
        {
            WinForms.SetWaitCursor(true);

            try
            {
                zChartInterval interval = (zChartInterval)Enum.Parse(typeof(zChartInterval), comboChartInterval.Text);

                EZInstrument instrument = APIMain.Instance.ShowInstrumentDialog();

                if (instrument == null)
                {
                    status.Text = "No instrument selected.";
                }
                else
                {
                    status.Text = "*** LOADING CHART ***";
                    RequestChartData(instrument, interval, Convert.ToInt32(numericPeriod.Value));
                }
            }
            finally
            {
                WinForms.SetWaitCursor(false);
            }
        }
        private void browser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            //e.Cancel = true;
            string urlString = e.Url.ToString();
            int    i         = urlString.IndexOf("#link");

            if (i >= 0)
            {
                string link = urlString.Substring(i);
                Console.WriteLine(link);
                e.Cancel = true;

                RuleValue       rv            = links[link];
                DPModifyControl modifyControl = rv.DataProvider.GetModifyUserInterface();
                var             form          = DPControlContainerModifyForm.CreateForm(modifyControl);

                WinForms.SetFormRelativePosition(form, this, FormRelativePosition.LEFT);
                DialogResult dialogResult = form.ShowDialog(this);

                if (dialogResult == DialogResult.OK)
                {
                    rv.DataProvider.UpdateProviderFromPropertyValues();
                    DisplayTradeDescription();
                }
            }
        }
Esempio n. 3
0
        private void cmdClipboardBBCodeAll_Click(object sender, EventArgs e)
        {
            IEnumerable <AttackPlanFrom> plans = GetAllAttacks();
            string export = AttackPlanExporter.GetMultiPlanBbCodeExport(plans);

            WinForms.ToClipboard(export);
        }
Esempio n. 4
0
        /// <summary>
        ///  Called whenever an error occurs in the controller object
        /// </summary>
        /// <param name="Sender"></param>
        /// <param name="Diagnostic"></param>
        void Controller_OnException(Exception ExceptionData)
        {
            // Shows each error message
            WinForms.MessageBoxShow(ExceptionData);

            // TODO your error handling can be inserted here
        }
 private void btnCharts_Click(object sender, EventArgs e)
 {
     WinForms.SetFormRelativePosition(chartLaunchForm, this);
     chartLaunchForm.WindowState = FormWindowState.Normal;
     chartLaunchForm.BringToFront();
     chartLaunchForm.Show();
     //WinForms.SetWindowState("MonkeyChart.vshost", Win32.WindowState.SW_NORMAL);
 }
Esempio n. 6
0
 private void cmdClipboardBBCode_Click(object sender, EventArgs e)
 {
     if (ActivePlan != null)
     {
         string export = AttackPlanExporter.GetSinglePlanBbCodeExport(ActivePlan.Plan);
         WinForms.ToClipboard(export);
     }
 }
        private void RequestChartData(EZInstrument instrument, zChartInterval interval, int period)
        {
            ChartDataForm chartForm;

            // Set EndDate to the current trading date.
            //DateTime dtEndDate = selectedContract.GetTradeDate(DateTime.Now);
            DateTime dtEndDate = DateTime.Now;

            DateTime dtStartDate;

            // Pick a different start date depending on if we are viewing DAYS, HOURS, MINUTES, etc...
            if (interval == zChartInterval.Week)
            {
                dtStartDate = dtEndDate.AddMonths(-16);
            }
            else if (interval == zChartInterval.Day)
            {
                dtStartDate = dtEndDate.AddMonths(-5);
            }
            else if (interval == zChartInterval.Minute)
            {
                dtStartDate = dtEndDate;
                if (period <= 15)   // 15 minute (or less) bars
                {
                    dtStartDate = dtStartDate.AddTradeHours(-4);
                }
                else                // more than 15 minute bars
                {
                    dtStartDate = dtStartDate.AddTradeDays(-2);
                }
            }
            else
            {
                // Anything we haven't covered, we'll load a couple days (not ideal - needs to be improved).
                dtStartDate = dtEndDate;
                dtStartDate = dtStartDate.AddTradeDays(-3);

                /*// This little loop here will ensure that we load the previous trade date as well as today and will account for weekends
                 * // and holidays.
                 * while ((selectedContract.GetTradeDate(dtStartDate) == dtEndDate))
                 * {
                 *  dtStartDate = dtStartDate.AddDays(-1);
                 * }*/
            }

            // Create a BarInterval object to tell the API what bar interval we want.
            // So for example, if we wanted a 15 minute bar, we would do:  New ezBarInterval(zChartDataType.Minute, 15)
            ezBarInterval ezbi = new ezBarInterval(interval, period);

            IChartDataProvider provider = new ChartDataProviderCTS(instrument.Name + " : " + ezbi, ezbi, ezSessionTimeRange.Empty);

            chartForm = new ChartDataForm(provider);
            WinForms.SetWaitCursor(true);
            //provider.LoadHistoricalChartData(APIMain.MarketFromInstrument(instrument), dtStartDate, dtEndDate);
            provider.LoadRealTimeChartData(APIMain.MarketFromInstrument(instrument), dtStartDate);

            chartForm.Show();
        }
Esempio n. 8
0
        public virtual void setToParent()
        {
            this.hwndOld = WINAPI_test.INSTANCE.SetParent(getExternalHandle(), ThisHandle);
            int i = User32.INSTANCE.GetWindowLong(getExternalHandle(), -16);

            i |= 0x50000000;
            User32.INSTANCE.SetWindowLong(getExternalHandle(), -16, i);
            WinForms.registerForeignWindow(ThisHandle);
        }
        void provider_DataLoadComplete(object sender, ezDataLoadCompleteEventArgs e)
        {
            WinForms.SetWaitCursor(false);

            this.Invoke((MethodInvoker) delegate
            {
                this.Text = provider.Name;
            });
        }
Esempio n. 10
0
        private void removeFromParent()
        {
            int i = User32.INSTANCE.GetWindowLong(getExternalHandle(), -16);

            i &= unchecked ((int)0xAFFFFFFF);
            User32.INSTANCE.SetWindowLong(getExternalHandle(), -16, i);
            WINAPI_test.INSTANCE.SetParent(getExternalHandle(), this.hwndOld);
            WinForms.unregisterForeignWindow(ThisHandle);
        }
        public static void openAscx()
        {
            var sourceCodeAST = (ascx_View_SourceCode_AST)WinForms.showAscxInForm(
                typeof(ascx_View_SourceCode_AST),
                "View SourceCode AST",
                700,
                500);

            sourceCodeAST.loadFile(testFileToUse());
        }
Esempio n. 12
0
        /// <summary>
        /// Create BB code for the villages and put on clipboard
        /// </summary>
        private void OnBbCode(object sender, EventArgs e)
        {
            var str = new StringBuilder();

            foreach (Village village in _villages)
            {
                str.AppendFormat("{0}{1}", village.BbCode(), Environment.NewLine);
            }

            WinForms.ToClipboard(str.ToString());
        }
        public void showAvailableScripts()
        {
            status("Showing available scripts");
            //var path = XRules_Config.PathTo_XRulesDatabase_fromO2;
            var path = PublicDI.config.LocalScriptsFolder;

            Action <TreeView, TreeNode> mapFoldersAndFiles =
                (targetTreeView, treeNode) =>
            {
                targetTreeView.clear(treeNode);
                var folder = treeNode.Tag.ToString();
                foreach (var dir in folder.dirs())
                {
                    if (dir.contains(".svn").isFalse())
                    {
                        targetTreeView.add_Node(treeNode, dir.fileName(), dir, true)
                        .ForeColor = Color.SaddleBrown;
                    }
                }
                foreach (var file in folder.files())
                {
                    targetTreeView.add_Node(treeNode, file.fileName(), file, false)
                    .ForeColor = Color.DarkBlue;
                }
            };
            //var treeView = new TreeView();
            var treeView = (TreeView)WinForms.showAscxInForm(typeof(TreeView), "O2 - Available scripts", 300, 300);

            treeView.BeforeExpand         += (sender, e) => { mapFoldersAndFiles(treeView, e.Node); };
            treeView.NodeMouseDoubleClick += (sender, e) =>
            {
                var target = e.Node.Tag.ToString();
                if (target.isFile())
                {
                    loadFile(target);
                }
            };
            treeView.ItemDrag += (sender, e) =>
            {
                var node = (TreeNode)e.Item;
                treeView.SelectedNode = node;
                var target = node.Tag.ToString();
                if (target.isFile())
                {
                    treeView.DoDragDrop(target, DragDropEffects.Copy);
                }
            };

            var rootNode = treeView.add_Node("Scripts in: " + path + "", path, true);

            mapFoldersAndFiles(treeView, rootNode);
            treeView.expand(rootNode);
        }
Esempio n. 14
0
        private void RequestChartData(EZInstrument instrument, zChartInterval interval, int period)
        {
            // Set EndDate to the current trading date.
            //DateTime dtEndDate = selectedContract.GetTradeDate(DateTime.Now);
            DateTime dtEndDate = DateTime.Now;

            DateTime       dtStartDate;
            zChartInterval enBarInterval = zChartInterval.Hour;

            if (interval == zChartInterval.Day)
            {
                enBarInterval = zChartInterval.Day;

                // User select Day bars, load a few months of them.
                dtStartDate = dtEndDate.AddMonths(-3);
            }
            else
            {
                enBarInterval = interval;

                // User selected non-Day bars (Hour, Minute, etc.), load a couple of days of them.
                dtStartDate = dtEndDate;
                dtStartDate = dtStartDate.AddDays(-3);

                /*// This little loop here will ensure that we load the previous trade date as well as today and will account for weekends
                 * // and holidays.
                 * while ((selectedContract.GetTradeDate(dtStartDate) == dtEndDate))
                 * {
                 *  dtStartDate = dtStartDate.AddDays(-1);
                 * }*/
            }

            // Create a BarInterval object to tell the API what bar interval we want.
            // So for example, if we wanted a 15 minute bar, we would do:  New ezBarInterval(zChartDataType.Minute, 15)
            ezBarInterval oBarIntvl = new ezBarInterval(enBarInterval, period);

            string             chartName = instrument.Name + " : " + oBarIntvl;
            IChartDataProvider provider  = new ChartDataProviderCTS(chartName, oBarIntvl, ezSessionTimeRange.Empty);

            if (LoadingNewChart != null)
            {
                LoadingNewChart(provider);
            }
            this.SetChartDataProvider(provider);
            WinForms.SetWaitCursor(true);
            provider.LoadHistoricalChartData(APIMain.MarketFromInstrument(instrument), dtStartDate, dtEndDate);
        }
Esempio n. 15
0
        /// <summary>
        /// The selected villages are exported to the clipboard
        /// </summary>
        private void ButtonGenerate_Click(object sender, System.EventArgs e)
        {
            if (GridExVillage.RowCount == 0)
            {
                MessageBox.Show(string.Format(ControlsRes.PolygonControl_EmptyGrid, LoadPolygonData.Text), ControlsRes.PolygonControl_StartHelpTitle);
                return;
            }

            var str = new StringBuilder();
            int villagesExported = 0;

            foreach (GridEXRow groupRow in GridExVillage.GetRows())
            {
                if (groupRow.RowType == RowType.GroupHeader)
                {
                    str.AppendLine();
                    str.AppendLine();
                    str.AppendLine(groupRow.GroupValue.ToString());
                    foreach (GridEXRow row in groupRow.GetChildRecords())
                    {
                        if (row.CheckState == RowCheckState.Checked)
                        {
                            villagesExported++;

                            var villageRow = (PolygonDataSet.VILLAGERow)((DataRowView)row.DataRow).Row;
                            if (!string.IsNullOrWhiteSpace(villageRow.Village.Type.GetDescription()))
                            {
                                str.AppendLine(villageRow.BBCODE + " (" + villageRow.Village.Type.GetDescription() + ")");
                            }
                            else
                            {
                                str.AppendLine(villageRow.BBCODE);
                            }
                        }
                    }
                }
            }

            if (WinForms.ToClipboard(str.ToString().Trim()))
            {
                MessageBox.Show(string.Format(ControlsRes.PolygonControl_ToClipboard, villagesExported), ControlsRes.PolygonControl_ToClipboardTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 16
0
        public LightningLoaderForm()
        {
            InitializeComponent();

            /*IDataProvider dp = new DataProviderTest();
             *
             * XmlSaveDataProvider save = dp.SaveData;
             *
             * string filename = @"G:\DATA\PROJECTS\MonkeyLightning\EZTrader\bin\Debug\test";
             *
             * bool success;
             * success = Xml.Serialize(save, typeof(XmlSaveDataProvider), filename + ".xml");
             * success = Binary.Serialize(save, filename + ".bin");
             * success = DataContract.Serialize(save, typeof(XmlSaveDataProvider), filename + ".dat");
             *
             * XmlSaveDataProvider restore;
             * restore = (XmlSaveDataProvider)Xml.Deserialize(typeof(XmlSaveDataProvider), filename + ".xml");
             * restore = (XmlSaveDataProvider)Binary.Deserialize(filename + ".bin");
             * restore = (XmlSaveDataProvider)DataContract.Deserialize(typeof(XmlSaveDataProvider), filename + ".dat");
             *
             * return;*/


            dashboardForm = new DashboardForm();
            dashboardForm.DashboardClosing += dashboardForm_DashboardClosing;
            dashboardForm.Show();

            WinForms.SetFormRelativePosition(this, dashboardForm);

            splashForm = new SplashForm();
            splashForm.Show();

            WinForms.SetFormRelativePosition(splashForm, dashboardForm);

            dashboardForm.UseWaitCursor = true;
            splashForm.UseWaitCursor    = true;

            Application.DoEvents();

            // Finally register Form events.
            this.Load   += new System.EventHandler(this.frmMain_Load);
            this.Closed += new System.EventHandler(this.frmMain_Closed);
        }
Esempio n. 17
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     Debug.Assert(value != null, "value != null");
     WinForms.ToClipboard(value.ToString());
     return(base.EditValue(context, provider, value));
 }
Esempio n. 18
0
 /// <summary>
 /// Put target player operation BBCoded on clipboard
 /// </summary>
 private void OnBbCodeOperation(object sender, EventArgs e)
 {
     WinForms.ToClipboard(_player.BbCodeMatt());
 }
        private void comboValue2_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (settingComboValue == true)
            {
                return;
            }

            ShowTrueFalseBox(false);

            string dataProviderName = comboValue2.Text;

            dataProvider2 = (IDataProvider)Activator.CreateInstance(dataProviders[dataProviderName]);

            txtDescription.Text = dataProvider2.Name + ": " + dataProvider2.Description;

            DialogResult dialogResult = System.Windows.Forms.DialogResult.Cancel;

            // See if we need to display a UI for this data provider.
            if (dataProvider2.GetModifyUserInterface() != null)
            {
                DPModifyControl modifyControl = dataProvider2.GetModifyUserInterface();
                Size            controlSize   = modifyControl.Size;
                var             dpModifyForm  = new DPControlContainerModifyForm();
                dpModifyForm.Width  = controlSize.Width + 16;
                dpModifyForm.Height = controlSize.Height + 112;
                Panel panel = dpModifyForm.Controls["panelControl"] as Panel;
                panel.Controls.Add(modifyControl);
                modifyControl.Dock = DockStyle.Fill;

                WinForms.SetFormRelativePosition(dpModifyForm, this, FormRelativePosition.RIGHT);
                dialogResult = dpModifyForm.ShowDialog(this);

                if (dialogResult == DialogResult.OK)
                {
                    dataProvider2.UpdateProviderFromPropertyValues();
                }
                else
                {
                    ResetComboValue2();
                }
            }

            if (dataProvider2.GetModifyUserInterface() == null || dialogResult == System.Windows.Forms.DialogResult.OK)
            {
                previousComboValue2      = comboValue2.SelectedIndex;
                ruleValue2               = new RuleValue(dataProvider2);
                ruleValue2.ValueUpdated += ruleValue_ValueUpdated;
                DPDisplayControl displayControl = ruleValue2.DataProvider.GetDisplayUserInterface();
                panelValue2UI.Controls.Clear();
                panelValue2UI.Controls.Add(displayControl);
                displayControl.Dock = DockStyle.Fill;

                dataProvider2.UpdateProviderFromPropertyValues();

                if (dataProvider2.GetModifyUserInterface() == null)
                {
                    displayControl.Cursor = Cursors.Default;
                }
                else
                {
                    displayControl.Cursor = Cursors.Hand;
                    displayControl.Click += displayControl2_Click;
                }

                CheckConditionEnableTest();
            }
        }
Esempio n. 20
0
 /// <summary>
 /// Put target tribe BBCoded on clipboard
 /// </summary>
 private void OnBbCode(object sender, EventArgs e)
 {
     WinForms.ToClipboard(_tribe.BbCode());
 }
Esempio n. 21
0
 /// <summary>
 /// Put target tribe tag on clipboard
 /// </summary>
 private void OnToClipboard(object sender, EventArgs e)
 {
     WinForms.ToClipboard(_tribe.Tag);
 }
Esempio n. 22
0
 //Title控制窗口移动
 private void TitlePanal_MouseDown(object sender, MouseEventArgs e)
 {
     WinForms.MoveFrom(this.Handle);
 }
Esempio n. 23
0
        void ContinueInit()
        {
            var list = Application.Context.GetExternalFilesDirs(null);

            list.ForEach(a => Log.Info("MP", "External dir option: " + a.AbsolutePath));

            var list2 = Application.Context.GetExternalFilesDirs(Environment.DirectoryDownloads);

            list2.ForEach(a => Log.Info("MP", "External DirectoryDownloads option: " + a.AbsolutePath));

            var pref = this.GetSharedPreferences("pref", FileCreationMode.Private);


            Settings.CustomUserDataDirectory = Application.Context.GetExternalFilesDir(null).ToString();
            //pref.GetString("Directory", Application.Context.GetExternalFilesDir(null).ToString());
            Log.Info("MP", "Settings.CustomUserDataDirectory " + Settings.CustomUserDataDirectory);

            try {
                WinForms.BundledPath = Application.Context.ApplicationInfo.NativeLibraryDir;
            } catch { }
            Log.Info("MP", "WinForms.BundledPath " + WinForms.BundledPath);

            Test.BlueToothDevice = new BTDevice();
            Test.UsbDevices      = new USBDevices();
            Test.Radio           = new Radio();
            Test.GPS             = new GPS();
            Test.SystemInfo      = new SystemInfo();

            androidvideo = new AndroidVideo();
            //disable
            //androidvideo.Start();
            AndroidVideo.onNewImage += (e, o) =>
            {
                WinForms.SetHUDbg(o);
            };


            //ConfigFirmwareManifest.ExtraDeviceInfo

            /*
             * var intent = new global::Android.Content.Intent(Intent.ActionOpenDocumentTree);
             *
             * intent.AddFlags(ActivityFlags.GrantWriteUriPermission | ActivityFlags.GrantReadUriPermission);
             * intent.PutExtra(DocumentsContract.ExtraInitialUri, "Mission Planner");
             *
             * StartActivityForResult(intent, 1);
             */

            UserDialogs.Init(this);

            AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironment_UnhandledExceptionRaiser;

            {
                if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.AccessFineLocation) !=
                    (int)Permission.Granted ||
                    ContextCompat.CheckSelfPermission(this, Manifest.Permission.WriteExternalStorage) !=
                    (int)Permission.Granted ||
                    ContextCompat.CheckSelfPermission(this, Manifest.Permission.Bluetooth) !=
                    (int)Permission.Granted)
                {
                    ActivityCompat.RequestPermissions(this,
                                                      new String[]
                    {
                        Manifest.Permission.AccessFineLocation, Manifest.Permission.LocationHardware,
                        Manifest.Permission.WriteExternalStorage, Manifest.Permission.ReadExternalStorage,
                        Manifest.Permission.Bluetooth
                    }, 1);
                }

                while (ContextCompat.CheckSelfPermission(this, Manifest.Permission.WriteExternalStorage) !=
                       (int)Permission.Granted)
                {
                    Thread.Sleep(1000);
                    var text = "Checking Permissions - " + DateTime.Now.ToString("T");

                    DoToastMessage(text);
                }
            }

            try {
                // print some info
                var pm   = this.PackageManager;
                var name = this.PackageName;

                var pi = pm.GetPackageInfo(name, PackageInfoFlags.Activities);

                Console.WriteLine("pi.ApplicationInfo.DataDir " + pi?.ApplicationInfo?.DataDir);
                Console.WriteLine("pi.ApplicationInfo.NativeLibraryDir " + pi?.ApplicationInfo?.NativeLibraryDir);

                // api level 24 - android 7
                Console.WriteLine("pi.ApplicationInfo.DeviceProtectedDataDir " +
                                  pi?.ApplicationInfo?.DeviceProtectedDataDir);
            } catch {}


            {
                // clean start, see if it was an intent/usb attach
                //if (savedInstanceState == null)
                {
                    DoToastMessage("Init Saved State");
                    proxyIfUsbAttached(this.Intent);

                    Console.WriteLine(this.Intent?.Action);
                    Console.WriteLine(this.Intent?.Categories);
                    Console.WriteLine(this.Intent?.Data);
                    Console.WriteLine(this.Intent?.DataString);
                    Console.WriteLine(this.Intent?.Type);
                }
            }

            GC.Collect();

            /*
             * Task.Run(() =>
             * {
             *  var gdaldir = Settings.GetRunningDirectory() + "gdalimages";
             *  Directory.CreateDirectory(gdaldir);
             *
             *  MissionPlanner.Utilities.GDAL.GDALBase = new GDAL.GDAL();
             *
             *  GDAL.GDAL.ScanDirectory(gdaldir);
             *
             *  GMap.NET.MapProviders.GMapProviders.List.Add(GDAL.GDALProvider.Instance);
             * });
             */

            DoToastMessage("Launch App");

            LoadApplication(new App());
        }
Esempio n. 24
0
 private static bool HasAllowedPlatformPropertiesForText(IA11yElement e)
 {
     return(!WinForms.Matches(e) ||
            !HasStaticEdgeExtendedStyle(e));
 }
Esempio n. 25
0
        private void chart1_MouseDown(object sender, MouseEventArgs e)
        {
            HitTestResult result = chart1.HitTest(e.X, e.Y);

            // Check to see if the user has CLICKED ON A CANDLESTICK BAR.
            if (result.ChartElementType == ChartElementType.DataPoint)
            {
                DataPoint dp = result.Object as DataPoint;

                // Only going to check this out if the user has specifically enabled bar select (may not want it on a "normal" chart)
                if (BarSelectEnabled == true)
                {
                    // Try to find the index of this data point in the main chart series.
                    int barIndex = chart1.Series[0].Points.IndexOf(dp);

                    // If the user has clicked on a valid data point, display the form to select a series.
                    if (chooseBarDataForm != null && barIndex >= 0)
                    {
                        HighlightDataPoint(dp);

                        WinForms.SetFormRelativePosition(chooseBarDataForm, this);
                        chooseBarDataForm.BarIndex = barIndex;
                        chooseBarDataForm.ShowDialog(this);

                        if (chooseBarDataForm.UserSelection == DialogResult.OK && chooseBarDataForm.SelectedSeries != null)
                        {
                            BarIndex        = chooseBarDataForm.BarIndex;
                            ReverseBarIndex = chooseBarDataForm.ReverseBarIndex;
                            SelectedSeries  = chooseBarDataForm.SelectedSeries;
                            UpdateCurrentValue();
                        }
                    }
                }
            }
            // Check to see if the user has CLICKED ON AN AXIS.
            else if (result.ChartElementType == ChartElementType.AxisLabels)
            {
                CustomLabel label = result.Object as CustomLabel;

                Axis yAxisMain   = chart1.ChartAreas["ChartAreaMain"].AxisY;
                Axis yAxisBottom = chart1.ChartAreas["ChartAreaBottom"].AxisY;

                // This code deals only with the Y-AXIS of the MAIN chart area.
                if (label.Axis == yAxisMain || label.Axis == yAxisBottom)
                {
                    mouseX     = e.X;
                    mouseY     = e.Y;
                    activeAxis = label.Axis;

                    // Check for either left or right mouse button.
                    if (e.Button == MouseButtons.Left)
                    {
                        leftButtonDown = true;
                    }
                    else if (e.Button == MouseButtons.Right)
                    {
                        rightButtonDown = true;
                    }

                    this.Cursor = Cursors.HSplit;
                }
            }
        }
Esempio n. 26
0
 /// <summary>
 /// Put target player name on clipboard
 /// </summary>
 private void OnToClipboard(object sender, EventArgs e)
 {
     WinForms.ToClipboard(_player.Name);
 }
Esempio n. 27
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Current = this;

            AppDomain.CurrentDomain.UnhandledException   += CurrentDomain_UnhandledException;
            AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException;

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            SetSupportActionBar((Toolbar)FindViewById(ToolbarResource));

            this.Window.AddFlags(WindowManagerFlags.Fullscreen | WindowManagerFlags.TurnScreenOn | WindowManagerFlags.HardwareAccelerated);

            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);

            Settings.CustomUserDataDirectory = Application.Context.GetExternalFilesDir(null).ToString();
            Log.Info("MP", "Settings.CustomUserDataDirectory " + Settings.CustomUserDataDirectory);

            WinForms.BundledPath = Application.Context.ApplicationInfo.NativeLibraryDir;
            Log.Info("MP", "WinForms.BundledPath " + WinForms.BundledPath);

            Test.BlueToothDevice = new BTDevice();
            Test.UsbDevices      = new USBDevices();
            Test.Radio           = new Radio();
            Test.GPS             = new GPS();

            androidvideo = new AndroidVideo();
            //disable
            //androidvideo.Start();
            AndroidVideo.onNewImage += (e, o) =>
            {
                WinForms.SetHUDbg(o);
            };


            //ConfigFirmwareManifest.ExtraDeviceInfo

            /*
             * var intent = new global::Android.Content.Intent(Intent.ActionOpenDocumentTree);
             *
             * intent.AddFlags(ActivityFlags.GrantWriteUriPermission | ActivityFlags.GrantReadUriPermission);
             * intent.PutExtra(DocumentsContract.ExtraInitialUri, "Mission Planner");
             *
             * StartActivityForResult(intent, 1);
             */

            UserDialogs.Init(this);

            AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironment_UnhandledExceptionRaiser;

            {
                if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.AccessFineLocation) !=
                    (int)Permission.Granted ||
                    ContextCompat.CheckSelfPermission(this, Manifest.Permission.WriteExternalStorage) !=
                    (int)Permission.Granted ||
                    ContextCompat.CheckSelfPermission(this, Manifest.Permission.Bluetooth) !=
                    (int)Permission.Granted)
                {
                    ActivityCompat.RequestPermissions(this,
                                                      new String[]
                    {
                        Manifest.Permission.AccessFineLocation, Manifest.Permission.LocationHardware,
                        Manifest.Permission.WriteExternalStorage, Manifest.Permission.ReadExternalStorage,
                        Manifest.Permission.Bluetooth
                    }, 1);
                }

                while (ContextCompat.CheckSelfPermission(this, Manifest.Permission.WriteExternalStorage) !=
                       (int)Permission.Granted)
                {
                    Thread.Sleep(1000);
                    var text = "Checking Permissions - " + DateTime.Now.ToString("T");

                    DoToastMessage(text);
                }
            }

            try {
                // print some info
                var pm   = this.PackageManager;
                var name = this.PackageName;

                var pi = pm.GetPackageInfo(name, PackageInfoFlags.Activities);

                Console.WriteLine("pi.ApplicationInfo.DataDir " + pi?.ApplicationInfo?.DataDir);
                Console.WriteLine("pi.ApplicationInfo.NativeLibraryDir " + pi?.ApplicationInfo?.NativeLibraryDir);

                // api level 24 - android 7
                Console.WriteLine("pi.ApplicationInfo.DeviceProtectedDataDir " +
                                  pi?.ApplicationInfo?.DeviceProtectedDataDir);
            } catch {}

            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

            {
                // clean start, see if it was an intent/usb attach
                if (savedInstanceState == null)
                {
                    DoToastMessage("Init Saved State");
                    proxyIfUsbAttached(this.Intent);
                }
            }

            GC.Collect();
            Task.Run(() =>
            {
                var gdaldir = Settings.GetRunningDirectory() + "gdalimages";
                Directory.CreateDirectory(gdaldir);

                MissionPlanner.Utilities.GDAL.GDALBase = new GDAL.GDAL();

                GDAL.GDAL.ScanDirectory(gdaldir);

                GMap.NET.MapProviders.GMapProviders.List.Add(GDAL.GDALProvider.Instance);
            });


            DoToastMessage("Launch App");

            LoadApplication(new App());
        }
Esempio n. 28
0
 /// <summary>
 /// Put village location on clipboard
 /// </summary>
 private void OnToClipboard(object sender, CommandEventArgs e)
 {
     WinForms.ToClipboard(_village.LocationString);
 }
 public static Control showInForm(this Type ascxType, string name, int width, int height)
 {
     return(WinForms.showAscxInForm(ascxType, name, width, height));
 }
Esempio n. 30
0
 /// <summary>
 /// Put village BBCode on clipboard
 /// </summary>
 private void OnBbCode(object sender, CommandEventArgs e)
 {
     WinForms.ToClipboard(_village.BbCode());
 }