예제 #1
0
        //This is the main execution entry point for the plugin.
        public override PluginParameters Main(PluginParameters args)
        {
            //Assigns parameters passed from the pluggable app to public members
            this.Param1 = (string)args.Get("Param1");
            this.Param2 = (DateTime)args.Get("Param2");
            this.Param3 = (double)args.Get("Param3");

            //Creates a window wrapper for the pluggable app's main window.
            //This is only to ensure that the plugin form always stays in front of the pluggable app main window
            IntPtr handle = Process.GetCurrentProcess().MainWindowHandle;
            WindowWrapper wr = null;
            if (handle != IntPtr.Zero)
                wr = new WindowWrapper(handle);

            Application.Run(new MainView()); //This starts a new message loop for the plugin window. pluginForm.ShowDialog() may also be used instead.

            if(this.UnhandledException == null)
                args.Add("ReturnValue", "Success"); // Demonstrates how serializeable/primitive types can be passed back to the pluggable app
            else
                args.Add("ReturnValue", "Failed");

            //returned values will be available in the pluggable app via PluginLoaderBase.PluginUnloaded event

            return args;
        }
        public PeopleService()
        {
            _dispatcherWrapper = WindowWrapper.Current().Dispatcher;

            var handler = new HttpClientHandler();

            if (handler.SupportsAutomaticDecompression)
            {
                handler.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
            }

            _httpClient = new HttpClient(handler);
        }
예제 #3
0
 // hide and show busy dialog
 public static void SetBusy(bool busy, string text = null)
 {
     WindowWrapper.Current().Dispatcher.Dispatch(() => {
         var modal = Window.Current.Content as ModalDialog;
         var view  = modal.ModalContent as Busy;
         if (view == null)
         {
             modal.ModalContent = view = new Busy();
         }
         modal.IsModal = view.IsBusy = busy;
         view.BusyText = text;
     });
 }
        public Shell(INavigationService navigationService)
        {
            Instance = this;
            this.InitializeComponent();

            // setup for static calls
            Window = WindowWrapper.Current();
            MyHamburgerMenu.NavigationService = navigationService;

            // any nav change, reset to normal
            navigationService.FrameFacade.Navigated += (s, e) =>
                                                       BusyModal.IsModal = SearchModal.IsModal = LoginModal.IsModal = false;
        }
예제 #5
0
        private void MainListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var personal = MainListBox.SelectedItem as Personal;

            if (personal != null)
            {
                //Frame.Navigate(typeof(Views.PersonalDetailsPage), personal.Id);
                var nav = WindowWrapper.Current().NavigationServices.FirstOrDefault();
                nav.Navigate(typeof(PersonalDetailsPage), personal.Id);
            }
            // Reset selected index to -1 (no selection)
            MainListBox.SelectedIndex = -1;
        }
예제 #6
0
        private void GameManagerViewModelOnTrainError(object sender, string message)
        {
            WindowWrapper.Current().Dispatcher.Dispatch(() =>
            {
                ErrorMessageText.Text       = Utils.Resources.CodeResources.GetString(message);
                ErrorMessageText.Visibility = ErrorMessageBorder.Visibility = Visibility.Visible;

                SelectAttackTeamGrid.Visibility = Visibility.Collapsed;

                ShowErrorMessageStoryboard.Completed += (ss, ee) => { HideErrorMessageStoryboard.Begin(); };
                ShowErrorMessageStoryboard.Begin();
            });
        }
예제 #7
0
        private async void SwitchAccount()
        {
            if (_selectedItem != SettingsHelper.SelectedAccount && _selectedItem >= 0)
            {
                //SettingsHelper.SwitchAccount = _selectedItem;
                //await CoreApplication.RequestRestartAsync(string.Empty);



                WindowWrapper.Current().NavigationServices.Remove(NavigationService);
                BootStrapper.Current.NavigationService.Reset();
            }
        }
예제 #8
0
        public void Handle(UpdateNewMessage update)
        {
            if (update.DisableNotification || !_settings.Notifications.InAppPreview)
            {
                return;
            }

            var difference = DateTime.Now.ToTimestamp() - update.Message.Date;

            if (difference > 180)
            {
                return;
            }

            // Adding some delay to be 110% the message hasn't been read already
            ThreadPoolTimer.CreateTimer(timer =>
            {
                var chat = _protoService.GetChat(update.Message.ChatId);
                if (chat == null || chat.LastReadInboxMessageId >= update.Message.Id)
                {
                    return;
                }

                var caption = GetCaption(chat);
                var content = GetContent(chat, update.Message);
                var sound   = "";
                var launch  = GetLaunch(chat);
                var tag     = GetTag(update.Message);
                var group   = GetGroup(chat);
                var picture = GetPhoto(chat);
                var date    = BindConvert.Current.DateTime(update.Message.Date).ToString("o");
                var loc_key = chat.Type is ChatTypeSupergroup super && super.IsChannel ? "CHANNEL" : string.Empty;

                Execute.BeginOnUIThread(() =>
                {
                    var service = WindowWrapper.Current().NavigationServices.GetByFrameId("Main");
                    if (service == null)
                    {
                        return;
                    }

                    if (WindowContext.GetForCurrentView().ActivationState != Windows.UI.Core.CoreWindowActivationState.Deactivated && service.CurrentPageType == typeof(ChatPage) && (long)service.CurrentPageParam == chat.Id)
                    {
                        return;
                    }

                    NotificationTask.UpdateToast(caption, content, sound, launch, tag, group, picture, date, loc_key);
                    NotificationTask.UpdatePrimaryTile(caption, content, picture);
                });
            }, TimeSpan.FromSeconds(3));
        }
