微軟官方文章
.NET Framework 開發人員部署手冊

種類

文章標籤

Robert 發表在 痞客邦 留言(1) 人氣()

只有用「VisibleChanged」事件一途..。

 

Microsoft.Office.Tools.CustomTaskPane myTaskPane;
public partial class MyControl : System.Windows.Forms.UserControl
{
    // ...
}

 

文章標籤

Robert 發表在 痞客邦 留言(0) 人氣()

Ready:排隊等待進入CPU被執行。
Runnung:正在被CPU執行。
Waiting:需要等待I/O存取的,離開CPU 在此等待。

文章標籤

Robert 發表在 痞客邦 留言(0) 人氣()

public static bool IsConnectingServer()
{
    string serverAddress = Properties.Settings.Default.ServerAddress;
    try
    {
        HttpWebRequest request = (HttpWebRequest) WebRequest.Create( serverAddress );
        request.Method = "HEAD";
        HttpWebResponse response = (HttpWebResponse) request.GetResponse();
        return response.StatusCode == HttpStatusCode.OK;
    } catch ( Exception )
    {
        return false;
    }
}

來源:C# Check Remote Server

參考:
Check whether a server is online using an IP and Port

文章標籤

Robert 發表在 痞客邦 留言(0) 人氣()

舉例:

using System;
using Microsoft.Win32;
// ...
string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\..."  // 相當於目錄.
string manifestValue = (string) Microsoft.Win32.Registry.GetValue( keyName, "Manifest", null );  // 相當於檔案'Manifest'.

參考:Registry.GetValue 方法 (String, String, Object)

 

文章標籤

Robert 發表在 痞客邦 留言(0) 人氣()

目前知道的有:

  • System.IO.StreamWriter
  • System.IO.File.WriteAllLines
  • System.IO.File.WriteAllText
  • System.IO.File.CreateText

System.IO.StreamWriter:

    // 使用'using' 自動做Flush()、Close()、Dispose(), 釋放tw資源.
    using ( StreamWriter tw = new StreamWriter( "test.txt", true ) )  // 'true':新建或附加.
    {
        tw.WriteLine( "The next line!" );
    }

    using ( StreamWriter tw = new StreamWriter( "test.txt", false ) )  // 'false',或沒填:新建或覆蓋.
    {
        tw.WriteLine( "The next line!" );
    }

參考:Create a .txt file if doesn't exist, and if it does append a new line

文章標籤

Robert 發表在 痞客邦 留言(0) 人氣()

後來才知道,不存在的路徑+檔案,是無法一次建立的。(目前所知)

 

建立「資料夾」的方法(含一連串不存在的目錄):

文章標籤

Robert 發表在 痞客邦 留言(0) 人氣()

string path = Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)).FullName;
if ( Environment.OSVersion.Version.Major >= 6 ) {  // 判斷是不是Vista以上.
    path = Directory.GetParent(path).ToString();
}

來源:How can I get the current user directory?

參考:Operating System Version (version number)
備份:(2017/12/21)

文章標籤

Robert 發表在 痞客邦 留言(0) 人氣()

用 Visual Studio 開發 WinForm 的視窗程式介面時,專案有很方便的方式開發多語系介面。
但是,如果是在程式啟動、載入之後,才要變更語系呢?

在網路上搜尋、嘗試了一陣子,還沒找到方便的方法,只能刻苦耐勞地去刻:

文章標籤

Robert 發表在 痞客邦 留言(0) 人氣()

原來這麼簡單...

Process.Start(@"http://www.google.com");

參考:
URL redirect + VSTO

文章標籤

Robert 發表在 痞客邦 留言(0) 人氣()