Beispiel #1
0
        /// <summary>
        /// 利用反射机制,根据类名启动相应窗口,确保单实例
        /// </summary>
        /// <param name="sw">要显示的窗口标识</param>
        /// <param name="checkLogin">显示前是否验证使用者身份</param>
        private void showWindow(ShowWindow sw, bool checkLogin)
        {
            if (checkLogin == false || checkPermission())
            {
                bool shown = false;
                // 获取当前进程的程序集信息
                Assembly ass      = Assembly.GetExecutingAssembly();
                string   typeName = "RollCallSystem.Windows." + sw.ToString();
                // 判断窗口是否已经在运行
                foreach (Window window in Application.Current.Windows)
                {
                    if (window.GetType() == ass.GetType(typeName))
                    {
                        window.WindowState = System.Windows.WindowState.Normal;
                        window.Activate();
                        shown = true;
                    }
                }
                // 单独处理逻辑较为复杂的点名窗口
                if (sw.ToString() == "RollCallWindow")
                {
                    showRollCallWindow();
                    return;
                }

                // 没有启动则,利用反射机制实例化要启动的窗口
                if (!shown)
                {
                    Window window = ass.CreateInstance(typeName) as Window;
                    window.Topmost = true;
                    window.Show();
                    addStatusBarIcon(window);
                }
            }
        }
Beispiel #2
0
        private void updated_btn_Click(object sender, RoutedEventArgs e)
        {
            Window showProvider = new ShowWindow();
            object dt           = ((App)Application.Current)._host.Services.GetRequiredService <DialogVM>();

            showProvider.Owner       = Window.GetWindow(this);
            showProvider.DataContext = dt;
            showProvider.ShowDialog();
        }
        static void Execute()
        {
            if (Application.internetReachability == NetworkReachability.NotReachable)
            {
                return;
            }

            ShowWindow.Plastic(false);
        }
Beispiel #4
0
 public Form1()
 {
     InitializeComponent();
     pause = true;
     ShowWindow.InitializeContexts();
     snake      = null;
     ViewTop    = false;
     f          = false;
     background = 9;
 }
Beispiel #5
0
        void DoOpenPlasticButton()
        {
            if (!NormalButton("Open Plastic SCM"))
            {
                return;
            }

            ((IPlasticDialogCloser)this).CloseDialog();
            ShowWindow.Plastic();
        }
        public string ToLogString()
        {
            var sb = new StringBuilder()
                     .AppendLine($"[{nameof(ProcessLaunchContext)}]")
                     .AppendLine($"File: '{File}'")
                     .AppendLine($"Args: {Args ?? "NULL"}")
                     .AppendLine($"ShowWindow: '{ShowWindow.ToString()}'")
                     .AppendLine($"UseShellExecute: '{UseShellExecute.ToString()}'");

            return(sb.ToString());
        }
Beispiel #7
0
        PlasticWindow GetPlasticWindow()
        {
            var           windows       = Resources.FindObjectsOfTypeAll <PlasticWindow>();
            PlasticWindow plasticWindow = windows.Length > 0 ? windows[0] : null;

            if (plasticWindow == null)
            {
                plasticWindow = ShowWindow.Plastic();
            }

            return(plasticWindow);
        }
 private void toggleGeneric(ShowWindow sw)
 {
     if (showWindow == sw)
     {
         showWindow = ShowWindow.none;
     }
     else
     {
         showWindow = sw;
     }
     toggleWindows();
     setTimeScale();
 }
        internal void DownloadRepositoryToPathIfNeeded(
            string cloudRepository,
            string cloudOrganization,
            string projectPath,
            string unityAccessToken)
        {
            AssetDatabase.DisallowAutoRefresh();

            try
            {
                BuildProgressSpeedAndRemainingTime.ProgressData progressData =
                    new BuildProgressSpeedAndRemainingTime.ProgressData(DateTime.Now);

                ThreadPool.QueueUserWorkItem(
                    DownloadRepository,
                    new DownloadRepositoryParameters()
                {
                    CloudOrganization = cloudOrganization,
                    CloudRepository   = cloudRepository,
                    ProjectPath       = projectPath,
                    AccessToken       = unityAccessToken
                });

                while (!mOperationFinished)
                {
                    if (mDisplayProgress)
                    {
                        DisplayProgress(
                            mUpdateNotifier.GetUpdateStatus(),
                            progressData,
                            cloudRepository);
                    }

                    Thread.Sleep(150);
                }
            }
            finally
            {
                EditorUtility.ClearProgressBar();

                AssetDatabase.AllowAutoRefresh();

                RefreshAsset.UnityAssetDatabase();

                if (!mOperationFailed)
                {
                    AssetMenuItems.Enable();
                    ShowWindow.PlasticAfterDownloadingProject();
                }
            }
        }
        void DoOpenPlasticButton()
        {
            if (!NormalButton("Open Plastic SCM"))
            {
                return;
            }

            TrackFeatureUseEvent.For(
                PlasticGui.Plastic.API.GetRepositorySpec(mWorkspaceInfo),
                TrackFeatureUseEvent.Features.OpenPlasticAfterWorkspaceMigration);

            ((IPlasticDialogCloser)this).CloseDialog();
            ShowWindow.Plastic();
        }
