Ejemplo n.º 1
0
        private async Task splitScreen()
        {
            Form main = (from Framework.Interfaces.IPluginUIMainWindow a in Core.GetPlugin(Framework.PluginType.UIMainWindow) select a.MainForm).FirstOrDefault();

            if (main != null)
            {
                //get the 3 screens: cache list, geocache viewer and map
                Framework.Interfaces.IPluginUIChildWindow gclistPlugin = (from Framework.Interfaces.IPluginUIChildWindow a in Core.GetPlugin(Framework.PluginType.UIChildWindow) where a.GetType().ToString() == "GlobalcachingApplication.Plugins.SimpleCacheList.SimpleCacheList" select a).FirstOrDefault();
                Framework.Interfaces.IPluginUIChildWindow viewerPlugin = (from Framework.Interfaces.IPluginUIChildWindow a in Core.GetPlugin(Framework.PluginType.UIChildWindow) where a.GetType().ToString() == "GlobalcachingApplication.Plugins.GCView.GeocacheViewer" select a).FirstOrDefault();
                Framework.Interfaces.IPluginUIChildWindow mapPlugin    = (from Framework.Interfaces.IPluginUIChildWindow a in Core.GetPlugin(Framework.PluginType.Map) where a.GetType().ToString() == "GlobalcachingApplication.Plugins.GMap.GMap" select a).FirstOrDefault();
                if (gclistPlugin != null && viewerPlugin != null && mapPlugin != null)
                {
                    await gclistPlugin.ActionAsync(gclistPlugin.DefaultAction);

                    await viewerPlugin.ActionAsync(viewerPlugin.DefaultAction);

                    await mapPlugin.ActionAsync(mapPlugin.DefaultAction);

                    if (gclistPlugin.ChildForm != null && viewerPlugin.ChildForm != null && mapPlugin.ChildForm != null)
                    {
                        System.Drawing.Size clntSize = main.ClientSize;
                        clntSize.Height -= 80;
                        clntSize.Width  -= 20;
                        gclistPlugin.ChildForm.SetBounds(0, 0, clntSize.Width, clntSize.Height / 2);
                        viewerPlugin.ChildForm.SetBounds(0, clntSize.Height / 2, clntSize.Width / 2, clntSize.Height / 2);
                        mapPlugin.ChildForm.SetBounds(clntSize.Width / 2, clntSize.Height / 2, clntSize.Width / 2, clntSize.Height / 2);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 private async Task openPreset(string presetname)
 {
     try
     {
         int pos = presetname.IndexOf('|');
         if (pos > 0)
         {
             presetname = presetname.Substring(pos + 1);
             if (_presets.Contains(presetname))
             {
                 //lock (Core.SettingsProvider)
                 {
                     List <Framework.Interfaces.IPlugin> pins = Core.GetPlugins();
                     List <FormsPoco> pocos = Core.SettingsProvider.Database.Fetch <FormsPoco>(string.Format("select * from {1} where preset='{0}'", presetname.Replace("'", "''"), Core.SettingsProvider.GetFullTableName("forms")));
                     foreach (var poco in pocos)
                     {
                         Framework.Interfaces.IPluginUIChildWindow p = (from Framework.Interfaces.IPlugin a in pins where a.GetType().ToString() == poco.plugintype select a).FirstOrDefault() as Framework.Interfaces.IPluginUIChildWindow;
                         if (p != null)
                         {
                             if (poco.visible == 0)
                             {
                                 if (p.ChildForm != null && p.ChildForm.Visible)
                                 {
                                     p.ChildForm.Hide();
                                 }
                             }
                             else
                             {
                                 if (p.ChildForm == null || !p.ChildForm.Visible)
                                 {
                                     await p.ActionAsync(p.DefaultAction);
                                 }
                                 if (p.ChildForm != null)
                                 {
                                     p.ChildForm.SetBounds(poco.x, poco.y, poco.w, poco.h);
                                 }
                             }
                         }
                         else if (poco.plugintype == "GlobalcachingApplication.Plugins.Maps.MapsPlugin")
                         {
                             try
                             {
                                 Framework.Interfaces.IPlugin mp = Utils.PluginSupport.PluginByName(Core, "GlobalcachingApplication.Plugins.Maps.MapsPlugin");
                                 if (mp != null)
                                 {
                                     MethodInfo mi = mp.GetType().GetMethod("SetWindowStates");
                                     if (mi != null)
                                     {
                                         mi.Invoke(mp, new object[] { poco.customtag });
                                     }
                                 }
                             }
                             catch
                             {
                             }
                         }
                     }
                 }
             }
         }
     }
     catch
     {
     }
 }