예제 #9
0
        /// <summary>
        /// 绘制控制台
        /// 注意:该接口必须在OnGUI函数内调用
        /// </summary>
        public static void Draw()
        {
            // 注意:GUI接口只能在OnGUI内部使用
            ConsoleGUI.InitGlobalStyle();

            // 整体偏移
            if (OffsetPixels > 0)
            {
                GUILayout.Space(OffsetPixels);
            }

            if (_visibleToggle == false)
            {
                // 显示开关
                if (GUILayout.Button("X", ConsoleGUI.ButtonStyle, GUILayout.Width(ConsoleGUI.ButtonStyle.fixedHeight)))
                {
                    _visibleToggle = !_visibleToggle;
                }
                return;
            }

            GUILayout.BeginHorizontal();
            {
                // 绘制背景
                if (_visibleToggle && _bgTexture != null)
                {
                    GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), _bgTexture, ScaleMode.StretchToFill, true);
                }

                // 显示开关
                if (GUILayout.Button("X", ConsoleGUI.ButtonStyle, GUILayout.Width(ConsoleGUI.ButtonStyle.fixedHeight)))
                {
                    _visibleToggle = !_visibleToggle;
                }

                // 绘制按钮栏
                _showIndex = GUILayout.Toolbar(_showIndex, _toolbarTitles, ConsoleGUI.ToolbarStyle);
            }
            GUILayout.EndHorizontal();

            // 绘制选中窗口
            for (int i = 0; i < _wrappers.Count; i++)
            {
                if (_showIndex != i)
                {
                    continue;
                }
                WindowWrapper wrapper = _wrappers[i];
                wrapper.Instance.OnGUI();
            }
        }
예제 #10
0
        /// <summary>
        ///     This runs everytime the app is launched, even after suspension, so we use this to initialize stuff
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public override async Task OnInitializeAsync(IActivatedEventArgs args)
        {
#if DEBUG
            // Init logger
            Logger.SetLogger(new ConsoleLogger(LogLevel.Info));
#endif
            // If we have a phone contract, hide the status bar
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                var statusBar = StatusBar.GetForCurrentView();
                await statusBar.HideAsync();
            }

            // Enter into full screen mode
            ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
            ApplicationView.GetForCurrentView().SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
            ApplicationView.GetForCurrentView().FullScreenSystemOverlayMode = FullScreenSystemOverlayMode.Standard;

            // Forces the display to stay on while we play
            //_displayRequest.RequestActive();
            WindowWrapper.Current().Window.VisibilityChanged += WindowOnVisibilityChanged;

            // Initialize Map styles
            await MapStyleHelpers.Initialize();

            // Turn the display off when the proximity stuff detects the display is covered (battery saver)
            if (SettingsService.Instance.IsBatterySaverEnabled)
            {
                _proximityHelper.EnableDisplayAutoOff(true);
            }

            // Init vibration device
            if (ApiInformation.IsTypePresent("Windows.Phone.Devices.Notification.VibrationDevice"))
            {
                _vibrationDevice = VibrationDevice.GetDefault();
            }

            if (SettingsService.Instance.LiveTileMode == LiveTileModes.Peek)
            {
                LiveTileUpdater.EnableNotificationQueue(true);
            }

            // Check for network status
            NetworkInformation.NetworkStatusChanged += NetworkInformationOnNetworkStatusChanged;

            // Respond to changes in inventory and Pokemon in the immediate viscinity.
            GameClient.PokemonsInventory.CollectionChanged += PokemonsInventory_CollectionChanged;
            GameClient.CatchablePokemons.CollectionChanged += CatchablePokemons_CollectionChanged;

            await Task.CompletedTask;
        }
        private async void CloseAndWait()
        {
            SendMessage("Start closing");
            var task = Task.Delay(10000);
            await
            ApplicationViewSwitcher.SwitchAsync(WindowWrapper.Default().ApplicationView().Id, view.Id,
                                                ApplicationViewSwitchingOptions.ConsolidateViews);

            SendMessage("Hid view");
            SendMessage("Waiting for task to end...");
            await task;

            SendMessage("Async task ended");
        }
예제 #12
0
        /// <summary>
        /// Handles the Click event of the DeleteDayOfTrip control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        public async void DeleteDayOfTrip_Click(object sender, RoutedEventArgs e)
        {
            var id = DayId;

            using (var client = new System.Net.Http.HttpClient())
            {
                client.BaseAddress = new Uri(@"http://localhost:10051/api/");

                await client.DeleteAsync("dayoftrips/" + id);

                var nav = WindowWrapper.Current().NavigationServices.FirstOrDefault();
                nav.Navigate(typeof(Views.GetTripPage));
            }
        }
예제 #13
0
        /// <summary>
        /// Opening completed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void OpenBlurAnim_Completed(object sender, AnimationSetCompletedEventArgs e)
        {
            WindowWrapper.Current().Dispatcher.Dispatch(() =>
            {
                var modal = Window.Current.Content as ModalDialog;

                if (!(modal.ModalContent is ModalWindow view))
                {
                    modal.ModalContent = view = new ModalWindow(ModalContent);
                }

                view.GotIt.IsEnabled = true;
            });
        }
예제 #14
0
        private async void buttonStartMovie_Click(object sender, RoutedEventArgs e)
        {
            loadRemote();

            if (_remote != null)
            {
                var response = await ConnectionHelper.ExecuteRequest(_remote.Host, _remote.Port, _remote.User, _remote.Pass, JsonHelper.JsonCommandPlayerOpen("movieid", Convert.ToInt32(_movie.Movieid)));

                if (response != "statusError" && response != "connectionError")
                {
                    WindowWrapper.Current().NavigationServices.FirstOrDefault().Navigate(typeof(MainPage));
                }
            }
        }
예제 #15
0
        public void SetFileName()
        {
            IntPtr        ptr     = GetForegroundWindow();
            WindowWrapper oWindow = new WindowWrapper(ptr);

            if (fileDialog.ShowDialog(oWindow) != DialogResult.OK)
            {
                if (fileDialog.FileName != null)
                {
                    fileDialog.FileName = string.Empty;
                }
            }
            oWindow = null;
        }
예제 #16
0
        public void SetPathName()
        {
            IntPtr        ptr     = GetForegroundWindow();
            WindowWrapper oWindow = new WindowWrapper(ptr);

            if (oBrowserDialog.ShowDialog(oWindow) != DialogResult.OK)
            {
                if (oBrowserDialog.SelectedPath != null)
                {
                    oBrowserDialog.SelectedPath = string.Empty;
                }
            }
            oWindow = null;
        }
