Beispiel #1
0
        private void BackButton_Click(object sender, RoutedEventArgs e)
        {
            Window HostMain = new HostWindow(username);

            HostMain.Show();
            this.Close();
        }
        private void OpenForm(string strMenuName, string strFormName)
        {
            RadForm _RadForm = new RadForm();

            _RadForm = TryGetFormByName(strFormName);
            HostWindow _HostWindowForm = null;

            if (ClsUtility._IClsUtility.IsFormOpen(_RadForm.GetType(), RdDockMain, out _HostWindowForm))
            {
                _HostWindowForm.ActivateAsMdiChild();
                _RadForm.Activate();
                RdDockMain.ActivateWindow(_HostWindowForm);
                RdDockMain.ActivateMdiChild(_RadForm);
            }
            else
            {
                //var icon = IconChar.FileExcel;
                Color randomColor = Color.FromArgb(rnd.Next(256), rnd.Next(256), rnd.Next(256));
                cFormIcon = _RadForm.Tag != null && _RadForm.Tag.ToString().Trim() != "" ? _RadForm.Tag.ToString().Trim() : "Circle";
                var iconImage = ((IconChar)Enum.Parse(typeof(IconChar), cFormIcon)).ToBitmap(16, randomColor);
                _RadForm.MdiParent = this;
                _RadForm.Show();
                _RadForm.Activate();
                //_RadForm.Icon = iconImage;
                RdDockMain.ActivateMdiChild(_RadForm);
                foreach (DockWindow dw in RdDockMain.DockWindows)
                {
                    dw.AllowedDockState = ~AllowedDockState.Floating;
                }
            }
        }
Beispiel #3
0
        private void backbutton_Click(object sender, RoutedEventArgs e)
        {
            Window hosty = new HostWindow(username);

            hosty.Show();
            this.Close();
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            selected1 = status1ComboBox.SelectedItem.ToString();
            selected1 = selected1.Substring(selected1.IndexOf(' '));
            if (selected1 == " dealMade")
            {
                or.Status1    = BEEnum.Status.dealMade;
                or.OrderDate1 = DateTime.Now;
                try
                {
                    bl.UpdateOrder(or);
                }
                catch
                {
                    MessageBox.Show("this should work");
                }
                BE.GuestRequest guesty = bl.GetGuestRequestByKey(Convert.ToInt64(guestRequestKey1Label.Content));
                guesty.status1 = BEEnum.Status.dealMade;
                try
                {
                    bl.UpdateGuestRequest(guesty);
                }
                catch
                {
                    MessageBox.Show("this should work2");
                }
            }

            Window HostWindow = new HostWindow(username);

            HostWindow.Show();
        }
Beispiel #5
0
        private async void RunBackupRestore(string backupFile)
        {
            List <string> restoreArguments = new List <string>();

            restoreArguments.Add(backupFile);

            var progressController = await HostWindow.ShowProgressAsync("Restoring Backup", $"Please wait while the backup is restored.");

            progressController.SetIndeterminate();

            //Start backup process
            var restoreProcess = new CommandLineAdbExecutor(Properties.Settings.Default.adbExecutablePath);

            var processController = restoreProcess.ExecuteCommand("restore", restoreArguments.ToArray());
            int exitCode          = await processController.WaitForCompletion();

            await progressController.CloseAsync();

            if (exitCode == 0)
            {
                await HostWindow.ShowMessageAsync("Success", "The operation completed successfully.");
            }
            else
            {
                await HostWindow.ShowMessageAsync("Error", $"The process exited with error code {exitCode}.");
            }
        }
Beispiel #6
0
        /// <summary>
        ///     Execute the command.
        /// </summary>
        public override void Execute()
        {
            var editor = Services.Resolve <IEditor>("txt-editor");

            //var editor = Services.Resolve<IEditor>();
            editor.FileName = null;
            HostWindow.DisplayDockedForm(editor as DockContent);

            if (HostWindow.DatabaseInspector.DbSchema == null)
            {
                HostWindow.DatabaseInspector.LoadDatabaseDetails();
            }

            var dependencyWalker = new DbModelDependencyWalker(HostWindow.DatabaseInspector.DbSchema);
            var tables           = dependencyWalker.SortTablesByForeignKeyReferences();

            var sb = new StringBuilder();

            foreach (DbModelTable table in tables)
            {
                sb.AppendLine(table.FullName);
            }

            editor.AllText = sb.ToString();
        }