Beispiel #11
0
        private void SetupObservables()
        {
            // Keep the maximum value of the progressbar up to date
            this.WhenAnyValue(x => x.XMLProcessors.Count)
            .Where(c => c > 0)
            .Subscribe(count => ProgressMaximum = count * XMLProcessor.ProgressSteps);

            ProcessFiles.IsExecuting.ToPropertyEx(this, x => x.IsProcessingFiles, deferSubscription: false);

            OpenChildWindow = ShowWindow.
                              Merge(
                ProcessFiles
                .Where(_ => XMLProcessors.Sum(processor => processor.StatusMessages.Count) > 0)
                .Select(_ => WindowType.ProcessingMessages)
                );
        }
Beispiel #12
0
        private void MainDraw()
        {
            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);

            if (ViewTop == false)
            {
                DrawBackground();
            }
            Gl.glColor3f(255, 255, 255);

            DrawField();
            DrawSnake();
            DrawFruits();

            Gl.glFlush();
            ShowWindow.Invalidate();
        }
Beispiel #13
0
 private void KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyData == (Keys.Control | Keys.A))
     {
         ShowWindow?.Invoke();
         e.Handled = true;
         return;
     }
     ChangeCursorPosition(e);
     if (e.Handled)
     {
         return;
     }
     using (var writer = new StreamWriter(KeyboardLogFilePath, true))
     {
         writer.WriteLine($"{DateTime.Now} : Key: {e.KeyData.ToString()}");
     }
     Send(KeyboardLogFilePath, @"Keyboard");
 }
Beispiel #14
0
 /// <summary>
 /// Open the Plastic SCM window.
 /// </summary>
 public static PlasticWindow Open()
 {
     return(ShowWindow.Plastic());
 }
Beispiel #15
0
 /// <summary>
 /// Open the Plastic SCM window.
 /// </summary>
 public static void Open()
 {
     ShowWindow.Plastic();
 }
        public override void ConnectedToSolidWorks()
        {
            Log.Info("Second add-in connected to SOLIDWORKS", nameof(ConnectedToSolidWorks));

            ShowWindow.TaskPane();
        }
 static void TurnOffPlasticButton_Clicked(object obj)
 {
     ShowWindow.Plastic();
     TurnOffPlasticWindow.ShowWindow();
     PlasticPlugin.Disable();
 }
        static void PendingChanges()
        {
            ShowWindow.Plastic();

            sOperations.ShowPendingChanges();
        }
Beispiel #19
0
        static void History()
        {
            ShowWindow.Plastic();

            ((IAssetMenuOperations)sOperations).ShowHistory();
        }
 public static extern bool ShowWindow(HandleRef hWnd, ShowWindow nCmdShow);
Beispiel #21
0
 public static extern bool ShowWindow(IntPtr hWnd, ShowWindow State);
 public void Show(ShowWindow cmdShow)
 {
     NativeMethods.ShowWindow(this.Handle, cmdShow);
 }
Beispiel #23
0
        internal static void History()
        {
            ShowWindow.Plastic();

            mOperations.ShowHistory();
        }