예제 #17
0
        /// <summary>
        /// Closing completed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected static void CloseBlurAnim_Completed(object sender, AnimationSetCompletedEventArgs e)
        {
            WindowWrapper.Current().Dispatcher.Dispatch(() =>
            {
                var modal = Window.Current.Content as ModalDialog;

                if (!(modal.ModalContent is ModalWindow view))
                {
                    modal.ModalContent = view = new ModalWindow(null);
                }

                modal.IsModal = view.IsShowed = false;
            });
        }
예제 #18
0
 public static void ShowConnectDialog()
 {
     WindowWrapper.Current().Dispatcher.Dispatch(() =>
     {
         var modal = Window.Current.Content as ModalDialog;
         var view  = modal.ModalContent as ConnectDialog;
         if (view == null)
         {
             modal.ModalContent = view = new ConnectDialog();
         }
         modal.IsModal = true;
         //view.Logo.Begin();
     });
 }
        public DialogResult ShowDialog(IWin32Window owner)
        {
            DialogResult returnDialogResult = DialogResult.Cancel;

            if (this.IsDisposed)
            {
                return(returnDialogResult);
            }

            if (owner == null || owner.Handle == IntPtr.Zero)
            {
                WindowWrapper wr = new WindowWrapper(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle);

                owner = wr;
            }

            OriginalCtrlSize = this.Size;

            _MSdialog = (FileDlgType == FileDialogType.OpenFileDlg) ? new OpenFileDialog() as FileDialog : new SaveFileDialog() as FileDialog;

            _dlgWrapper = new WholeDialogWrapper(this);

            OnPrepareMSDialog();

            if (!_hasRunInitMSDialog)
            {
                InitMSDialog();
            }

            try
            {
                System.Reflection.PropertyInfo AutoUpgradeInfo = MSDialog.GetType().GetProperty("AutoUpgradeEnabled");
                if (AutoUpgradeInfo != null)
                {
                    AutoUpgradeInfo.SetValue(MSDialog, false, null);
                }

                returnDialogResult = _MSdialog.ShowDialog(owner);
            }
            // Sometimes if you open a animated .gif on the preview and the Form is closed, .Net class throw an exception
            // Lets ignore this exception and keep closing the form.
            catch (ObjectDisposedException)
            {
            }
            catch (Exception ex)
            {
                _eh.ThrowException(MessageBoxIcon.Error, $"Unable to get the modal dialog handle: { ex.Message }", "Error", MessageBoxButtons.OK);
            }
            return(returnDialogResult);
        }
예제 #20
0
 private void EditPlaylist(PlaylistToDisplay obj)
 {
     if (obj != null)
     {
         WindowWrapper.Current().Dispatcher.Dispatch(() =>
         {
             var modal = Window.Current.Content as ModalDialog;
             var editPlaylistDialog      = new EditPlaylistDialog(obj);
             editPlaylistDialog.Closing += DialogClosed;
             modal.ModalContent          = editPlaylistDialog;
             modal.IsModal         = true;
             modal.ModalBackground = new SolidColorBrush(Colors.Transparent);
         });
     }
 }
예제 #21
0
    public NativeMenu(IntPtr handle, WindowWrapper Window, UpdateMenu MenuConstructor = null)
    {
        this.handle         = handle;
        this.Window         = Window;
        this.MenuConstrucor = MenuConstructor;
        eventHandler        = new wndProc(MenuProc).Invoke;
        WndProcHandler      = GCHandle.Alloc(eventHandler);
        Subclassed          = NativeMethods.SetWindowSubclass(handle, (wndProc)WndProcHandler.Target, WndProcId, IntPtr.Zero);
        InitMenu(handle);

        //IntPtr buffer = Marshal.AllocHGlobal(200);
        //GetWindowText(handle, buffer, 200);
        //Window.Caption = Marshal.PtrToStringAnsi(buffer);
        //var ctl = new Win32Window(handle);
    }
예제 #22
0
 public static DeviceUtils Current(WindowWrapper windowWrapper = null)
 {
     windowWrapper = windowWrapper ?? WindowWrapper.Current();
     if (!Cache.ContainsKey(windowWrapper))
     {
         var item = new DeviceUtils(windowWrapper);
         Cache.Add(windowWrapper, item);
         windowWrapper.ApplicationView().Consolidated += new WeakReference <DeviceUtils, ApplicationView, object>(item)
         {
             EventAction  = (i, s, e) => Cache.Remove(windowWrapper),
             DetachAction = (i, w) => windowWrapper.ApplicationView().Consolidated -= w.Handler
         }.Handler;
     }
     return(Cache[windowWrapper]);
 }
예제 #23
0
        private IContainer _BuildContainer()
        {
            var builder = new ContainerBuilder();

            builder.RegisterModule <ServicesModule>();
            builder.RegisterModule <ViewModelsModule>();
            builder.Register(_GetNavigationService).As <INavigationService>().InstancePerDependency();

            return(builder.Build());

            object _GetNavigationService(IComponentContext arg)
            {
                return(WindowWrapper.Current().NavigationServices.FirstOrDefault());
            }
        }
        /// <summary>
        /// Will close the modal dialog.
        /// </summary>
        public void CloseControl()
        {
            //Get the current window and cast it to a UserInfoPart ModalDialog and shut it down.
            WindowWrapper.Current().Dispatcher.Dispatch(() =>
            {
                var modal          = Window.Current.Content as ModalDialog;
                var view           = modal.ModalContent as FieldBookDialog;
                modal.ModalContent = view;
                modal.IsModal      = false;
            });

            //Set header visibility init
            Services.DatabaseServices.DataLocalSettings localSetting = new DataLocalSettings();
            localSetting.InitializeHeaderVisibility();
        }
예제 #25
0
 public static MonitorUtils Current(WindowWrapper windowWrapper = null)
 {
     windowWrapper = windowWrapper ?? WindowWrapper.Current();
     if (!Cache.ContainsKey(windowWrapper))
     {
         var item = new MonitorUtils(windowWrapper);
         Cache.Add(windowWrapper, item);
         windowWrapper.ApplicationView().Consolidated += new WeakReference<MonitorUtils, ApplicationView, object>(item)
         {
             EventAction = (i, s, e) => Cache.Remove(windowWrapper),
             DetachAction = (i, w) => windowWrapper.ApplicationView().Consolidated -= w.Handler
         }.Handler;
     }
     return Cache[windowWrapper];
 }