Beispiel #7
0
        /// <summary>
        ///     Initializes the plugins that have been loaded during application startup.
        /// </summary>
        public void InitializePlugIns()
        {
            foreach (IPlugIn plugIn in _plugins.Values)
            {
                try
                {
                    if (HostWindow != null)
                    {
                        HostWindow.SetStatus(null, "Initializing " + plugIn.PluginName);
                    }

                    plugIn.InitializePlugIn();
                }
                catch (Exception exp)
                {
                    if (HostWindow == null)
                    {
                        throw;
                    }

                    HostWindow.DisplayMessageBox(
                        null,
                        string.Format("Error Initializing {0}:{1}{2}", plugIn.PluginName, Environment.NewLine, exp),
                        "Plugin Error",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Warning,
                        MessageBoxDefaultButton.Button1,
                        0,
                        null,
                        null);
                }
            }
        }
Beispiel #8
0
        private async void InstallApplicationFromFile(object obj)
        {
            var apkFile = FileDialogUtil.BrowseForOpenFile("Android Applications (*.apk)|*.apk|All Files (*.*)|*.*", "Select an APK");

            if (apkFile != null)
            {
                var progressController = await HostWindow.ShowProgressAsync("Installing", "Installing application");

                progressController.SetIndeterminate();
                Tuple <bool, string> installResult = await _pageState.InstallApplicationFromFileAsync(apkFile);

                var success = installResult.Item1;
                if (!success)
                {
                    await progressController.CloseAsync();

                    await HostWindow.ShowMessageAsync("Error", $"Application install failed with error: {installResult.Item2}");

                    return;
                }

                await progressController.CloseAsync();

                RefreshApplications(null);
            }
        }
Beispiel #9
0
        /// <summary>
        ///     Execute the command.
        /// </summary>
        public override void Execute()
        {
            string template =
                @"    public class $name$Command
        : CommandBase
    {
        public $name$Command()
            : base(""$desc$"")
        {
            //ShortcutKeys = Keys.Control | Keys.?;
			//SmallImage = ImageResource.?;
		}

        public override void Execute()
        {
			
        }
    }";

            string code = template
                          .Replace("$name$", "OI")
                          .Replace("$desc$", "a thing");

            var editor = Services.Container.Get <IQueryEditor>();

            editor.AllText = code;
            editor.SetSyntax("C#");

            HostWindow.DisplayDockedForm(editor as DockContent);
        }
        /// <summary>
        ///     Execute the command.
        /// </summary>
        public override void Execute()
        {
            var editor = Services.Resolve <IQueryEditor>();

            editor.FileName = null;
            HostWindow.DisplayDockedForm(editor as DockContent);
        }
Beispiel #11
0
        /// <summary>
        /// Навигира към подчинена форма в нов прозорец
        /// </summary>
        /// <param name="form"></param>
        /// <param name="parent"></param>
        public static void Navigate(Form form, Control parent, Control fromForm = null, bool New_window = false)
        {
            form.TopLevel        = false;
            form.Dock            = DockStyle.Fill;
            form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            form.Parent          = parent.Parent;

            form.WindowState = FormWindowState.Maximized;
            Form       parent_form = (Form)parent.Parent;
            RadDock    radDock1    = (RadDock)parent_form.Controls["RadDock1"];
            HostWindow host        = radDock1.GetHostWindow(fromForm);

            foreach (HostWindow item in radDock1.GetWindows <HostWindow>())
            {
                if (item.Text == form.Text || item.Text == fromForm.Text)
                {
                    if (!New_window)
                    {
                        item.Close();
                    }
                }
            }

            radDock1.DocumentManager.DocumentInsertOrder = DockWindowInsertOrder.ToBack;
            if (!New_window)
            {
                host.Close();
                radDock1.DocumentManager.DocumentInsertOrder = DockWindowInsertOrder.InFront;
            }

            radDock1.DockControl(form, DockPosition.Fill, DockType.Document);
            form.Show();
        }