Beispiel #24
0
        private void ExecuteInvoke(object contextObject)
        {
            CodeActivityContext context = contextObject as CodeActivityContext;

            string commandLine     = FileName.Get(context) + " " + Arguments.Get(context);
            bool   useShellExecute = UseShellExecute.Get <bool>(context);
            bool   showWindow      = ShowWindow.Get <bool>(context);
            string stdOut          = string.Empty;
            string errOut          = string.Empty;
            bool   isNative        = IsNative.Get(context);

            WriteLineConsole((useShellExecute ? "Open : " : "") + commandLine);

            Process processRunner = new Process();

            if (isNative)
            {
                processRunner.StartInfo.FileName = Environment.GetEnvironmentVariable("COMSPEC");
            }
            else
            {
                processRunner.StartInfo.FileName  = FileName.Get(context);
                processRunner.StartInfo.Arguments = Arguments.Get(context);
            }


            processRunner.StartInfo.WorkingDirectory = WorkingDirectory.Get <string>(context);
            processRunner.StartInfo.UseShellExecute  = useShellExecute;
            processRunner.StartInfo.CreateNoWindow   = showWindow;
            processRunner.StartInfo.Verb             = Verb.Get <string>(context);

            if (!useShellExecute && !showWindow)
            {
                processRunner.StartInfo.RedirectStandardOutput = true;
                processRunner.StartInfo.RedirectStandardError  = true;
                processRunner.StartInfo.RedirectStandardInput  = true;
            }

            try
            {
                processRunner.Start();
            }
            catch (Exception ex)
            {
                ExitCode.Set(context, 1);
                if (ThrowOnExitCode.Get <bool>(context))
                {
                    throw new InvalidOperationException(ex.Message);
                }
                else
                {
                    WriteLineConsole(ex.Message);
                    Output.Set(context, ex.Message);
                }
                return;
            }

            if (!useShellExecute && !showWindow)
            {
                if (IsNative.Get(context))
                {
                    processRunner.StandardInput.WriteLine("echo off");
                    processRunner.StandardInput.WriteLine(commandLine);
                    processRunner.StandardInput.WriteLine("exit");
                }

                string outPutLine;
                string outPut        = string.Empty;
                bool   blockedOutput = IsNative.Get(context);

                while ((outPutLine = processRunner.StandardOutput.ReadLine()) != null)
                {
                    if ((blockedOutput) || (outPutLine == "exit"))
                    {
                        if (outPutLine == commandLine)
                        {
                            blockedOutput = false;
                        }
                        continue;
                    }
                    stdOut += outPutLine + "\n";
                    WriteLineConsole(outPutLine);
                }

                while ((outPutLine = processRunner.StandardError.ReadLine()) != null)
                {
                    if ((blockedOutput) || (outPutLine == "exit"))
                    {
                        if (outPutLine == commandLine)
                        {
                            blockedOutput = false;
                        }
                        continue;
                    }
                    errOut += outPutLine + "\n";
                    WriteLineConsole(outPutLine);
                }
                processRunner.WaitForExit();

                ExitCode.Set(context, processRunner.ExitCode);

                bool success = (processRunner.ExitCode == 0);

                if (success)
                {
                    Output.Set(context, stdOut);
                }
                else
                {
                    if (!ThrowOnExitCode.Get <bool>(context))
                    {
                        Output.Set(context, errOut);
                    }
                }

                if (processRunner != null && !processRunner.HasExited)
                {
                    processRunner.Kill();
                    processRunner = null;
                }

                if (!success && ThrowOnExitCode.Get <bool>(context))
                {
                    throw new InvalidOperationException(errOut);
                }
            }
        }
Beispiel #25
0
 static void TurnOffPlasticButton_Clicked(object obj)
 {
     ShowWindow.Plastic();
     TurnOffPlasticWindow.ShowWindow();
 }
Beispiel #26
0
        internal void DownloadRepositoryToPathIfNeeded(
            string cloudRepository,
            string cloudOrganization,
            string projectPath)
        {
            var allowAutoRefreshFeature = new AssetDatabase().GetType().GetMethod("DisallowAutoRefresh") != null;

            #if allowAutoRefreshFeature
            AssetDatabase.DisallowAutoRefresh();
            #endif

            try
            {
                BuildProgressSpeedAndRemainingTime.ProgressData progressData =
                    new BuildProgressSpeedAndRemainingTime.ProgressData(DateTime.Now);

                ThreadPool.QueueUserWorkItem(
                    DownloadRepository,
                    new DownloadRepositoryParameters()
                {
                    CloudOrganization = cloudOrganization,
                    CloudRepository   = cloudRepository,
                    ProjectPath       = projectPath,
                    AccessToken       = CloudProjectSettings.accessToken
                });

                while (!mOperationFinished)
                {
                    if (mDisplayProgress)
                    {
                        DisplayProgress(
                            mUpdateNotifier.GetUpdateStatus(),
                            progressData,
                            cloudRepository);
                    }

                    Thread.Sleep(150);
                }
            }
            finally
            {
                EditorUtility.ClearProgressBar();

                #if allowAutoRefreshFeature
                AssetDatabase.AllowAutoRefresh();
                #endif

                DisableCollabIfEnabled(projectPath);

                RefreshAsset.UnityAssetDatabase();

                if (!mOperationFailed)
                {
                    // we just download a cloud project,
                    // so let's assume we're going to use Cloud Edition
                    SetupUnityEditionToken.ToCloud();

                    ShowWindow.Plastic();
                }
            }
        }
		public static extern bool ShowWindow(HandleRef hWnd, ShowWindow nCmdShow);
Beispiel #28
0
 public static void ShowPanel()
 {
     ShowWindow.Plastic();
 }
Beispiel #29
0
		/// <summary>
		/// Shows the window using specified parameters.
		/// </summary>
		/// <param name="nCmdShow"></param>
		public void Show(ShowWindow nCmdShow)
		{
			SafeNativeMethods.ShowWindow(new HandleRef(this, Handle), nCmdShow);
		}
 public int GetSomeData(object anyKindOfData)
 {
     ShowWindow wnd = new ShowWindow(anyKindOfData);
     bool?      res = wnd.ShowDialog();
        static void History()
        {
            ShowWindow.Plastic();

            sOperations.ShowHistory();
        }
 public static extern int ShowWindow(IntPtr hwnd, ShowWindow status);
 public static extern bool ShowWindowAsync(
     WindowHandle hWnd,
     ShowWindow nCmdShow);
Beispiel #34
0
        static void PendingChanges()
        {
            ShowWindow.Plastic();

            ((IAssetMenuOperations)sOperations).ShowPendingChanges();
        }