예제 #26
0
 public static void OpenCloseSwitch()
 {
     if (_frmRecordingHistory == null)
     {
         _frmRecordingHistory = new FrmRecordingHistory();
         var          application = ArcMap.Application;
         int          hWnd        = application.hWnd;
         IWin32Window parent      = new WindowWrapper(hWnd);
         _frmRecordingHistory.Show(parent);
     }
     else
     {
         _frmRecordingHistory.Close();
     }
 }
예제 #27
0
        async Task NavigateToAsync(NavigationMode mode, object parameter, object frameContent = null)
        {
            DebugWrite($"Mode: {mode}, Parameter: {parameter} FrameContent: {frameContent}");

            frameContent = frameContent ?? FrameFacadeInternal.Frame.Content;

            LastNavigationParameter = parameter;
            LastNavigationType      = frameContent.GetType().FullName;

            var page = frameContent as Page;

            if (page != null)
            {
                if (mode == NavigationMode.New)
                {
                    var pageState = FrameFacadeInternal.PageStateSettingsService(page.GetType()).Values;
                    pageState?.Clear();
                }

                if (!(page.DataContext is INavigable) | page.DataContext == null)
                {
                    // to support dependency injection, but keeping it optional.
                    var viewmodel = BootStrapper.Current.ResolveForPage(page.GetType(), this);
                    if (viewmodel != null)
                    {
                        page.DataContext = viewmodel;
                    }
                }

                // call viewmodel
                var dataContext = page.DataContext as INavigable;
                if (dataContext != null)
                {
                    // prepare for state load
                    dataContext.NavigationService = this;
                    dataContext.Dispatcher        = WindowWrapper.Current(this)?.Dispatcher;
                    dataContext.SessionState      = BootStrapper.Current.SessionState;
                    var pageState = FrameFacadeInternal.PageStateSettingsService(page.GetType()).Values;
                    await dataContext.OnNavigatedToAsync(parameter, mode, pageState);

                    {
                        // update bindings after NavTo initializes data
                        XamlUtils.InitializeBindings(page);
                        XamlUtils.UpdateBindings(page);
                    }
                }
            }
        }
예제 #28
0
        /// <summary>
        /// Function uses Word app to activate word window.
        /// </summary>
        /// <param name="docUri"></param>
        /// <returns></returns>
        internal static bool FocusDocumentApp(string docUri)
        {
            if (WordApp != null)
            {
                Document doc = WordApp.Documents[docUri];
                using (var win = new WindowWrapper(doc.ActiveWindow))
                {
                    win.Activate();
                    win.SetFocus();
                    win.WindowState = WdWindowState.wdWindowStateNormal;

                    WordApp.Activate();
                }
            }
            return(false);
        }
예제 #29
0
        private async void listViewSong_ItemClick(object sender, ItemClickEventArgs e)
        {
            var clickedItem = (Song)e.ClickedItem;

            loadRemote();

            if (_remote != null)
            {
                var response = await ConnectionHelper.ExecuteRequest(_remote.Host, _remote.Port, _remote.User, _remote.Pass, JsonHelper.JsonCommandPlayerOpen("songid", Convert.ToInt32(clickedItem.SongId)));

                if (response != "statusError" && response != "connectionError")
                {
                    WindowWrapper.Current().NavigationServices.FirstOrDefault().Navigate(typeof(MainPage));
                }
            }
        }
        private void Hide()
        {
            WindowWrapper.Current().Dispatcher.Dispatch(() =>
            {
                var modal = Window.Current.Content as ModalDialog;
                if (modal == null)
                {
                    return;
                }

                // animate
                Storyboard sb = this.Resources["HideSortingMenuStoryboard"] as Storyboard;
                sb.Begin();
                sb.Completed += Cleanup;
            });
        }
예제 #31
0
 public void RaisePropertyChanged([CallerMemberName] string propertyName = null)
 {
     if (global::Windows.ApplicationModel.DesignMode.DesignModeEnabled)
     {
         return;
     }
     try
     {
         PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
     }
     catch
     {
         WindowWrapper.Current().Dispatcher.Run(() =>
                                                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)));
     }
 }
예제 #32
0
        protected override sealed void OnWindowCreated(WindowCreatedEventArgs args)
        {
            Bootstrapper.DebugWrite();

            if (!WindowWrapper.ActiveWrapper.Any())
            {
                this.Loaded();
            }

            var window = new WindowWrapper(args.Window);

            ViewService.OnWindowCreated();
            this.WindowCreated?.Invoke(this, args);

            base.OnWindowCreated(args);
        }
예제 #33
0
 public ITaskProject ConnectToProject(Window window)
 {
     using (var tpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false))
       {
     var windowWrapper = new WindowWrapper(new System.Windows.Interop.WindowInteropHelper(window).Handle);
     var result = tpp.ShowDialog(windowWrapper);
     if (result == DialogResult.OK)
     {
       var tfs2010Project = new TfsProject();
       tfs2010Project.projInfo = tpp.SelectedProjects[0];
       tfs2010Project.workItemStoreService = tpp.SelectedTeamProjectCollection.GetService<WorkItemStore>();
       // Get work item types
       tfs2010Project.wiTypes = tfs2010Project.workItemStoreService.Projects[tfs2010Project.projInfo.Name].WorkItemTypes;
       return tfs2010Project;
     }
       }
       return null;
 }
예제 #34
0
        private DeviceUtils(WindowWrapper windowWrapper)
        {
            MonitorUtils = MonitorUtils.Current(windowWrapper);
            WindowWrapper = windowWrapper ?? WindowWrapper.Current();

            var di = windowWrapper.DisplayInformation();
            di.OrientationChanged += new WeakReference<DeviceUtils, DisplayInformation, object>(this)
            {
                EventAction = (i, s, e) => Changed?.Invoke(i, EventArgs.Empty),
                DetachAction = (i, w) => di.OrientationChanged -= w.Handler
            }.Handler;

            var av = windowWrapper.ApplicationView();
            av.VisibleBoundsChanged += new WeakReference<DeviceUtils, ApplicationView, object>(this)
            {
                EventAction = (i, s, e) => Changed?.Invoke(i, EventArgs.Empty),
                DetachAction = (i, w) => av.VisibleBoundsChanged -= w.Handler
            }.Handler;
        }