Beispiel #12
0
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();

        List<string> ports = LazerTagSerial.GetSerialPorts();

        foreach (string port in ports) {
            this.comboboxentryArduinoPorts.AppendText(port);
        }

        hg = new HostGun(null, null);

        foreach (string port in ports) {
            if (hg.SetDevice(port)) {
                comboboxentryArduinoPorts.Entry.Text = port;
                buttonStartHost.Sensitive = true;
                SetTranscieverStatusImage("gtk-apply");
                break;
            }
        }

        this.ShowAll();

        hw = new HostWindow(hg);
        hw.Modal = true;
        hw.Hide();

        UpdateGameType();
    }
        public override void InitLayout(IDockable layout)
        {
            this.ContextLocator = new Dictionary <string, Func <object> >
            {
                [nameof(IRootDock)]         = () => _context,
                [nameof(IProportionalDock)] = () => _context,
                [nameof(IDocumentDock)]     = () => _context,
                [nameof(IToolDock)]         = () => _context,
                [nameof(ISplitterDockable)] = () => _context,
                [nameof(IDockWindow)]       = () => _context,
                [nameof(IDocument)]         = () => _context,
                [nameof(ITool)]             = () => _context,
                ["Document1"]            = () => new TestDocument(),
                ["Document2"]            = () => new TestDocument(),
                ["LeftTop1"]             = () => new LeftTopTool1(),
                ["LeftTop2"]             = () => new LeftTopTool2(),
                ["LeftBottom1"]          = () => new LeftBottomTool1(),
                ["LeftBottom2"]          = () => new LeftBottomTool2(),
                ["RightTop1"]            = () => new RightTopTool1(),
                ["RightTop2"]            = () => new RightTopTool2(),
                ["RightBottom1"]         = () => new RightBottomTool1(),
                ["RightBottom2"]         = () => new RightBottomTool2(),
                ["LeftPane"]             = () => _context,
                ["LeftPaneTop"]          = () => _context,
                ["LeftPaneTopSplitter"]  = () => _context,
                ["LeftPaneBottom"]       = () => _context,
                ["RightPane"]            = () => _context,
                ["RightPaneTop"]         = () => _context,
                ["RightPaneTopSplitter"] = () => _context,
                ["RightPaneBottom"]      = () => _context,
                ["DocumentsPane"]        = () => _context,
                ["MainLayout"]           = () => _context,
                ["LeftSplitter"]         = () => _context,
                ["RightSplitter"]        = () => _context,
                ["MainLayout"]           = () => _context,
                ["Main"] = () => _context,
            };

            this.HostWindowLocator = new Dictionary <string, Func <IHostWindow> >
            {
                [nameof(IDockWindow)] = () =>
                {
                    var hostWindow = new HostWindow()
                    {
                        [!HostWindow.TitleProperty] = new Binding("ActiveDockable.Title")
                    };
                    return(hostWindow);
                }
            };

            this.DockableLocator = new Dictionary <string, Func <IDockable> >
            {
            };

            base.InitLayout(layout);

            this.SetActiveDockable(_documentDock);
            this.SetFocusedDockable(_documentDock, _documentDock.VisibleDockables?.FirstOrDefault());
        }
Beispiel #14
0
        /// <summary>
        ///     Execute the command.
        /// </summary>
        public override void Execute()
        {
            string  xmlFile = Utility.GetConnectionStringFilename();
            IEditor editor  = Services.Resolve <IFileEditorResolver>().ResolveEditorInstance(xmlFile);

            editor.FileName = xmlFile;
            editor.LoadFile();
            HostWindow.DisplayDockedForm(editor as DockContent);
        }
Beispiel #15
0
        public void AddItem()
        {
            HostWindow hostWindow = new HostWindow();

            hostWindow.DataContext = new HostViewModel(new Host());
            hostWindow.Title       = "Add new Host";
            hostWindow.ResizeMode  = ResizeMode.NoResize;
            hostWindow.ShowDialog();
        }
Beispiel #16
0
        public void EditItem(Host model)
        {
            HostWindow hostWindow = new HostWindow();

            hostWindow.DataContext = new HostViewModel(model);
            hostWindow.Title       = "Edit Host: " + model.Name;
            hostWindow.ResizeMode  = ResizeMode.NoResize;
            hostWindow.ShowDialog();
        }