예제 #35
0
        private MonitorUtils(WindowWrapper windowWrapper)
        {
            var di = windowWrapper.DisplayInformation();
            di.OrientationChanged += new WeakReference<MonitorUtils, DisplayInformation, object>(this)
            {
                EventAction = (i, s, e) => Changed?.Invoke(i, EventArgs.Empty),
                DetachAction = (i, w) => di.OrientationChanged -= w.Handler
            }.Handler;

            var av = windowWrapper.ApplicationView();
            av.VisibleBoundsChanged += new WeakReference<MonitorUtils, ApplicationView, object>(this)
            {
                EventAction = (i, s, e) => Changed?.Invoke(i, EventArgs.Empty),
                DetachAction = (i, w) => av.VisibleBoundsChanged -= w.Handler
            }.Handler;

            Inches = new InchesInfo(windowWrapper);
            Pixels = new PixelsInfo(windowWrapper);
        }
예제 #36
0
        void BtnBrowseClick(object sender, EventArgs e)
        {
            WindowWrapper mainWindow = new WindowWrapper(frmMain.ActiveForm.Handle);
            System.Windows.Forms.OpenFileDialog dlg = new OpenFileDialog();
            dlg.Title = "Open object file";
            dlg.Filter = "XML file (*.xml)|*.xml";
            dlg.Multiselect = false;
            DialogResult res = dlg.ShowDialog();

            if (res != DialogResult.OK)
                return;
            txtFileName.Text = dlg.FileName;
            ValidateFileName();
        }
예제 #37
0
파일: AnimDetail.cs 프로젝트: niel/radegast
        private void btnSave_Click(object sender, EventArgs e)
        {
            WindowWrapper mainWindow = new WindowWrapper(frmMain.ActiveForm.Handle);
            System.Windows.Forms.SaveFileDialog dlg = new SaveFileDialog();
            dlg.AddExtension = true;
            dlg.RestoreDirectory = true;
            dlg.Title = "Save animation as...";
            dlg.Filter = "Second Life Animation (*.sla)|*.sla";
            DialogResult res = dlg.ShowDialog();

            if (res == DialogResult.OK)
            {
                try
                {
                    File.WriteAllBytes(dlg.FileName, animData);
                }
                catch (Exception ex)
                {
                    Logger.Log("Saving animation failed: " + ex.Message, Helpers.LogLevel.Debug);
                }
            }
        }