Beispiel #17
0
 private void ConvertSource()
 {
     if (this._selectedForm != null)
     {
         this._formConverter = new WinFormConverter();
         this._formConverter.Properties.Add("Namespace", "");
         this._formConverter.Properties.Add("ClassName", this._selectedForm.Name);
         this._formConverter.RootContainerType = (WinFormConverter.RootContainerTypes) this._selectedProjectType.Code;
         try
         {
             SWF.Form form = (SWF.Form)Activator.CreateInstance(this._selectedForm);
             if (this._formConverter.Convert(form) && this._showPreview)
             {
                 if (this._selectedProjectType.Code == 4)
                 {
                     MessageBox.Show("Can't show preview for Windows Phone destination.", "Information", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                 }
                 else
                 {
                     try
                     {
                         using (Stream memoryStream = new MemoryStream(Encoding.Default.GetBytes(this._formConverter.Result)))
                         {
                             object obj = XamlReader.Load(memoryStream);
                             if (obj.GetType() != typeof(Window))
                             {
                                 if (obj.GetType() == typeof(UserControl))
                                 {
                                     HostWindow hostWindow = new HostWindow();
                                     hostWindow.InjectControl((UserControl)obj);
                                     hostWindow.Show();
                                 }
                             }
                             else
                             {
                                 Window window = (Window)obj;
                                 window.Show();
                             }
                         }
                     }
                     catch (Exception exception1)
                     {
                         Exception exception = exception1;
                         this._formConverter.ParserErrors.Add(new ParserError(0, string.Format("Error while rendering XAML: {0}", exception.Message)));
                     }
                 }
             }
         }
         catch (Exception exception3)
         {
             Exception exception2 = exception3;
             this._formConverter.ParserErrors.Add(new ParserError(0, string.Format("Error: {0}", exception2.Message)));
         }
         base.OnPropertyChanged("ParserErrors");
         base.OnPropertyChanged("Result");
     }
 }
Beispiel #18
0
    public static Stream ScreenCapture(FrameworkElement element)
    {
        var window = new HostWindow
        {
            Content = element
        };

        return(ScreenCapture(window));
    }
Beispiel #19
0
        /// <summary>Execute the command.</summary>
        public override void Execute()
        {
            DockContent databaseInspector = Services.Resolve <IDatabaseInspector>() as DockContent;

            if (databaseInspector != null)
            {
                HostWindow.ShowDatabaseInspector(databaseInspector as IDatabaseInspector, DockState.DockLeft);
                databaseInspector.Activate();
            }
        }
Beispiel #20
0
        public override void InitLayout(IDockable layout)
        {
            this.ContextLocator = new Dictionary <string, Func <object> >
            {
                [nameof(IRootDock)]         = () => m_Context,
                [nameof(IPinDock)]          = () => m_Context,
                [nameof(IProportionalDock)] = () => m_Context,
                [nameof(IDocumentDock)]     = () => m_Context,
                [nameof(IToolDock)]         = () => m_Context,
                [nameof(ISplitterDock)]     = () => m_Context,
                [nameof(IDockWindow)]       = () => m_Context,
                [nameof(IDocument)]         = () => m_Context,
                [nameof(ITool)]             = () => m_Context,
                ["Document1"]            = () => m_Context,
                ["Layers"]               = () => m_Context,
                ["EditLayer"]            = () => m_Context,
                ["AddGeometry"]          = () => m_Context,
                ["LeftPane"]             = () => m_Context,
                ["LeftPaneTop"]          = () => m_Context,
                ["LeftPaneTopSplitter"]  = () => m_Context,
                ["LeftPaneBottom"]       = () => m_Context,
                ["CenterPane"]           = () => m_Context,
                ["CenterPaneSplitter"]   = () => m_Context,
                ["CenterPaneBottom"]     = () => m_Context,
                ["RightPane"]            = () => m_Context,
                ["RightPaneTop"]         = () => m_Context,
                ["RightPaneTopSplitter"] = () => m_Context,
                ["RightPaneBottom"]      = () => m_Context,
                ["DocumentsPane"]        = () => m_Context,
                ["MainLayout"]           = () => m_Context,
                ["LeftSplitter"]         = () => m_Context,
                ["RightSplitter"]        = () => m_Context,
                ["MainLayout"]           = () => m_Context,
                ["Main"] = () => m_Context,
            };

            this.HostWindowLocator = new Dictionary <string, Func <IHostWindow> >
            {
                [nameof(IDockWindow)] = () =>
                {
                    var hostWindow = new HostWindow()
                    {
                        [!HostWindow.TitleProperty] = new Binding("ActiveDockable.Title")
                    };
                    return(hostWindow);
                }
            };

            this.DockableLocator = new Dictionary <string, Func <IDockable> >
            {
            };

            base.InitLayout(layout);
        }
        /// <summary>Execute the command.</summary>
        public override void Execute()
        {
            string tableName = HostWindow.DatabaseInspector.RightClickedTableName;

            if (tableName != null)
            {
                IViewTable frm = Services.Resolve <IViewTable>();
                frm.TableName = tableName;
                HostWindow.DisplayDockedForm(frm as DockContent);
            }
        }
        /// <summary>Execute the command.</summary>
        public override void Execute()
        {
            IQueryEditor queryForm = HostWindow.Instance.ActiveMdiChild as IQueryEditor;

            if (queryForm != null)
            {
                string     tableName = queryForm.SelectedText;
                IViewTable frm       = Services.Resolve <IViewTable>();
                frm.TableName = tableName;
                HostWindow.DisplayDockedForm(frm as DockContent);
            }
        }
        /// <summary>Execute the command.</summary>
        public override void Execute()
        {
            NewFileForm newFileForm = Services.Resolve <NewFileForm>();

            DialogResult result = newFileForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                var editor = Services.Resolve <IEditor>(newFileForm.FileEditorDescriptor.EditorKeyName);
                editor.FileName = null;
                HostWindow.DisplayDockedForm(editor as DockContent);
            }
        }
 /// <summary>
 ///     Execute the command.
 /// </summary>
 public override void Execute()
 {
     try
     {
         HostWindow.SetPointerState(Cursors.WaitCursor);
         Settings.ResetConnection();
         HostWindow.SetStatus(null, "Connection reset");
     }
     finally
     {
         HostWindow.SetPointerState(Cursors.Default);
     }
 }