예제 #38
0
        private void CheckNow()
        {
            string versionInfo = UpdateHelper.GetVersionInfo();
            string signature = UpdateHelper.GetVersionInfoSignature();
            string locale = CultureInfo.CurrentCulture.Name;

            IWin32Window h = new WindowWrapper(this.Parent.Handle);

            if (versionInfo.Length == 0 || signature.Length == 0)
            {
                if (locale == "zh-TW")
                    MessageBox.Show(h, "\u7121\u6cd5\u900f\u904e\u7db2\u8def\u6aa2\u67e5\u66f4\u65b0\uff0c\u8acb\u6aa2\u67e5\u7db2\u8def\u662f\u5426\u6b63\u5e38\u3002\u5982\u679c\u60a8\u6709\u5b89\u88dd\u9632\u6bd2\u8edf\u9ad4\uff0c\u4e5f\u8acb\u6aa2\u67e5\u9632\u706b\u7246\u8a2d\u5b9a\u3002", "Yahoo! \u5947\u6469\u8f38\u5165\u6cd5", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                else if (locale == "zh-CN")
                    MessageBox.Show(h, "\u65e0\u6cd5\u900f\u8fc7\u7f51\u7edc\u68c0\u67e5\u66f4\u65b0\uff0c\u8bf7\u68c0\u67e5\u7f51\u7edc\u662f\u5426\u6b63\u5e38\u3002\u5982\u679c\u60a8\u88c5\u4e86\u9632\u6bd2\u8f6f\u4ef6\uff0c\u4e5f\u8bf7\u68c0\u67e5\u9632\u706b\u5899\u8bbe\u7f6e\u3002", "Yahoo! \u5947\u6469\u8f93\u5165\u6cd5", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                else
                    MessageBox.Show(h, "Unable to check for updates via the Internet. Please check your Internet connection settings or if you ever installed Anti-virus softwares, please check your firewall settings.", "Yahoo! KeyKey", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }

            bool valid = UpdateHelper.ValidateFile(versionInfo, signature);
            if (valid == false)
            {
                if (locale == "zh-TW")
                    MessageBox.Show(h, "\u7121\u6cd5\u900f\u904e\u7db2\u8def\u6aa2\u67e5\u66f4\u65b0\uff0c\u53ef\u80fd\u662f\u56e0\u70ba\u60a8\u5b89\u88dd\u7684\u662f\u820a\u7248\u7684 Yahoo! \u5947\u6469\u8f38\u5165\u6cd5\uff0c\u8acb\u76f4\u63a5\u5728 Yahoo! \u5947\u6469\u7db2\u7ad9\u4e0a\uff0c\u4e0b\u8f09\u65b0\u7684\u7248\u672c\u3002", "Yahoo! \u5947\u6469\u8f38\u5165\u6cd5", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                else if (locale == "zh-CN")
                    MessageBox.Show(h, "\u65e0\u6cd5\u900f\u8fc7\u7f51\u8def\u68c0\u67e5\u66f4\u65b0\uff0c\u53ef\u80fd\u662f\u56e0\u4e3a\u60a8\u5b89\u88c5\u7684\u662f\u65e7\u7248\u7684 Yahoo! \u5947\u6469\u8f93\u5165\u6cd5\uff0c\u8bf7\u76f4\u63a5\u5728 Yahoo! \u5947\u6469\u7ad9\u70b9\u4e0a\uff0c\u4e0b\u8f7d\u65b0\u7684\u7248\u672c\u3002", "Yahoo! \u5947\u6469\u8f93\u5165\u6cd5", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                else
                    MessageBox.Show(h, "Unable to check for updates via the Internet. You may use an old version of Yahoo! KeyKey, please download the new installer package from the Yahoo! web site.", "Yahoo! KeyKey", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }

            if (UpdateHelper.ShouldUpdate(versionInfo) == true)
            {
                LaunchDownloadUpdateApp();
            }
            else
            {
                if (locale == "zh-TW")
                    MessageBox.Show(h, "\u60a8\u73fe\u5728\u4f7f\u7528\u7684\u5df2\u7d93\u662f\u6700\u65b0\u7248\u672c\uff0c\u4e0d\u9700\u8981\u4e0b\u8f09\u66f4\u65b0\u3002", "Yahoo! \u5947\u6469\u8f38\u5165\u6cd5", MessageBoxButtons.OK, MessageBoxIcon.Information);
                else if (locale == "zh-CN")
                    MessageBox.Show(h, "\u60a8\u73b0\u5728\u4f7f\u7528\u7684\u5df2\u7ecf\u662f\u6700\u65b0\u7248\u672c\uff0c\u4e0d\u9700\u8981\u4e0b\u8f7d\u66f4\u65b0\u3002", "Yahoo! \u5947\u6469\u8f93\u5165\u6cd5", MessageBoxButtons.OK, MessageBoxIcon.Information);
                else
                    MessageBox.Show(h, "You are now using the newest version. You need not to upgrade your software.", "Yahoo! KeyKey", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #39
0
        public static void ImportFromFile(GridClient client)
        {
            WindowWrapper mainWindow = new WindowWrapper(frmMain.ActiveForm.Handle);
            System.Windows.Forms.OpenFileDialog dlg = new OpenFileDialog();
            dlg.Title = "Open object file";
            dlg.Filter = "XML file (*.xml)|*.xml";
            dlg.Multiselect = false;
            DialogResult res = dlg.ShowDialog();

            if (res == DialogResult.OK)
            {

                System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(delegate()
                {
                    try
                    {
                        PrimDeserializer d = new PrimDeserializer(client);
                        string primsXmls = System.IO.File.ReadAllText(dlg.FileName);
                        d.CreateObjectFromXml(primsXmls);
                        d.CleanUp();
                        d = null;
                        MessageBox.Show(mainWindow, "Successfully imported " + dlg.FileName, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    catch (Exception excp)
                    {
                        MessageBox.Show(mainWindow, excp.Message, "Saving failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }));

                t.IsBackground = true;
                t.Start();

            }
        }
 internal InventoryWorkBookClass()
 {
     try
     {
         xlApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application") as Excel.Application;
     }
     catch (System.Runtime.InteropServices.COMException e)
     {
         MessageBox.Show("The Excel application is not open.\rPlease start Excel with the Tax-Aide Inventory Workbook open.\r\r" + e.Message, "IDC Merge");
         Environment.Exit(1);
     }
     Process[] procs = Process.GetProcessesByName("Excel");
     if (procs.Length != 0)
     {
         IntPtr hwnd = procs[0].MainWindowHandle;
         winWrap4MsgBox = new WindowWrapper(hwnd);
     }
 }
예제 #41
0
파일: WmUiBroker.cs 프로젝트: tmbx/kwm
        /// <summary>
        /// Show the configuration wizard. Can be called by the UI after 
        /// a user action or automatically in WorkspaceManager.OnMainFormLoaded.
        /// </summary>
        public DialogResult ShowConfigWizard()
        {
            try
            {
                WindowWrapper wrapper = new WindowWrapper(Misc.MainForm.Handle);
                ConfigKPPWizard wiz = new ConfigKPPWizard(m_wm.KmodBroker);
                Misc.OnUiEntry();
                DialogResult res;
                if (wrapper == null) res = wiz.ShowDialog();
                else res = wiz.ShowDialog(wrapper);
                Misc.OnUiExit();
                return res;
            }

            catch (Exception ex)
            {
                Base.HandleException(ex);
                return DialogResult.Cancel;
            }
        }
예제 #42
0
 public PixelsInfo(WindowWrapper windowWrapper)
 {
     WindowWrapper = windowWrapper;
 }
예제 #43
0
      private static int OnCustomColorDialog(ref int argb, int colorButtons, string title, IntPtr hParent)
      {
        int rc = 0;
        if (m_ShowCustomColorDialog != null)
        {
          try
          {
            var color = System.Drawing.Color.FromArgb(argb);
            System.Windows.Forms.IWin32Window parent = null;
            GetColorEventArgs e = new GetColorEventArgs(color, colorButtons==1, title);

            if( hParent != IntPtr.Zero )
              parent = new WindowWrapper(hParent);
            m_ShowCustomColorDialog(parent, e);
            if( e.SelectedColor != System.Drawing.Color.Empty )
            {
              argb = e.SelectedColor.ToArgb();
              rc = 1;
            }
          }
          catch (Exception ex)
          {
            Runtime.HostUtils.ExceptionReport(ex);
          }
        }
        return rc;
      }
예제 #44
0
        private WindowWrapper GetWrapper()
        {
            IntPtr hwnd = IntPtr.Zero;
            WindowWrapper wrapper = null;
            Process[] procs = Process.GetProcessesByName("msiexec");
            
            if (null != procs && procs.Length > 0) {
                foreach (Process proc in procs) {
                    if (proc.MainWindowTitle.Equals(this.Context.Parameters["prodName"].ToString()))
                    {
                        hwnd = proc.MainWindowHandle;
                        wrapper = new WindowWrapper(hwnd);

                    }
                }
            }
            return wrapper;
        }
예제 #45
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            WindowWrapper mainWindow = new WindowWrapper(frmMain.ActiveForm.Handle);
            System.Windows.Forms.SaveFileDialog dlg = new SaveFileDialog();
            dlg.AddExtension = true;
            dlg.RestoreDirectory = true;
            dlg.Title = "Save object as...";
            dlg.Filter = "XML file (*.xml)|*.xml";
            DialogResult res = dlg.ShowDialog();

            if (res == DialogResult.OK)
            {
                Thread t = new Thread(new ThreadStart(delegate()
                    {
                        try
                        {
                            PrimSerializer s = new PrimSerializer(client);
                            string primsXmls = s.GetSerializedAttachmentPrims(client.Network.CurrentSim, attachment.LocalID);
                            System.IO.File.WriteAllText(dlg.FileName, primsXmls);
                            s.CleanUp();
                            s = null;
                            MessageBox.Show(mainWindow, "Successfully saved " + dlg.FileName, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        catch (Exception excp)
                        {
                            MessageBox.Show(mainWindow, excp.Message, "Saving failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                ));
                t.IsBackground = true;
                t.Start();
            }
        }
        public void Main(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, ComponentStartMode startMode)
        {

            // To use the domain-specific API:
            //  Create another project with the same name as the paradigm name
            //  Copy the paradigm .mga file to the directory containing the new project
            //  In the new project, install the GME DSMLGenerator NuGet package (search for DSMLGenerator)
            //  Add a Reference in this project to the other project
            //  Add "using [ParadigmName] = ISIS.GME.Dsml.[ParadigmName].Classes.Interfaces;" to the top of this file
            // [ParadigmName].[KindName] dsCurrentObj = ISIS.GME.Dsml.[ParadigmName].Classes.[KindName].Cast(currentobj);

            // TODO: find model editor window and open form inside it. Would be nice to find it based on  C++ class.
            var mainHwd = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;

            IntPtr mdiClient = IntPtr.Zero;

            foreach (var childHwd in GetChildWindows(mainHwd))
            {
                StringBuilder sb = new StringBuilder(100);
                GetClassName(childHwd, sb, 100);
                if ("MDIClient" == sb.ToString())
                {
                    mdiClient = childHwd;
                    break;
                }
            }

            //GMEConsole.Warning.WriteLine("Name: '{0}' Position: {1} {2} {3} {4}", name, rr.Top, rr.Left, rr.Bottom, rr.Right);

            List<string> supportedKinds = new List<string>()
            {
                typeof(CyPhy.Component).Name,
                typeof(CyPhy.ComponentAssembly).Name,
                typeof(CyPhy.TestComponent).Name,
                typeof(CyPhy.DesignContainer).Name,
                typeof(CyPhy.TestBench).Name,
                typeof(CyPhy.BlastTestBench).Name,
                typeof(CyPhy.BallisticTestBench).Name,
                typeof(CyPhy.CADTestBench).Name,
                typeof(CyPhy.CFDTestBench).Name,
                typeof(CyPhy.TestBenchSuite).Name,
            };

            if (currentobj == null ||
                supportedKinds.Contains(currentobj.Meta.Name) == false)
            {
                GMEConsole.Warning.WriteLine("One of the following object types must be open in the editor: {0}", string.Join(", ", supportedKinds));
                return;
            }

            List<ComponentParameterItem> parameterItems = new List<ComponentParameterItem>();

            if (currentobj.Meta.Name == typeof(CyPhy.Component).Name ||
                currentobj.Meta.Name == typeof(CyPhy.ComponentAssembly).Name)
            {
                var component = CyPhyClasses.DesignElement.Cast(currentobj);

                foreach (var item in component.Children.ParameterCollection)
                {
                    var parameterItem = new ComponentParameterItem(item.Impl as MgaFCO);

                    if (item.SrcConnections.ValueFlowCollection.Where(x => x.ParentContainer.ID == item.ParentContainer.ID).Count() > 0)
                    {
                        // skip derived parameters
                        GMEConsole.Info.WriteLine("{0} is a derived parameter; it is not shown in list.", item.Name);
                        continue;
                    }

                    parameterItems.Add(parameterItem);
                }

                foreach (var item in component.Children.PropertyCollection)
                {
                    var parameterItem = new ComponentParameterItem(item.Impl as MgaFCO);

                    if (item.SrcConnections.ValueFlowCollection.Where(x => x.ParentContainer.ID == item.ParentContainer.ID).Count() > 0)
                    {
                        // skip derived parameters
                        GMEConsole.Info.WriteLine("{0} is a derived parameter; it is not shown in list.", item.Name);
                        continue;
                    }

                    parameterItems.Add(parameterItem);
                }
            }
            else if (currentobj.Meta.Name == typeof(CyPhy.DesignContainer).Name)
            {
                var component = CyPhyClasses.DesignContainer.Cast(currentobj);

                foreach (var item in component.Children.ParameterCollection)
                {
                    var parameterItem = new ComponentParameterItem(item.Impl as MgaFCO);

                    if (item.SrcConnections.ValueFlowCollection.Where(x => x.ParentContainer.ID == item.ParentContainer.ID).Count() > 0)
                    {
                        // skip derived parameters
                        GMEConsole.Info.WriteLine("{0} is a derived parameter; it is not  shown in list.", item.Name);
                        continue;
                    }

                    parameterItems.Add(parameterItem);
                }

                foreach (var item in component.Children.PropertyCollection)
                {
                    var parameterItem = new ComponentParameterItem(item.Impl as MgaFCO);

                    if (item.SrcConnections.ValueFlowCollection.Where(x => x.ParentContainer.ID == item.ParentContainer.ID).Count() > 0)
                    {
                        // skip derived parameters
                        GMEConsole.Info.WriteLine("{0} is a derived parameter; it is not shown in list.", item.Name);
                        continue;
                    }

                    parameterItems.Add(parameterItem);
                }

            }
            else if (currentobj.Meta.Name == typeof(CyPhy.TestComponent).Name)
            {
                var component = CyPhyClasses.TestComponent.Cast(currentobj);

                foreach (var item in component.Children.ParameterCollection)
                {
                    var parameterItem = new ComponentParameterItem(item.Impl as MgaFCO);

                    if (item.SrcConnections.ValueFlowCollection.Where(x => x.ParentContainer.ID == item.ParentContainer.ID).Count() > 0)
                    {
                        // skip derived parameters
                        GMEConsole.Info.WriteLine("{0} is a derived parameter; it is not  shown in list.", item.Name);
                        continue;
                    }

                    parameterItems.Add(parameterItem);
                }

                foreach (var item in component.Children.PropertyCollection)
                {
                    var parameterItem = new ComponentParameterItem(item.Impl as MgaFCO);

                    if (item.SrcConnections.ValueFlowCollection.Where(x => x.ParentContainer.ID == item.ParentContainer.ID).Count() > 0)
                    {
                        // skip derived parameters
                        GMEConsole.Info.WriteLine("{0} is a derived parameter; it is not shown in list.", item.Name);
                        continue;
                    }

                    parameterItems.Add(parameterItem);
                }

                foreach (var item in component.Children.MetricCollection)
                {
                    var parameterItem = new ComponentParameterItem(item.Impl as MgaFCO);

                    if (item.SrcConnections.ValueFlowCollection.Where(x => x.ParentContainer.ID == item.ParentContainer.ID).Count() > 0)
                    {
                        // skip derived parameters
                        //GMEConsole.Info.WriteLine("{0} is a derived parameter; it is not shown in list.", item.Name);
                        //continue;
                    }

                    parameterItems.Add(parameterItem);
                }
            }

            else if (currentobj.Meta.Name == typeof(CyPhy.TestBench).Name ||
                currentobj.Meta.Name == typeof(CyPhy.BlastTestBench).Name ||
                currentobj.Meta.Name == typeof(CyPhy.BallisticTestBench).Name ||
                currentobj.Meta.Name == typeof(CyPhy.CADTestBench).Name ||
                currentobj.Meta.Name == typeof(CyPhy.CFDTestBench).Name)
            {
                var component = CyPhyClasses.TestBenchType.Cast(currentobj);

                foreach (var item in component.Children.ParameterCollection)
                {
                    var parameterItem = new ComponentParameterItem(item.Impl as MgaFCO);

                    if (item.SrcConnections.ValueFlowCollection.Where(x => x.ParentContainer.ID == item.ParentContainer.ID).Count() > 0)
                    {
                        // skip derived parameters
                        GMEConsole.Info.WriteLine("{0} is a derived parameter; it is not  shown in list.", item.Name);
                        continue;
                    }

                    parameterItems.Add(parameterItem);
                }

                foreach (var item in component.Children.PropertyCollection)
                {
                    var parameterItem = new ComponentParameterItem(item.Impl as MgaFCO);

                    if (item.SrcConnections.ValueFlowCollection.Where(x => x.ParentContainer.ID == item.ParentContainer.ID).Count() > 0)
                    {
                        // skip derived parameters
                        GMEConsole.Info.WriteLine("{0} is a derived parameter; it is not shown in list.", item.Name);
                        continue;
                    }

                    parameterItems.Add(parameterItem);
                }

                foreach (var item in component.Children.MetricCollection)
                {
                    var parameterItem = new ComponentParameterItem(item.Impl as MgaFCO);

                    if (item.SrcConnections.ValueFlowCollection.Where(x => x.ParentContainer.ID == item.ParentContainer.ID).Count() > 0)
                    {
                        // skip derived parameters
                        //GMEConsole.Info.WriteLine("{0} is a derived parameter; it is not shown in list.", item.Name);
                        //continue;
                    }

                    parameterItems.Add(parameterItem);
                }
            }
            else if (currentobj.Meta.Name == typeof(CyPhy.TestBenchSuite).Name)
            {
                var component = CyPhyClasses.TestBenchSuite.Cast(currentobj);

                foreach (var item in component.Children.ParameterCollection)
                {
                    var parameterItem = new ComponentParameterItem(item.Impl as MgaFCO);

                    if (item.SrcConnections.ValueFlowCollection.Where(x => x.ParentContainer.ID == item.ParentContainer.ID).Count() > 0)
                    {
                        // skip derived parameters
                        GMEConsole.Info.WriteLine("{0} is a derived parameter; it is not  shown in list.", item.Name);
                        continue;
                    }

                    parameterItems.Add(parameterItem);
                }

                foreach (var item in component.Children.MetricCollection)
                {
                    var parameterItem = new ComponentParameterItem(item.Impl as MgaFCO);

                    if (item.SrcConnections.ValueFlowCollection.Where(x => x.ParentContainer.ID == item.ParentContainer.ID).Count() > 0)
                    {
                        // skip derived parameters
                        //GMEConsole.Info.WriteLine("{0} is a derived parameter; it is not shown in list.", item.Name);
                        //continue;
                    }

                    parameterItems.Add(parameterItem);
                }
            }

            parameterItems.Sort((x, y) => x.Name.CompareTo(y.Name));

            if (parameterItems.Any() == false)
            {
                GMEConsole.Warning.WriteLine("Please insert at least one non-derived Parameter/Property in the model.");
                return;
            }

            using (ComponentParameterForm cpForm = new ComponentParameterForm(currentobj))
            {
                cpForm.dgvParameters.DataSource = new BindingList<ComponentParameterItem>(parameterItems);
                if (mdiClient != IntPtr.Zero)
                {
                    // TODO: would be nice to attach the form to the MDIClient window.
                    var parentWindow = new WindowWrapper(mdiClient);
                    var dialogResult = cpForm.ShowDialog(parentWindow);
                }
                else
                {
                    var dialogResult = cpForm.ShowDialog();
                }
            }
        }
예제 #47
0
파일: KwsApp.cs 프로젝트: tmbx/kwm-release
 public override void Run()
 {
     LicenseRestrictionMsgBox box = new LicenseRestrictionMsgBox(m_msg, m_showUpgradeAccount);
     WindowWrapper wrapper = new WindowWrapper(Misc.MainForm.Handle);
     if (wrapper != null) box.ShowDialog(wrapper);
     else box.ShowDialog();
 }
예제 #48
0
 public InchesInfo(WindowWrapper windowWrapper)
 {
     WindowWrapper = windowWrapper;
 }
예제 #49
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            try
            {
                OSGeo.OGR.Ogr.RegisterAll();

                OGRAddLayerDialog dlg = new OGRAddLayerDialog(m_hookHelper);

                IWin32Window parent = null;

                var application = m_hookHelper.Hook as IApplication;
                if (application != null)
                {
                    parent = new WindowWrapper(new IntPtr(application.hWnd));
                }

                dlg.Show(parent);
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
                System.Diagnostics.Trace.WriteLine(ex.Message);
            }
        }
 public FlowController(WindowWrapper wrapper, InstallContext context)
 {
     this.wrapper = wrapper;
     this.context = context;
 }