Beispiel #25
0
        private static void ToggleCrmIntellisense(object sender, EventArgs e, DTE dte)
        {
            bool isEnabled;
            var  value = SharedGlobals.GetGlobal("UseCrmIntellisense", dte);

            if (value == null)
            {
                isEnabled = false;
                SharedGlobals.SetGlobal("UseCrmIntellisense", true, dte);
            }
            else
            {
                isEnabled = (bool)value;
                SharedGlobals.SetGlobal("UseCrmIntellisense", !isEnabled, dte);
            }

            ExLogger.LogToFile(Logger, $"{Resource.Message_CRMIntellisenseEnabled}: {!isEnabled}", LogLevel.Info);

            if (!isEnabled) //On
            {
                if (HostWindow.IsCrmDexWindowOpen(dte) && SharedGlobals.GetGlobal("CrmService", dte) != null)
                {
                    return;
                }
            }
            else
            {
                if (!HostWindow.IsCrmDexWindowOpen(dte) && SharedGlobals.GetGlobal("CrmService", dte) != null)
                {
                    SharedGlobals.SetGlobal("CrmService", null, dte);
                }

                CrmMetadata.Metadata = null;
                SharedGlobals.SetGlobal("CrmMetadata", null, dte);

                ExLogger.LogToFile(Logger, Resource.Message_ClearingMetadata, LogLevel.Info);
                OutputLogger.WriteToOutputWindow(Resource.Message_ClearingMetadata, MessageType.Info);

                return;
            }

            var result = MessageBox.Show(Resource.MessageBox_ConnectToCrm, Resource.MessageBox_ConnectToCrm_Title,
                                         MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes);

            if (result != MessageBoxResult.Yes)
            {
                return;
            }

            ConnectToCrm();
        }
        /// <summary>Execute the command.</summary>
        public override void Execute()
        {
            IQueryBatchProvider batchProvider = HostWindow.ActiveChildForm as IQueryBatchProvider;

            if (batchProvider == null)
            {
                HostWindow.DisplaySimpleMessageBox(null, "No results to save as a 'DataSet'.", "Save Results as DataSet XML Error");
            }
            else
            {
                DataSet ds = null;

                if (batchProvider.Batch != null)
                {
                    if (batchProvider.Batch.Queries.Count > 1)
                    {
                        BatchQuerySelectForm querySelectForm = Services.Resolve <BatchQuerySelectForm>();
                        querySelectForm.Fill(batchProvider.Batch);
                        querySelectForm.ShowDialog();
                        if (querySelectForm.DialogResult == DialogResult.OK)
                        {
                            ds = querySelectForm.SelectedQuery.Result;
                        }
                    }
                    else if (batchProvider.Batch.Queries.Count == 1)
                    {
                        ds = batchProvider.Batch.Queries[0].Result;
                    }
                }

                if (ds == null)
                {
                    return;
                }

                using (SaveFileDialog saveFileDialog = new SaveFileDialog())
                {
                    saveFileDialog.Title            = "Save Results as DataSet XML";
                    saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);
                    saveFileDialog.Filter           = Properties.Settings.Default.XmlFileDialogFilter;

                    if (saveFileDialog.ShowDialog(HostWindow.Instance) == DialogResult.OK)
                    {
                        ds.WriteXml(saveFileDialog.FileName, XmlWriteMode.WriteSchema);
                        string msg = string.Format("Saved results to file: '{0}'", saveFileDialog.FileName);
                        HostWindow.SetStatus(HostWindow.ActiveChildForm, msg);
                    }
                }
            }
        }
Beispiel #27
0
        protected void RunExportSqlCe(string fileName)
        {
            string file      = Path.GetTempFileName() + ".sql";
            string conn      = Settings.ConnectionDefinition.ConnectionString.Replace(@"""", @"\""");
            string arguments = string.Format("\"{0}\" \"{1}\"", conn, file);

            var tool = new Process();

            tool.StartInfo.FileName               = fileName;
            tool.StartInfo.Arguments              = arguments;
            tool.StartInfo.UseShellExecute        = false;
            tool.StartInfo.RedirectStandardOutput = true;
            tool.StartInfo.RedirectStandardError  = true;

            if (tool.Start())
            {
                string output = tool.StandardOutput.ReadToEnd();
                string err    = tool.StandardError.ReadToEnd();

                if (!string.IsNullOrEmpty(err))
                {
                    output = "ERROR:" + Environment.NewLine + err + Environment.NewLine + output;
                }

                if (File.Exists(file))
                {
                    IEditor editor = Services.Resolve <IFileEditorResolver>().ResolveEditorInstance(file);
                    editor.FileName = file;
                    editor.LoadFile();
                    HostWindow.DisplayDockedForm(editor as DockContent);
                }
                else
                {
                    var sb = new StringBuilder();
                    sb.AppendLine("Error generating the output file.");
                    sb.AppendLine("Process Info:");
                    sb.AppendFormat("  File Name: {0}", tool.StartInfo.FileName);
                    sb.AppendLine();
                    sb.AppendFormat("  Arguments: {0}", tool.StartInfo.Arguments);
                    sb.AppendLine();
                    sb.AppendLine(output);
                    output = sb.ToString();
                }

                if (!string.IsNullOrEmpty(output))
                {
                    HostWindow.DisplaySimpleMessageBox(null, output, fileName + " Output");
                }
            }
        }
Beispiel #28
0
        public override void InitLayout(IDockable layout)
        {
            this.ContextLocator = new Dictionary <string, Func <object> >
            {
                [nameof(IRootDock)]         = () => _context,
                [nameof(IPinDock)]          = () => _context,
                [nameof(IProportionalDock)] = () => _context,
                [nameof(IDocumentDock)]     = () => _context,
                [nameof(IToolDock)]         = () => _context,
                [nameof(ISplitterDock)]     = () => _context,
                [nameof(IDockWindow)]       = () => _context,
                [nameof(IDocument)]         = () => _context,
                [nameof(ITool)]             = () => _context,
                ["ObjectExplorer"]          = () => _context,
                ["Query"]                   = () => _context,
                ["QueryView"]               = () => _context,
                ["QueryViewModel"]          = () => _context,
                ["LeftPane"]                = () => _context,
                ["LeftPaneTop"]             = () => _context,
                ["LeftSplitter"]            = () => _context,
                ["DocumentsPane"]           = () => _context,
                ["BodyLayout"]              = () => _context,
                ["Main"]                    = () => _context,
                ["MainWindowMenu"]          = () => _context,
                ["MainWindowMenuViewModel"] = () => _context,
                ["MainWindowMenuView"]      = () => _context,
                ["MainWindowToolBar"]       = () => _context,
            };

            this.HostWindowLocator = new Dictionary <string, Func <IHostWindow> >
            {
                [nameof(IDockWindow)] = () =>
                {
                    var hostWindow = new HostWindow()
                    {
                        [!HostWindow.TitleProperty] = new Binding("CurrentView.Title")
                    };

                    hostWindow.Content = new DockControl()
                    {
                        [!DockControl.LayoutProperty] = hostWindow[!HostWindow.DataContextProperty]
                    };

                    return(hostWindow);
                }
            };

            base.InitLayout(layout);
        }
Beispiel #29
0
        private void WindowEventsOnWindowActivated(EnvDTE.Window gotFocus, EnvDTE.Window lostFocus)
        {
            //No solution loaded
            if (_solution.Count == 0)
            {
                ResetForm();
                return;
            }

            //WindowEventsOnWindowActivated in this project can be called when activating another window
            //so we don't want to contine further unless our window is active
            if (!HostWindow.IsCrmDevExWindow(gotFocus))
            {
                return;
            }
        }
        public bool IsFormOpen(Type frm, RadDock _RadMDIDock, out HostWindow _HostWindow)
        {
            var vObjForm = _RadMDIDock.DocumentManager.DocumentArray;

            foreach (var item in vObjForm)
            {
                var vItem = (HostWindow)item;
                if (vItem.MdiChild.GetType().Name.ToUpper() == frm.Name.ToUpper())
                {
                    _HostWindow = vItem;
                    return(true);
                }
            }
            _HostWindow = null;
            return(false);
        }
Beispiel #31
0
        private async void RunApplicationBackup(bool apk, bool obb, string outputFile)
        {
            //Create arguments for backup
            List <string> backupArguments = new List <string>();

            if (apk)
            {
                backupArguments.Add("-apk");
            }
            else
            {
                backupArguments.Add("-noapk");
            }
            if (obb)
            {
                backupArguments.Add("-obb");
            }
            else
            {
                backupArguments.Add("-noobb");
            }
            backupArguments.Add("-f");
            backupArguments.Add(outputFile);
            backupArguments.Add(SelectedPackageId);

            var progressController = await HostWindow.ShowProgressAsync("Creating Backup", $"Please wait while {SelectedPackageId} is backed up.");

            progressController.SetIndeterminate();

            //Start backup process
            var backupProcess = new CommandLineAdbExecutor(Properties.Settings.Default.adbExecutablePath);

            var processController = backupProcess.ExecuteCommand("backup", backupArguments.ToArray());
            int exitCode          = await processController.WaitForCompletion();

            await progressController.CloseAsync();

            if (exitCode == 0)
            {
                await HostWindow.ShowMessageAsync("Success", "The operation completed successfully.");
            }
            else
            {
                await HostWindow.ShowMessageAsync("Error", $"The process exited with error code {exitCode}.");
            }
        }
Beispiel #32
0
        private void OnClickConnect(System.Object Sender, System.EventArgs e)
        {
            //prntSome.printSome("OnClickConnect");
            HostWindow hostWindow = new HostWindow ();
            //hostWindow.HostName.Text = "192.168.3.85";
            hostWindow.HostName.Text = "5.8.68.217";
            this.runOffline = true;
            System.Windows.Forms.DialogResult RetVal = hostWindow.ShowDialog (this);

            if (RetVal == System.Windows.Forms.DialogResult.OK)
            {
                hostWindow.Dispose ();
                this.runOffline = false;
                this.Connect (hostWindow.HostName.Text);
            }
            else
            {
                hostWindow.Dispose ();
                this.runOffline = true;
                //System.Windows.Forms.Application.ExitThread ();
                //System.Windows.Forms.Application.Exit ();
            }
        }
Beispiel #33
0
    public static void Main()
    {
        HostWindow window = new HostWindow(delegate
        {
            // Create a layer container
            LayerContainer lc = new LayerContainer();

            // Create a form with many buttons
            {
                FlowContainer flow = new FlowContainer(10.0, Axis.Vertical);
                for (int t = 0; t < 40; t++)
                {
                    int i = t + 1;
                    Button b = new Button("Button #" + i.ToString());
                    flow.AddChild(b, 30.0);
                    b.Click += delegate
                    {
                        MessageBox.ShowOKCancel(lc, "Button Clicked!", "You have clicked button #" + i.ToString() + ".", null);
                    };
                }
                Point targetflowsize = new Point(120.0, flow.SuggestLength);
                MarginContainer margin = flow.WithMargin(10.0);
                Point targetmarginsize = margin.GetSize(targetflowsize);
                WindowContainer win = new WindowContainer(margin);
                SunkenContainer sunken = new SunkenContainer(win);
                ScrollContainer scroll = new ScrollContainer(win, sunken.WithBorder(1.0, 1.0, 0.0, 1.0));
                scroll.ClientHeight = targetmarginsize.Y;

                Form form = new Form(scroll, "Lots of buttons");
                form.ClientSize = new Point(targetmarginsize.X + 20.0, 200.0);
                lc.AddControl(form, new Point(30.0, 30.0));
            }

            // Popup test
            {
                Label label = new Label("Right click for popup", Color.RGB(0.0, 0.3, 0.0), new LabelStyle()
                    {
                        HorizontalAlign = TextAlign.Center,
                        VerticalAlign = TextAlign.Center,
                        Wrap = TextWrap.Ellipsis
                    });
                PopupContainer pc = new PopupContainer(label);
                pc.ShowOnRightClick = true;
                pc.Items = new MenuItem[]
                {
                    MenuItem.Create("Do nothing", delegate { }),
                    MenuItem.Create("Remain inert", delegate { }),
                    MenuItem.Create("Make a message box", delegate
                    {
                        MessageBox.ShowOKCancel(lc, "Message Box", "Done", null);
                    }),
                    MenuItem.Seperator,
                    MenuItem.Create("Mouseover me!", new MenuItem[]
                    {
                        MenuItem.Create("Some", delegate { }),
                        MenuItem.Create("Items", delegate { }),
                        MenuItem.Create("Spawn", delegate { }),
                        MenuItem.Create("Another", delegate { }),
                        MenuItem.Create("Popup", delegate { }),
                    }),
                    MenuItem.Seperator,
                    MenuItem.Create("Try", delegate { }),
                    MenuItem.Create("The", delegate { }),
                    MenuItem.Create("Keyboard", delegate { }),
                };

                Form form = new Form(pc.WithAlign(label.SuggestSize, Align.Center, Align.Center).WithBorder(1.0), "Popup Test");
                form.ClientSize = new Point(200.0, 50.0);
                lc.AddControl(form, new Point(230.0, 30.0));
                form.AddCloseButton();
            }

            // Timers and progress bars
            {
                FlowContainer flow = new FlowContainer(10.0, Axis.Vertical);
                Button addbutton = new Button("Add Some");
                Button resetbutton = new Button("Reset");
                Progressbar bar = new Progressbar();
                flow.AddChild(addbutton, 30.0);
                flow.AddChild(resetbutton, 30.0);
                flow.AddChild(bar, 30.0);

                addbutton.Click += delegate
                {
                    bar.Value = bar.Value + 0.05;
                };
                resetbutton.Click += delegate
                {
                    bar.Value = 0.0;
                };

                MarginContainer margin = flow.WithMargin(20.0);

                Form form = new Form(margin.WithBorder(1.0), "Progress bars!");
                form.ClientSize = margin.GetSize(new Point(200.0, flow.SuggestLength)) + new Point(4, 4);
                lc.AddControl(form, new Point(230.0, 150.0));
                form.AddCloseButton();
            }

            // Textbox
            {
                Textbox tb = new Textbox();
                MarginContainer margin = tb.WithMargin(20.0);

                Form form = new Form(margin.WithBorder(1.0), "Change the title of this form!");
                form.ClientSize = margin.GetSize(new Point(400.0, 32.0));
                lc.AddControl(form, new Point(30.0, 360.0));

                tb.TextChanged += delegate(string Text)
                {
                    form.Text = Text;
                };
            }

            return lc;
        }, "Lots of controls");
        window.Run();
    }